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

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

Issue 10854220: Set type for variables and type nodes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.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/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 01346f814736cc8f4c689357132b1949cfa23083..ab27fe713a99a239de8703e82f72feb7b435d5f5 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -1188,13 +1188,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
* @return a non-null type
*/
private Type nonVoidTypeOf(DartNode node) {
- if (node != null) {
- ElementKind kind = ElementKind.of(node.getElement());
- if (kind == ElementKind.CLASS || kind == ElementKind.FUNCTION_TYPE_ALIAS || kind == ElementKind.TYPE_VARIABLE) {
- // We have already created an error in this case.
- return dynamicType;
- }
- }
Type type = typeOf(node);
return checkNonVoid(node, type);
}
@@ -1291,16 +1284,17 @@ public class TypeAnalyzer implements DartCompilationPhase {
if (node.getFunctionName().isResolutionAlreadyReportedThatTheMethodCouldNotBeFound()) {
return dynamicType;
}
+ DartNode target = node.getTarget();
DartIdentifier nameNode = node.getFunctionName();
String name = node.getFunctionNameString();
Element element = node.getElement();
if (element != null && (element.getModifiers().isStatic()
|| Elements.isTopLevel(element))) {
+ typeOf(target);
node.setElement(element);
checkDeprecated(nameNode, element);
return checkInvocation(node, nameNode, name, element.getType());
}
- DartNode target = node.getTarget();
Type receiver = nonVoidTypeOf(target);
Member member = lookupMember(receiver, name, nameNode);
if (member != null) {
@@ -1641,6 +1635,9 @@ public class TypeAnalyzer implements DartCompilationPhase {
break;
+ case CLASS:
+ return element.getType();
+
case FIELD:
type = typeAsMemberOf(element, currentClass);
// try to resolve as getter/setter
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698