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

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

Issue 10516006: Issue 3268. Support for replacing 'assert' statement with 'assert' function (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes for review comments 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/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 7325b798ef5a4758ac8ad5b36c8c21a4c180d192..b2ff6f9a5a61bc41dc346a400638dfbe940f69f0 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Elements.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Elements.java
@@ -640,4 +640,19 @@ static FieldElementImplementation fieldFromNode(DartField node,
}
return false;
}
+
+ /**
+ * @return <code>true</code> if given {@link Element} if {@link MethodElement} for artificial
+ * "assert" statement.
+ */
+ public static boolean isArtificialAssertMethod(Element element) {
+ if (element instanceof MethodElement) {
+ MethodElement methodElement = (MethodElement) element;
+ return Objects.equal(methodElement.getName(), "assert")
+ && methodElement.getEnclosingElement() instanceof LibraryElement
+ && methodElement.getEnclosingElement().getName().equals("dart://core/core_runtime.dart");
+ }
+ return false;
+ }
+
}

Powered by Google App Engine
This is Rietveld 408576698