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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1518473002: dart2js: Fix an issue with erroneous for-in. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix a silly typo in the comment. Created 5 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | tests/co19/co19-dart2js.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index b75af81fce4bebb5d4c059eaf1d3e8e793d35b6b..a80f2f73d0b964c72671e2f6a9ac80db11d1bac3 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -702,6 +702,19 @@ class IrBuilder {
target, selector, mask, arguments, sourceInformation);
}
+ ir.Primitive buildStaticNoSuchMethod(Selector selector,
+ List<ir.Primitive> arguments) {
+ Element thrower = program.throwNoSuchMethod;
+ ir.Primitive receiver = buildStringConstant('');
+ ir.Primitive name = buildStringConstant(selector.name);
+ ir.Primitive argumentList = buildListLiteral(null, arguments);
+ ir.Primitive expectedArgumentNames = buildNullConstant();
+ return buildStaticFunctionInvocation(
+ thrower,
+ new CallStructure.unnamed(4),
+ [receiver, name, argumentList, expectedArgumentNames]);
+ }
+
/// Create a [ir.Constant] from [value] and add it to the CPS term.
ir.Constant buildConstant(ConstantValue value,
@@ -1433,11 +1446,18 @@ class IrBuilder {
// TODO(johnniwinther): Extract this as a provided strategy.
if (Elements.isLocal(variableElement)) {
bodyBuilder.buildLocalVariableSet(variableElement, currentValue);
- } else if (Elements.isMalformed(variableElement)) {
- bodyBuilder.buildErroneousInvocation(variableElement,
- new Selector.setter(
- new Name(variableElement.name, variableElement.library)),
- <ir.Primitive>[currentValue]);
+ } else if (Elements.isError(variableElement) ||
+ Elements.isMalformed(variableElement)) {
+ Selector selector = new Selector.setter(
+ new Name(variableElement.name, variableElement.library));
+ List<ir.Primitive> value = <ir.Primitive>[currentValue];
+ // Note the order of the comparisons below. It can be the case that an
+ // element isError and isMalformed.
+ if (Elements.isError(variableElement)) {
+ bodyBuilder.buildStaticNoSuchMethod(selector, value);
+ } else {
+ bodyBuilder.buildErroneousInvocation(variableElement, selector, value);
+ }
} else if (Elements.isStaticOrTopLevel(variableElement)) {
if (variableElement.isField) {
bodyBuilder.buildStaticFieldSet(variableElement, currentValue);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | tests/co19/co19-dart2js.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698