Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart |
| diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart |
| index 5da69b667122d097700b568ebf3f0fc80553e1bd..81175a2893eb45537d810a9516af00b373a81479 100644 |
| --- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart |
| +++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart |
| @@ -4,6 +4,9 @@ |
| library fasta.kernel_procedure_builder; |
| +import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' |
| + show TypeInferrer; |
| + |
| import 'package:kernel/ast.dart' |
| show |
| Arguments, |
| @@ -389,7 +392,7 @@ class KernelConstructorBuilder extends KernelFunctionBuilder { |
| } |
| } |
| - void addInitializer(Initializer initializer) { |
| + void addInitializer(Initializer initializer, TypeInferrer typeInferrer) { |
| List<Initializer> initializers = constructor.initializers; |
| if (initializer is SuperInitializer) { |
| checkSuperOrThisInitializer(initializer); |
| @@ -420,8 +423,13 @@ class KernelConstructorBuilder extends KernelFunctionBuilder { |
| Arguments arguments = superInitializer.arguments; |
| List<Expression> positional = arguments.positional; |
| for (int i = 0; i < positional.length; i++) { |
| - VariableDeclaration variable = |
| - new VariableDeclaration.forValue(positional[i], isFinal: true); |
| + var type = typeInferrer.typeSchemaEnvironment.strongMode |
|
ahe
2017/08/08 13:31:18
Missing type on variable.
Paul Berry
2017/08/08 16:42:25
IMHO this is ok--type inference will infer DartTyp
ahe
2017/08/08 17:35:44
I wouldn't have complained if hadn't used a type o
|
| + ? positional[i].getStaticType(typeInferrer.typeSchemaEnvironment) |
| + : const DynamicType(); |
| + VariableDeclaration variable = new VariableDeclaration.forValue( |
| + positional[i], |
| + isFinal: true, |
| + type: type); |
| initializers |
| .add(new LocalInitializer(variable)..parent = constructor); |
| positional[i] = new VariableGet(variable)..parent = arguments; |