| 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 AsyncMarker, | 9 AsyncMarker, |
| 10 Arguments, | 10 Arguments, |
| 11 Block, | 11 Block, |
| 12 Catch, | 12 Catch, |
| 13 Class, | 13 Class, |
| 14 ClosureCreation, | 14 ClosureCreation, |
| 15 Constructor, | 15 Constructor, |
| 16 DartType, | 16 DartType, |
| 17 DoStatement, | 17 DoStatement, |
| 18 DynamicType, |
| 18 EmptyStatement, | 19 EmptyStatement, |
| 19 Expression, | 20 Expression, |
| 20 ExpressionStatement, | 21 ExpressionStatement, |
| 21 Field, | 22 Field, |
| 22 ForInStatement, | 23 ForInStatement, |
| 23 ForStatement, | 24 ForStatement, |
| 24 FunctionDeclaration, | 25 FunctionDeclaration, |
| 25 FunctionExpression, | 26 FunctionExpression, |
| 26 FunctionNode, | 27 FunctionNode, |
| 27 FunctionType, | 28 FunctionType, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 StaticInvocation, | 47 StaticInvocation, |
| 47 ThisExpression, | 48 ThisExpression, |
| 48 Transformer, | 49 Transformer, |
| 49 TreeNode, | 50 TreeNode, |
| 50 TypeParameter, | 51 TypeParameter, |
| 51 TypeParameterType, | 52 TypeParameterType, |
| 52 VariableDeclaration, | 53 VariableDeclaration, |
| 53 VariableGet, | 54 VariableGet, |
| 54 VariableSet, | 55 VariableSet, |
| 55 VectorCreation, | 56 VectorCreation, |
| 56 VectorType, | |
| 57 WhileStatement, | 57 WhileStatement, |
| 58 transformList; | 58 transformList; |
| 59 | 59 |
| 60 import '../../frontend/accessors.dart' show VariableAccessor; | 60 import '../../frontend/accessors.dart' show VariableAccessor; |
| 61 | 61 |
| 62 import '../../clone.dart' show CloneVisitor; | 62 import '../../clone.dart' show CloneVisitor; |
| 63 | 63 |
| 64 import '../../core_types.dart' show CoreTypes; | 64 import '../../core_types.dart' show CoreTypes; |
| 65 | 65 |
| 66 import '../../type_algebra.dart' show substitute; | 66 import '../../type_algebra.dart' show substitute; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 FunctionNode enclosingFunction = currentFunction; | 364 FunctionNode enclosingFunction = currentFunction; |
| 365 Map<TypeParameter, DartType> enclosingTypeSubstitution = typeSubstitution; | 365 Map<TypeParameter, DartType> enclosingTypeSubstitution = typeSubstitution; |
| 366 currentFunction = function; | 366 currentFunction = function; |
| 367 Statement body = function.body; | 367 Statement body = function.body; |
| 368 assert(body != null); | 368 assert(body != null); |
| 369 | 369 |
| 370 rewriter = makeRewriterForBody(function); | 370 rewriter = makeRewriterForBody(function); |
| 371 | 371 |
| 372 VariableDeclaration contextVariable = | 372 VariableDeclaration contextVariable = |
| 373 new VariableDeclaration("#contextParameter", type: const VectorType()); | 373 new VariableDeclaration("#contextParameter", type: const DynamicType()); |
| 374 Context parent = context; | 374 Context parent = context; |
| 375 context = context.toNestedContext( | 375 context = context.toNestedContext( |
| 376 new VariableAccessor(contextVariable, null, TreeNode.noOffset)); | 376 new VariableAccessor(contextVariable, null, TreeNode.noOffset)); |
| 377 | 377 |
| 378 Set<TypeParameter> captured = | 378 Set<TypeParameter> captured = |
| 379 capturedTypeVariables[currentFunction] ?? new Set<TypeParameter>(); | 379 capturedTypeVariables[currentFunction] ?? new Set<TypeParameter>(); |
| 380 typeSubstitution = copyTypeVariables(captured); | 380 typeSubstitution = copyTypeVariables(captured); |
| 381 | 381 |
| 382 function.transformChildren(this); | 382 function.transformChildren(this); |
| 383 | 383 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 copy.function.body.parent = copy.function; | 839 copy.function.body.parent = copy.function; |
| 840 return copy; | 840 return copy; |
| 841 } | 841 } |
| 842 | 842 |
| 843 void addGetterForwarder(Name name, Procedure getter) { | 843 void addGetterForwarder(Name name, Procedure getter) { |
| 844 assert(getter.isGetter); | 844 assert(getter.isGetter); |
| 845 newClassMembers | 845 newClassMembers |
| 846 .add(copyWithBody(getter, forwardToThisProperty(getter))..name = name); | 846 .add(copyWithBody(getter, forwardToThisProperty(getter))..name = name); |
| 847 } | 847 } |
| 848 } | 848 } |
| OLD | NEW |