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

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: Fail gracefully on missing default constructors when evaluating constant 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 | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')
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 11d56c963208cbab4ea692f841cc3e200f90de45..ea9d6654a952a323b50ba36e38e02561aeedfb3b 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -1021,19 +1021,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 | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698