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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java

Issue 22871003: Issue 11892. It is compile-time error when unqualified invocation with unresolved identifier. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
index 18d302cb60906dbd1293649854c2a82451fcf3d3..ef15530fd595c5e7d03a8f9fb3cc2063f9a90d3d 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ElementResolver.java
@@ -818,9 +818,9 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
methodName,
methodName.getName());
- } else if (errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION) {
+ } else if (errorCode == CompileTimeErrorCode.UNDEFINED_FUNCTION) {
resolver.reportError(
- StaticTypeWarningCode.UNDEFINED_FUNCTION,
+ CompileTimeErrorCode.UNDEFINED_FUNCTION,
methodName,
methodName.getName());
} else if (errorCode == StaticTypeWarningCode.UNDEFINED_METHOD) {
@@ -1166,6 +1166,10 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
* @return the error code that should be reported
*/
private ErrorCode checkForInvocationError(Expression target, Element element) {
+ // Prefix is not declared, instead "prefix.id" are declared.
+ if (element instanceof PrefixElement) {
+ element = null;
+ }
if (element instanceof PropertyAccessorElement) {
//
// This is really a function expression invocation.
@@ -1207,17 +1211,19 @@ public class ElementResolver extends SimpleASTVisitor<Void> {
} else {
if (target == null) {
ClassElement enclosingClass = resolver.getEnclosingClass();
- if (enclosingClass == null) {
- return StaticTypeWarningCode.UNDEFINED_FUNCTION;
- } else if (element == null) {
- return StaticTypeWarningCode.UNDEFINED_METHOD;
+ if (element == null) {
+ if (enclosingClass == null) {
+ return CompileTimeErrorCode.UNDEFINED_FUNCTION;
+ } else {
+ return StaticTypeWarningCode.UNDEFINED_METHOD;
+ }
} else {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
} else {
Type targetType = getStaticType(target);
if (targetType == null) {
- return StaticTypeWarningCode.UNDEFINED_FUNCTION;
+ return CompileTimeErrorCode.UNDEFINED_FUNCTION;
} else if (!targetType.isDynamic()) {
return StaticTypeWarningCode.UNDEFINED_METHOD;
}

Powered by Google App Engine
This is Rietveld 408576698