cli: restrict source scope names to lexical task operands
This commit is contained in:
1 parent
364eb57bbc
commit
9001e56325
32 files changed
+307
-6
No files matched your search
@@ -0,0 +1,28 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// schedules: 8
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §7
|
||||
module scope_cases.normal_exits
|
||||
|
||||
fn work(x: mut<u64>) -> void effects [] { *x = *x + 7u64; }
|
||||
fn read(x: ref<u64>) -> u64 effects [] { *x }
|
||||
fn main() -> u64 effects [task.spawn, task.wait] {
|
||||
var data: u64 = 0;
|
||||
for i in 0usize..8usize {
|
||||
scope s {
|
||||
mut part = data;
|
||||
let t = task.spawn(s, work, part);
|
||||
task.join(move t);
|
||||
let s = i;
|
||||
if s < 5 { continue; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
scope s {
|
||||
ref part = data;
|
||||
let t = task.spawn(s, read, part);
|
||||
let s = task.join(move t);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user