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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 12593009: Don't cast to NodeElement where not needed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file. Created 7 years, 9 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/type/TypeAnalyzer.java
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
index 15ee2bb2ef7b8ade391dc61c1491f9dcdf414227..9debd56d30c003c36c2429b56288415ef81117b2 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -118,7 +118,6 @@ import com.google.dart.compiler.resolver.Elements;
import com.google.dart.compiler.resolver.FieldElement;
import com.google.dart.compiler.resolver.FunctionAliasElement;
import com.google.dart.compiler.resolver.MethodElement;
-import com.google.dart.compiler.resolver.NodeElement;
import com.google.dart.compiler.resolver.ResolverErrorCode;
import com.google.dart.compiler.resolver.TypeErrorCode;
import com.google.dart.compiler.resolver.VariableElement;
@@ -1787,7 +1786,7 @@ public class TypeAnalyzer implements DartCompilationPhase {
} else {
variableType = typeOf(node.getIdentifier());
// in most cases variable, but sometimes field
- NodeElement identifierElement = node.getIdentifier().getElement();
+ Element identifierElement = node.getIdentifier().getElement();
if (identifierElement instanceof VariableElement) {
variableElement = (VariableElement) identifierElement;
}
@@ -2780,7 +2779,7 @@ public class TypeAnalyzer implements DartCompilationPhase {
* Report warning if given {@link Element} is deprecated.
*/
private void checkDeprecated(HasSourceInfo nameNode, Element element) {
- if (element != null && element.getMetadata().isDeprecated()) {
+ if (element != null && element.getMetadata() != null && element.getMetadata().isDeprecated()) {
onError(nameNode, TypeErrorCode.DEPRECATED_ELEMENT,
Elements.getDeprecatedElementTitle(element));
}

Powered by Google App Engine
This is Rietveld 408576698