Chromium Code Reviews| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 | 732 |
| 733 Arguments arguments = new Arguments(positional, types: types, named: named); | 733 Arguments arguments = new Arguments(positional, types: types, named: named); |
| 734 InvocationExpression invocation = procedure.isInstanceMember | 734 InvocationExpression invocation = procedure.isInstanceMember |
| 735 ? new MethodInvocation(receiver, procedure.name, arguments, procedure) | 735 ? new MethodInvocation(receiver, procedure.name, arguments, procedure) |
| 736 : new StaticInvocation(procedure, arguments); | 736 : new StaticInvocation(procedure, arguments); |
| 737 return new FunctionNode(new ReturnStatement(invocation), | 737 return new FunctionNode(new ReturnStatement(invocation), |
| 738 typeParameters: typeParameters, | 738 typeParameters: typeParameters, |
| 739 positionalParameters: positionalParameters, | 739 positionalParameters: positionalParameters, |
| 740 namedParameters: namedParameters, | 740 namedParameters: namedParameters, |
| 741 requiredParameterCount: function.requiredParameterCount, | 741 requiredParameterCount: function.requiredParameterCount, |
| 742 returnType: substitute(function.returnType, substitution), | 742 returnType: substitute(function.returnType, cloner.typeSubstitution), |
|
Dmitry Stefantsov
2017/03/15 13:41:16
This line fixes a bug in closure conversion. Previ
| |
| 743 inferredReturnValue: inferredReturnValue); | 743 inferredReturnValue: inferredReturnValue); |
| 744 } | 744 } |
| 745 | 745 |
| 746 /// Creates copies of the type variables in [original] and returns a | 746 /// Creates copies of the type variables in [original] and returns a |
| 747 /// substitution that can be passed to [substitute] to substitute all uses of | 747 /// substitution that can be passed to [substitute] to substitute all uses of |
| 748 /// [original] with their copies. | 748 /// [original] with their copies. |
| 749 Map<TypeParameter, DartType> copyTypeVariables( | 749 Map<TypeParameter, DartType> copyTypeVariables( |
| 750 Iterable<TypeParameter> original) { | 750 Iterable<TypeParameter> original) { |
| 751 if (original.isEmpty) return const <TypeParameter, DartType>{}; | 751 if (original.isEmpty) return const <TypeParameter, DartType>{}; |
| 752 Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{}; | 752 Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{}; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 // TODO(ahe): Remove this method when we don't generate closure classes | 833 // TODO(ahe): Remove this method when we don't generate closure classes |
| 834 // anymore. | 834 // anymore. |
| 835 void addClosureClassNote(Class closureClass) { | 835 void addClosureClassNote(Class closureClass) { |
| 836 closureClass.addMember(new Field(new Name("note"), | 836 closureClass.addMember(new Field(new Name("note"), |
| 837 type: coreTypes.stringClass.rawType, | 837 type: coreTypes.stringClass.rawType, |
| 838 initializer: new StringLiteral( | 838 initializer: new StringLiteral( |
| 839 "This is temporary. The VM doesn't need closure classes."), | 839 "This is temporary. The VM doesn't need closure classes."), |
| 840 fileUri: currentFileUri)); | 840 fileUri: currentFileUri)); |
| 841 } | 841 } |
| 842 } | 842 } |
| OLD | NEW |