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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index f9941b951a3fbfa93e048bd4cd59c53fbc14b421..86cfa777b57b7ae39e48821b49def79c8db2f5c8 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -3412,7 +3412,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>
// }
@@ -3429,8 +3429,14 @@ 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());
+ Element staticInterceptor = null;
Lasse Reichstein Nielsen 2012/10/20 11:22:42 I this variable used?
floitsch 2012/10/24 13:02:47 Done.
+ 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() {
@@ -3665,7 +3671,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();
@@ -3690,7 +3696,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));

Powered by Google App Engine
This is Rietveld 408576698