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

Unified Diff: compiler/java/com/google/dart/compiler/ast/ASTNodes.java

Issue 10970024: Issue 5240. Using a non-type in a const object expression is an error, not a warning (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/Resolver.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/ast/ASTNodes.java
diff --git a/compiler/java/com/google/dart/compiler/ast/ASTNodes.java b/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
index 2fbc66036539133fc6882284c6c052aa856dae32..02f43d2eec3cc689ff1f6cc3e95f647043e1684b 100644
--- a/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
+++ b/compiler/java/com/google/dart/compiler/ast/ASTNodes.java
@@ -1362,4 +1362,25 @@ public class ASTNodes {
return false;
}
+ /**
+ * @return the {@link DartIdentifier} corresponding to the name of constructor.
+ */
+ public static DartIdentifier getConstructorNameNode(DartNewExpression node) {
+ DartNode constructor = node.getConstructor();
+ return getConstructorNameNode(constructor);
+ }
+
+ /**
+ * @return the {@link DartIdentifier} corresponding to the name of constructor.
+ */
+ private static DartIdentifier getConstructorNameNode(DartNode constructor) {
+ if (constructor instanceof DartPropertyAccess) {
+ return ((DartPropertyAccess) constructor).getName();
+ } else if (constructor instanceof DartTypeNode) {
+ return getConstructorNameNode(((DartTypeNode) constructor).getIdentifier());
+ } else {
+ return (DartIdentifier) constructor;
+ }
+ }
+
}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/Resolver.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698