OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.converter; | 5 library kernel.transformations.closure.converter; |
6 | 6 |
7 import '../../ast.dart' | 7 import '../../ast.dart' |
8 show | 8 show |
9 Arguments, | 9 Arguments, |
10 Block, | 10 Block, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 Statement body = function.body; | 259 Statement body = function.body; |
260 assert(body != null); | 260 assert(body != null); |
261 | 261 |
262 rewriter = makeRewriterForBody(function); | 262 rewriter = makeRewriterForBody(function); |
263 | 263 |
264 VariableDeclaration contextVariable = new VariableDeclaration( | 264 VariableDeclaration contextVariable = new VariableDeclaration( |
265 "#contextParameter", | 265 "#contextParameter", |
266 type: contextClass.rawType, | 266 type: contextClass.rawType, |
267 isFinal: true); | 267 isFinal: true); |
268 Context parent = context; | 268 Context parent = context; |
269 context = context.toNestedContext(new VariableAccessor(contextVariable)); | 269 context = context.toNestedContext( |
| 270 new VariableAccessor(contextVariable, null, TreeNode.noOffset)); |
270 | 271 |
271 Set<TypeParameter> captured = capturedTypeVariables[currentFunction]; | 272 Set<TypeParameter> captured = capturedTypeVariables[currentFunction]; |
272 if (captured != null) { | 273 if (captured != null) { |
273 typeSubstitution = copyTypeVariables(captured); | 274 typeSubstitution = copyTypeVariables(captured); |
274 } else { | 275 } else { |
275 typeSubstitution = const <TypeParameter, DartType>{}; | 276 typeSubstitution = const <TypeParameter, DartType>{}; |
276 } | 277 } |
277 | 278 |
278 function.transformChildren(this); | 279 function.transformChildren(this); |
279 | 280 |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 // TODO(ahe): Remove this method when we don't generate closure classes | 834 // TODO(ahe): Remove this method when we don't generate closure classes |
834 // anymore. | 835 // anymore. |
835 void addClosureClassNote(Class closureClass) { | 836 void addClosureClassNote(Class closureClass) { |
836 closureClass.addMember(new Field(new Name("note"), | 837 closureClass.addMember(new Field(new Name("note"), |
837 type: coreTypes.stringClass.rawType, | 838 type: coreTypes.stringClass.rawType, |
838 initializer: new StringLiteral( | 839 initializer: new StringLiteral( |
839 "This is temporary. The VM doesn't need closure classes."), | 840 "This is temporary. The VM doesn't need closure classes."), |
840 fileUri: currentFileUri)); | 841 fileUri: currentFileUri)); |
841 } | 842 } |
842 } | 843 } |
OLD | NEW |