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

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

Issue 2891053003: Add support for converted closures with explicit contexts to VM (Closed)
Patch Set: Temporarily disable Run step in closures test suite Created 3 years, 5 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class BlockRewriter extends AstRewriter { 44 class BlockRewriter extends AstRewriter {
45 Block _currentBlock; 45 Block _currentBlock;
46 int _insertionIndex; 46 int _insertionIndex;
47 47
48 BlockRewriter(this._currentBlock) : _insertionIndex = 0; 48 BlockRewriter(this._currentBlock) : _insertionIndex = 0;
49 49
50 BlockRewriter forNestedBlock(Block block) { 50 BlockRewriter forNestedBlock(Block block) {
51 return _currentBlock != block ? new BlockRewriter(block) : this; 51 return _currentBlock != block ? new BlockRewriter(block) : this;
52 } 52 }
53 53
54 void transformStatements(Block block, ClosureConverter converter) { 54 void transformStatements(ClosureConverter converter) {
55 while (_insertionIndex < _currentBlock.statements.length) { 55 while (_insertionIndex < _currentBlock.statements.length) {
56 var original = _currentBlock.statements[_insertionIndex]; 56 var original = _currentBlock.statements[_insertionIndex];
57 var transformed = original.accept(converter); 57 var transformed = original.accept(converter);
58 assert(_currentBlock.statements[_insertionIndex] == original); 58 assert(_currentBlock.statements[_insertionIndex] == original);
59 if (transformed == null) { 59 if (transformed == null) {
60 _currentBlock.statements.removeAt(_insertionIndex); 60 _currentBlock.statements.removeAt(_insertionIndex);
61 } else { 61 } else {
62 _currentBlock.statements[_insertionIndex++] = transformed; 62 _currentBlock.statements[_insertionIndex++] = transformed;
63 transformed.parent = _currentBlock; 63 transformed.parent = _currentBlock;
64 } 64 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 @override 107 @override
108 void insertExtendContext(VectorSet extender) { 108 void insertExtendContext(VectorSet extender) {
109 var init = new LocalInitializer( 109 var init = new LocalInitializer(
110 new VariableDeclaration(null, initializer: extender)); 110 new VariableDeclaration(null, initializer: extender));
111 init.parent = parentConstructor; 111 init.parent = parentConstructor;
112 prefix.add(init); 112 prefix.add(init);
113 } 113 }
114 } 114 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/closure/info.dart ('k') | pkg/kernel/test/closures/closures.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698