Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: pkg/kernel/lib/transformations/closure/rewriter.dart

Issue 3007623002: Fix many bugs with closure conversion in checked mode. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library kernel.transformations.closure.rewriter; 5 library kernel.transformations.closure.rewriter;
6 6
7 import '../../ast.dart'; 7 import '../../ast.dart';
8 import 'converter.dart' show ClosureConverter; 8 import 'converter.dart' show ClosureConverter;
9 9
10 /// Used by the [Context] to initialize and update the context variable 10 /// Used by the [Context] to initialize and update the context variable
(...skipping 17 matching lines...) Expand all
28 void insertExtendContext(VectorSet extender); 28 void insertExtendContext(VectorSet extender);
29 29
30 void _createDeclaration() { 30 void _createDeclaration() {
31 assert(contextDeclaration == null && vectorCreation == null); 31 assert(contextDeclaration == null && vectorCreation == null);
32 32
33 // Context size is set to 2 initially, because the 0-th element of it holds 33 // Context size is set to 2 initially, because the 0-th element of it holds
34 // the vector of type arguments that the VM creates, and the 1-st element 34 // the vector of type arguments that the VM creates, and the 1-st element
35 // works as a link to the parent context. 35 // works as a link to the parent context.
36 vectorCreation = new VectorCreation(2); 36 vectorCreation = new VectorCreation(2);
37 contextDeclaration = new VariableDeclaration.forValue(vectorCreation, 37 contextDeclaration = new VariableDeclaration.forValue(vectorCreation,
38 type: new VectorType()); 38 type: const DynamicType());
39 contextDeclaration.name = "#context"; 39 contextDeclaration.name = "#context";
40 } 40 }
41 } 41 }
42 42
43 /// Adds a local variable for the context and adds update [Statement]s to the 43 /// Adds a local variable for the context and adds update [Statement]s to the
44 /// current block. 44 /// current block.
45 class BlockRewriter extends AstRewriter { 45 class BlockRewriter extends AstRewriter {
46 Block _currentBlock; 46 Block _currentBlock;
47 int _insertionIndex; 47 int _insertionIndex;
48 48
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 @override 108 @override
109 void insertExtendContext(VectorSet extender) { 109 void insertExtendContext(VectorSet extender) {
110 var init = new LocalInitializer( 110 var init = new LocalInitializer(
111 new VariableDeclaration(null, initializer: extender)); 111 new VariableDeclaration(null, initializer: extender));
112 init.parent = parentConstructor; 112 init.parent = parentConstructor;
113 prefix.add(init); 113 prefix.add(init);
114 } 114 }
115 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698