Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart | 
| diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart | 
| index 9b304e488f675c3b6fcc619d83f7e83b90c576de..07d30ce2306e05649c086688368f1f0c4623ed6b 100644 | 
| --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart | 
| +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart | 
| @@ -236,8 +236,13 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| } | 
| Block popBlock(int count) { | 
| - List<Statement> statements = popList(count) ?? <Statement>[]; | 
| - List<Statement> copy; | 
| + List statements = popList(count) ?? <Statement>[]; | 
| + // TODO(sigmund): should be List<Statement>. In strong mode the .addAll | 
| + // below shows an error (and will fail at runtime). The core issue is that | 
| + // `statements` is a List< Statement or List<Statement>>, but we expect that | 
| + // some of the nested lists will have a reified type of List not | 
| + // List<Statement>. | 
| 
 
ahe
2017/02/07 11:03:07
How about:
List<dynamic /* Statement | List<State
 
Siggi Cherem (dart-lang)
2017/02/07 21:59:25
Done. added the comment on the type, but had to do
 
 | 
| + List copy; | 
| 
 
ahe
2017/02/07 11:03:07
This should be List<Statement>.
 
Siggi Cherem (dart-lang)
2017/02/07 21:59:25
Done. Sorry for the confusion - the TODO was refer
 
 | 
| for (int i = 0; i < statements.length; i++) { | 
| var statement = statements[i]; | 
| if (statement is List) { | 
| @@ -505,7 +510,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| void endSend(Token token) { | 
| debugEvent("Send"); | 
| Arguments arguments = pop(); | 
| - List typeArguments = pop(); | 
| + List<DartType> typeArguments = pop(); | 
| Object receiver = pop(); | 
| if (arguments != null && typeArguments != null) { | 
| arguments.types.addAll(typeArguments); | 
| @@ -993,7 +998,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| assert(conditionStatement is EmptyStatement); | 
| } | 
| List<VariableDeclaration> variables = <VariableDeclaration>[]; | 
| - var variableOrExpression = pop(); | 
| + dynamic variableOrExpression = pop(); | 
| Statement begin; | 
| if (variableOrExpression is BuilderAccessor) { | 
| variableOrExpression = variableOrExpression.buildForEffect(); | 
| @@ -1001,7 +1006,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| if (variableOrExpression is VariableDeclaration) { | 
| variables.add(variableOrExpression); | 
| } else if (variableOrExpression is List) { | 
| - variables.addAll(variableOrExpression); | 
| + // TODO(sigmund): remove this assignment (see issue #28651) | 
| + Iterable vars = variableOrExpression; | 
| + variables.addAll(vars); | 
| } else if (variableOrExpression == null) { | 
| // Do nothing. | 
| } else if (variableOrExpression is Expression) { | 
| @@ -1161,7 +1168,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| // TODO(ahe): The scope is wrong for return types of generic functions. | 
| debugEvent("Type"); | 
| List<DartType> arguments = pop(); | 
| - var name = pop(); | 
| + dynamic name = pop(); | 
| if (name is List) { | 
| if (name.length != 2) { | 
| return internalError("Unexpected: $name.length"); | 
| @@ -1281,7 +1288,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| name.fileOffset); | 
| } | 
| if (thisKeyword == null) { | 
| - variable = builder.build(); | 
| + KernelFormalParameterBuilder formalBuilder = builder; | 
| 
 
ahe
2017/02/07 11:03:08
Remove this.
 
Siggi Cherem (dart-lang)
2017/02/07 21:59:25
Done.
 
 | 
| + variable = formalBuilder.build(); | 
| variable.initializer = name.initializer; | 
| } else if (builder.isField && builder.parent == classBuilder) { | 
| FieldBuilder field = builder; | 
| @@ -1504,7 +1512,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| Identifier suffix = popIfNotNull(periodBeforeName); | 
| Identifier identifier; | 
| List<DartType> typeArguments = pop(); | 
| - var type = pop(); | 
| + dynamic type = pop(); | 
| if (type is List) { | 
| var prefix = type[0]; | 
| identifier = type[1]; | 
| @@ -1621,7 +1629,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| debugEvent("NewExpression"); | 
| Arguments arguments = pop(); | 
| String name = pop(); | 
| - List typeArguments = pop(); | 
| + List<DartType> typeArguments = pop(); | 
| var type = pop(); | 
| if (typeArguments != null) { | 
| @@ -1630,7 +1638,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| } | 
| String errorName; | 
| - if (type is ClassBuilder) { | 
| + if (type is KernelClassBuilder) { | 
| 
 
ahe
2017/02/07 11:03:07
Change this back.
 
Siggi Cherem (dart-lang)
2017/02/07 21:59:25
Sorry, I totally meant to ask you a follow up ques
 
ahe
2017/02/08 19:59:23
I don't think it can happen currently, but I'd lik
 
Siggi Cherem (dart-lang)
2017/02/09 04:44:02
Done.
 
 | 
| Builder b = type.findConstructorOrFactory(name); | 
| Member target; | 
| if (b == null) { | 
| @@ -1743,7 +1751,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| exitLocalScope(); | 
| } | 
| FormalParameters formals = pop(); | 
| - List typeParameters = pop(); | 
| + List<TypeParameter> typeParameters = pop(); | 
| push(formals.addToFunction(new FunctionNode(body, | 
| typeParameters: typeParameters, asyncMarker: asyncModifier))); | 
| functionNestingLevel--; | 
| @@ -1769,7 +1777,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { | 
| AsyncMarker asyncModifier = pop(); | 
| exitLocalScope(); | 
| FormalParameters formals = pop(); | 
| - List typeParameters = pop(); | 
| + List<TypeParameter> typeParameters = pop(); | 
| FunctionNode function = formals.addToFunction(new FunctionNode(body, | 
| typeParameters: typeParameters, asyncMarker: asyncModifier)); | 
| push(new FunctionExpression(function)); |