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

Unified Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10826045: Substitution handled for most Send nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/ssa/ssa.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree/nodes.dart
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index 1e356539a9434db3c0ed19a13c0affec3fb8bd34..f9221992684a4cc7c0982c2c1cef82edf0825849 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -385,6 +385,25 @@ class NewExpression extends Expression {
Token getBeginToken() => newToken;
Token getEndToken() => send.getEndToken();
+
+ /**
+ * Returns the type annotation of this new expression. The type annotation
+ * is either the `send.selector` for invocations of unnamed constructors like
+ * `new Class()`, or `send.selector.receiver` for named constructors like
+ * `new Class.named()`.
+ */
+ TypeAnnotation getTypeAnnotation() {
+ if (send.selector.asTypeAnnotation() !== null) {
+ return send.selector;
+ } else if (send.selector.asSend() !== null) {
+ Send selector = send.selector;
+ if (selector.receiver.asTypeAnnotation() !== null) {
+ return selector.receiver;
+ }
+ } else {
+ return null;
+ }
+ }
}
class NodeList extends Node implements Iterable<Node> {
« no previous file with comments | « lib/compiler/implementation/ssa/ssa.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698