Index: lib/compiler/implementation/ssa/builder.dart |
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart |
index d48f76ee959121bff3828e1f9aab731273648cab..aee9c5e9662cb38e64a894ffbcd1167a4e791919 100644 |
--- a/lib/compiler/implementation/ssa/builder.dart |
+++ b/lib/compiler/implementation/ssa/builder.dart |
@@ -3424,7 +3424,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
visitForIn(ForIn node) { |
// Generate a structure equivalent to: |
// Iterator<E> $iter = <iterable>.iterator() |
- // while ($iter.hasNext()) { |
+ // while ($iter.hasNext) { |
// E <declaredIdentifier> = $iter.next(); |
// <body> |
// } |
@@ -3441,8 +3441,13 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
} |
HInstruction buildCondition() { |
SourceString name = const SourceString('hasNext'); |
- Selector call = new Selector.call(name, work.element.getLibrary(), 0); |
- push(new HInvokeDynamicMethod(call, <HInstruction>[iterator])); |
+ Selector selector = new Selector.getter(name, work.element.getLibrary()); |
+ if (interceptors.getStaticGetInterceptor(name) != null) { |
+ compiler.internalError("hasNext getter must not be intercepted", |
+ node: node); |
+ } |
+ bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector); |
+ push(new HInvokeDynamicGetter(selector, null, iterator, !hasGetter)); |
return popBoolified(); |
} |
void buildBody() { |
@@ -3677,7 +3682,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
Element getFallThroughErrorElement = |
compiler.findHelper(const SourceString("getFallThroughError")); |
Iterator<Node> caseIterator = node.cases.iterator(); |
- while (caseIterator.hasNext()) { |
+ while (caseIterator.hasNext) { |
SwitchCase switchCase = caseIterator.next(); |
List<Constant> caseConstants = <Constant>[]; |
HBasicBlock block = graph.addNewBlock(); |
@@ -3702,7 +3707,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
open(block); |
localsHandler = new LocalsHandler.from(savedLocals); |
visit(switchCase.statements); |
- if (!isAborted() && caseIterator.hasNext()) { |
+ if (!isAborted() && caseIterator.hasNext) { |
pushInvokeHelper0(getFallThroughErrorElement); |
HInstruction error = pop(); |
close(new HThrow(error)); |