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

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 812523002: Change signature of lookupConstructor to only require a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: return null for unresolved default constructors Created 5 years, 11 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 | « pkg/analyzer2dart/lib/src/modely.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compile_time_constants.dart
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 271ff8da1f47b25e9845f9f29f518e3dbfed3d47..84f412cd1531b45d7f19dd3f0c175d47042e5b1a 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -1043,19 +1043,17 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
assert(superClass != null);
assert(superClass.resolutionState == STATE_DONE);
- Selector selector =
- new Selector.callDefaultConstructor(enclosingClass.library);
-
FunctionElement targetConstructor =
- superClass.lookupConstructor(selector);
- if (targetConstructor == null) {
- compiler.internalError(functionNode,
- "No default constructor available.");
+ superClass.lookupDefaultConstructor();
+ // If we do not find a default constructor, an error was reported
+ // already and compilation will fail anyway. So just ignore that case.
+ if (targetConstructor != null) {
+ Selector selector =
+ new Selector.callDefaultConstructor(enclosingClass.library);
+ List<AstConstant> compiledArguments = evaluateArgumentsToConstructor(
+ functionNode, selector, const Link<Node>(), targetConstructor);
+ evaluateSuperOrRedirectSend(compiledArguments, targetConstructor);
}
- List<AstConstant> compiledArguments =
- evaluateArgumentsToConstructor(
- functionNode, selector, const Link<Node>(), targetConstructor);
- evaluateSuperOrRedirectSend(compiledArguments, targetConstructor);
}
}
}
« no previous file with comments | « pkg/analyzer2dart/lib/src/modely.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698