| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 import com.google.dart.compiler.common.AbstractNode; | 7 import com.google.dart.compiler.common.AbstractNode; |
| 8 import com.google.dart.compiler.resolver.Element; | 8 import com.google.dart.compiler.resolver.Element; |
| 9 import com.google.dart.compiler.type.Type; | 9 import com.google.dart.compiler.type.Type; |
| 10 import com.google.dart.compiler.util.DefaultTextOutput; | 10 import com.google.dart.compiler.util.DefaultTextOutput; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 public void setType(Type type) { | 35 public void setType(Type type) { |
| 36 this.type = type; | 36 this.type = type; |
| 37 } | 37 } |
| 38 | 38 |
| 39 public Type getType() { | 39 public Type getType() { |
| 40 return type; | 40 return type; |
| 41 } | 41 } |
| 42 | 42 |
| 43 @Override | 43 @Override |
| 44 public final String toString() { | 44 public String toString() { |
| 45 return this.toSource(); | 45 return this.toSource(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Returns this node's parent node, or <code>null</code> if this is the | 49 * Returns this node's parent node, or <code>null</code> if this is the |
| 50 * root node. | 50 * root node. |
| 51 * <p> | 51 * <p> |
| 52 * Note that the relationship between an AST node and its parent node | 52 * Note that the relationship between an AST node and its parent node |
| 53 * may change over the lifetime of a node. | 53 * may change over the lifetime of a node. |
| 54 * | 54 * |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return super.toString(); | 110 return super.toString(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * If the given child is not <code>null</code>, use the given visitor to visit
it. | 114 * If the given child is not <code>null</code>, use the given visitor to visit
it. |
| 115 * | 115 * |
| 116 * @param child the child to be visited | 116 * @param child the child to be visited |
| 117 * @param visitor the visitor that will be used to visit the child | 117 * @param visitor the visitor that will be used to visit the child |
| 118 */ | 118 */ |
| 119 protected void safelyVisitChild(DartNode child, ASTVisitor<?> visitor) { | 119 protected void safelyVisitChild(DartNode child, ASTVisitor<?> visitor) { |
| 120 if (child != null) { | 120 // Inline the DartIdentifier path - it's by far the most common. |
| 121 if (child instanceof DartIdentifier) { |
| 122 visitor.visitIdentifier((DartIdentifier)child); |
| 123 } else if (child != null) { |
| 121 child.accept(visitor); | 124 child.accept(visitor); |
| 122 } | 125 } |
| 123 } | 126 } |
| 124 | 127 |
| 125 } | 128 } |
| OLD | NEW |