forked from dart-lang/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request 'fibers' (dart-lang#21) from fibers into main
Reviewed-on: http://git.local/dependencies/dart/pulls/21
- Loading branch information
Showing
46 changed files
with
831 additions
and
813 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
dart --enable_mirrors=true compile aot-snapshot runtime/tests/vm/dart/fiber/fiber_test.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
export CPATH="" | ||
./tools/build.py -m debug -a x64 runtime dart_precompiled_runtime ddc dartanalyzer analysis_server create_common_sdk create_platform_sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
export CPATH="" | ||
./tools/build.py -m release -a x64 runtime dart_precompiled_runtime ddc dartanalyzer analysis_server create_common_sdk create_platform_sdk |
401 changes: 133 additions & 268 deletions
401
pkg/analysis_server/lib/src/computer/computer_highlights.dart
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'dart:fiber'; | ||
import 'dart:async'; | ||
import 'package:expect/expect.dart'; | ||
|
||
final tests = [ | ||
testGlobalState, | ||
testClosureState, | ||
]; | ||
|
||
var globalStateValue = ""; | ||
void testGlobalState() { | ||
void child() { | ||
globalStateValue += "child -> "; | ||
Fiber.reschedule(); | ||
globalStateValue += "child"; | ||
} | ||
|
||
void main() { | ||
globalStateValue = ""; | ||
globalStateValue += "main -> "; | ||
Fiber.schedule(Fiber.current); | ||
Fiber.spawn(child); | ||
globalStateValue += "main -> "; | ||
Fiber.reschedule(); | ||
Expect.equals("main -> child -> main -> child", globalStateValue); | ||
} | ||
|
||
Fiber.launch(main); | ||
} | ||
|
||
void testClosureState() { | ||
var localState = "localState"; | ||
Fiber.launch( | ||
() { | ||
Expect.equals("localState", localState); | ||
localState = "after fiber"; | ||
}, | ||
); | ||
Expect.equals("after fiber", localState); | ||
|
||
localState = "localState"; | ||
Fiber.launch( | ||
() { | ||
Expect.equals("localState", localState); | ||
localState = "after main fiber"; | ||
Fiber.schedule(Fiber.current); | ||
Fiber.spawn( | ||
() { | ||
Expect.equals("after main fiber", localState); | ||
localState = "after child fiber"; | ||
Fiber.reschedule(); | ||
Expect.equals("after child fiber after main fiber", localState); | ||
localState = "finish"; | ||
}, | ||
name: "child", | ||
); | ||
Expect.equals("after child fiber", localState); | ||
localState = "after child fiber after main fiber"; | ||
Fiber.suspend(); | ||
}, | ||
); | ||
Expect.equals("finish", localState); | ||
|
||
localState = "level 1"; | ||
Fiber.launch( | ||
() { | ||
Expect.equals("level 1", localState); | ||
localState = "level 2"; | ||
Fiber.spawn( | ||
() { | ||
Expect.equals("level 2", localState); | ||
localState = "level 3"; | ||
Fiber.spawn( | ||
() { | ||
Expect.equals("level 3", localState); | ||
localState = "level 4"; | ||
}, | ||
name: "child", | ||
); | ||
}, | ||
name: "child", | ||
); | ||
}, | ||
); | ||
Expect.equals("level 4", localState); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.