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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 10910142: Issue 4988. Fixe for 'assert' statement vs function resolving (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for artificial 'assert' function name Created 8 years, 3 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/java/com/google/dart/compiler/resolver/Elements.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Elements.java b/compiler/java/com/google/dart/compiler/resolver/Elements.java
index 0e3efaf72de76c9666c6e76531e65b30187397fb..18ef336ea63978e03b75bc524726d664b510ce95 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -51,6 +51,10 @@ import java.util.Set;
* Utility and factory methods for elements.
*/
public class Elements {
+ /**
+ * Name of the artificial function used for resolution of "assert" statement.
+ */
+ public static final String ASSERT_FUNCTION_NAME = "assert__forStatement" + System.currentTimeMillis();
private static final ImmutableSet<Token> ASSIGN_OPERATORS =
Sets.immutableEnumSet(
Token.ASSIGN,
@@ -776,7 +780,7 @@ static FieldElementImplementation fieldFromNode(DartField node,
public static boolean isArtificialAssertMethod(Element element) {
if (element instanceof MethodElement) {
MethodElement methodElement = (MethodElement) element;
- return Objects.equal(methodElement.getName(), "assert")
+ return Objects.equal(methodElement.getName(), ASSERT_FUNCTION_NAME)
&& methodElement.getEnclosingElement() instanceof LibraryElement
&& methodElement.getEnclosingElement().getName().equals("dart://core/core.dart");
}

Powered by Google App Engine
This is Rietveld 408576698