Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart

Issue 2993193002: When reordering constructor initializers, use correct types for temp vars. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698