|
Add primitive to create closures and use it for closure conversion
A new AST node 'ClosureCreation' is added. It takes a name of a
top-level function, a context, and a closure function type and creates a
closure of the given type. The effect of this closure invocation is the
same as of the invocation of the given top-level function with the
contexts as the first argument.
In order to use 'ClosureCreation', the closure conversion pass now
transforms closures into top-level functions, not closure classes. These
functions receive the context as the first argument.
The type of the expression represented by 'ClosureCreation' is its third
parameter. It its the responsibility of closure conversion pass to
create the correct types for 'ClosureCreation' nodes based on types of
closures transformed into top-level functions.
R=asgerf@google.com
Committed: https://github.com/dart-lang/sdk/commit/42f82d1d2128161f402d5a69b20f82e7ee23f210
Total comments: 6
Total comments: 6
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+548 lines, -822 lines) |
Patch |
|
M |
pkg/kernel/binary.md
|
View
|
1
2
3
4
5
6
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/ast.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+43 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/binary/ast_from_binary.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/binary/ast_to_binary.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/binary/tag.dart
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/text/ast_to_text.dart
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+12 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/transformations/closure/converter.dart
|
View
|
1
2
3
4
5
6
7
8
|
20 chunks |
+189 lines, -143 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/type_checker.dart
|
View
|
|
2 chunks |
+14 lines, -2 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/lib/visitor.dart
|
View
|
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_closure.dart.expect
|
View
|
1
2
3
4
5
6
|
1 chunk |
+8 lines, -27 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
|
View
|
1
2
3
4
5
6
|
1 chunk |
+11 lines, -29 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/capture_this.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+11 lines, -38 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/catch.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+6 lines, -15 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_constructor.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+8 lines, -26 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer.dart.expect
|
View
|
1
2
3
4
5
6
|
1 chunk |
+8 lines, -26 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closure_in_initializer_closure.dart.expect
|
View
|
1
2
3
4
5
6
|
1 chunk |
+16 lines, -43 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/closures.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+4 lines, -13 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/field.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+16 lines, -52 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_in_closure.dart.expect
|
View
|
1
2
3
4
5
6
|
3 chunks |
+4 lines, -13 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_loop.dart.expect
|
View
|
1
2
3
4
5
6
|
3 chunks |
+9 lines, -27 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/for_variable_capture_test.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+4 lines, -14 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/instance_tear_off.dart.expect
|
View
|
1
2
3
4
5
6
|
5 chunks |
+110 lines, -212 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/named_closure.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+4 lines, -13 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/non_void_context.dart.expect
|
View
|
1
2
3
4
5
6
|
3 chunks |
+10 lines, -29 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/static_tear_off.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+12 lines, -32 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/type_variables.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+19 lines, -55 lines |
0 comments
|
Download
|
|
M |
pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect
|
View
|
1
2
3
4
5
6
|
2 chunks |
+4 lines, -13 lines |
0 comments
|
Download
|
Total messages: 9 (2 generated)
|