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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/resolver.dart

Issue 29313003: Don't evaluate << because of possible overflow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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: pkg/analyzer_experimental/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index 33b7305592e5fb400011ace2263f97aa367f7815..0ff54abf0c4259d2f1cd1d32c52ba24e663aa90f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -12593,6 +12593,7 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
checkForDuplicateDefinitionInheritance();
checkForConflictingGetterAndMethod();
checkImplementsSuperClass(node);
+ checkImplementsFunctionWithoutCall(node);
return super.visitClassDeclaration(node);
} finally {
_isInNativeClass = false;
@@ -16195,6 +16196,32 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
}
/**
+ * This verifies that if the given class declaration implements the class Function that it has a
+ * concrete implementation of the call method.
+ *
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see StaticWarningCode#FUNCTION_WITHOUT_CALL
+ */
+ bool checkImplementsFunctionWithoutCall(ClassDeclaration node) {
+ if (node.abstractKeyword != null) {
+ return false;
+ }
+ ClassElement classElement = node.element;
+ if (classElement == null) {
+ return false;
+ }
+ if (!classElement.type.isSubtypeOf(_typeProvider.functionType)) {
+ return false;
+ }
+ ExecutableElement callMethod = _inheritanceManager.lookupMember(classElement, "call");
+ if (callMethod == null || callMethod is! MethodElement || ((callMethod as MethodElement)).isAbstract) {
+ _errorReporter.reportError2(StaticWarningCode.FUNCTION_WITHOUT_CALL, node.name, []);
+ return true;
+ }
+ return false;
+ }
+
+ /**
* This verifies that the given class declaration does not have the same class in the 'extends'
* and 'implements' clauses.
*
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/error.dart ('k') | pkg/analyzer_experimental/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698