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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java

Issue 10537043: Issue 3308. Support for operator equals (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
index b04a4f277380f2fc59dbd4e2bd0089ff50181f61..28801df0f94b703cf43be2422658cc2131fc793e 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
@@ -5,6 +5,7 @@ package com.google.dart.compiler.parser;
import com.google.common.base.Joiner;
import com.google.dart.compiler.CompilerTestCase;
+import com.google.dart.compiler.ast.DartClass;
import com.google.dart.compiler.ast.DartIdentifier;
import com.google.dart.compiler.ast.DartMethodDefinition;
import com.google.dart.compiler.ast.DartNode;
@@ -698,6 +699,21 @@ public class NegativeParserTest extends CompilerTestCase {
"}",
""));
}
+
+ /**
+ * We can parse operator "equals" declaration.
+ */
+ public void test_operator_equals() {
+ DartParserRunner runner = parseExpectErrors(Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " operator equals(other) => false;",
+ "}",
+ ""));
+ DartClass clazz = (DartClass) runner.getDartUnit().getTopLevelNodes().get(0);
+ DartMethodDefinition method = (DartMethodDefinition) clazz.getMembers().get(0);
+ assertTrue(method.getModifiers().isOperator());
+ }
/**
* "native" can be specified only for classes.

Powered by Google App Engine
This is Rietveld 408576698