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

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: Remove unused variable. 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
« no previous file with comments | « lib/compiler/implementation/scanner/token.dart ('k') | lib/compiler/implementation/string_validator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « lib/compiler/implementation/scanner/token.dart ('k') | lib/compiler/implementation/string_validator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698