| OLD | NEW |
| 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 /// This file declares a "shadow hierarchy" of concrete classes which extend | 5 /// This file declares a "shadow hierarchy" of concrete classes which extend |
| 6 /// the kernel class hierarchy, adding methods and fields needed by the | 6 /// the kernel class hierarchy, adding methods and fields needed by the |
| 7 /// BodyBuilder. | 7 /// BodyBuilder. |
| 8 /// | 8 /// |
| 9 /// Instances of these classes may be created using the factory methods in | 9 /// Instances of these classes may be created using the factory methods in |
| 10 /// `ast_factory.dart`. | 10 /// `ast_factory.dart`. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 class KernelConstructorInvocation extends ConstructorInvocation | 90 class KernelConstructorInvocation extends ConstructorInvocation |
| 91 implements KernelExpression { | 91 implements KernelExpression { |
| 92 KernelConstructorInvocation(Constructor target, Arguments arguments, | 92 KernelConstructorInvocation(Constructor target, Arguments arguments, |
| 93 {bool isConst: false}) | 93 {bool isConst: false}) |
| 94 : super(target, arguments, isConst: isConst); | 94 : super(target, arguments, isConst: isConst); |
| 95 | 95 |
| 96 KernelConstructorInvocation.byReference( | 96 KernelConstructorInvocation.byReference( |
| 97 Reference targetReference, Arguments arguments) | 97 Reference targetReference, Arguments arguments) |
| 98 : super.byReference(targetReference, arguments); | 98 : super.byReference(targetReference, arguments); |
| 99 | 99 |
| 100 void _forEachArgument(void callback(String name, Expression expression)) { |
| 101 for (var expression in arguments.positional) { |
| 102 callback(null, expression); |
| 103 } |
| 104 for (var namedExpression in arguments.named) { |
| 105 callback(namedExpression.name, namedExpression.value); |
| 106 } |
| 107 } |
| 108 |
| 100 @override | 109 @override |
| 101 DartType _inferExpression( | 110 DartType _inferExpression( |
| 102 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 111 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 103 // TODO(scheglov): implement. | 112 return inferrer.inferConstructorInvocation( |
| 104 return typeNeeded ? const DynamicType() : null; | 113 typeContext, |
| 114 typeNeeded, |
| 115 fileOffset, |
| 116 target, |
| 117 arguments.types.isEmpty ? null : arguments.types, |
| 118 _forEachArgument, (type) { |
| 119 arguments = new Arguments(arguments.positional, |
| 120 named: arguments.named, types: type.typeArguments); |
| 121 }); |
| 105 } | 122 } |
| 106 } | 123 } |
| 107 | 124 |
| 108 /// Shadow object for [DirectMethodInvocation]. | 125 /// Shadow object for [DirectMethodInvocation]. |
| 109 class KernelDirectMethodInvocation extends DirectMethodInvocation | 126 class KernelDirectMethodInvocation extends DirectMethodInvocation |
| 110 implements KernelExpression { | 127 implements KernelExpression { |
| 111 KernelDirectMethodInvocation( | 128 KernelDirectMethodInvocation( |
| 112 Expression receiver, Procedure target, Arguments arguments) | 129 Expression receiver, Procedure target, Arguments arguments) |
| 113 : super(receiver, target, arguments); | 130 : super(receiver, target, arguments); |
| 114 | 131 |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 : super(variable, value); | 905 : super(variable, value); |
| 889 | 906 |
| 890 @override | 907 @override |
| 891 DartType _inferExpression( | 908 DartType _inferExpression( |
| 892 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { | 909 KernelTypeInferrer inferrer, DartType typeContext, bool typeNeeded) { |
| 893 var variable = this.variable as KernelVariableDeclaration; | 910 var variable = this.variable as KernelVariableDeclaration; |
| 894 return inferrer.inferVariableSet( | 911 return inferrer.inferVariableSet( |
| 895 typeContext, typeNeeded, variable._declaredType, value); | 912 typeContext, typeNeeded, variable._declaredType, value); |
| 896 } | 913 } |
| 897 } | 914 } |
| OLD | NEW |