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

Unified Diff: dart/pkg/compiler/lib/src/ssa/builder.dart

Issue 828413004: Don’t exit prematurely if compilation failed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r42904. 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 | « dart/pkg/compiler/lib/src/resolution/members.dart ('k') | dart/pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/ssa/builder.dart
diff --git a/dart/pkg/compiler/lib/src/ssa/builder.dart b/dart/pkg/compiler/lib/src/ssa/builder.dart
index f2ac807661c3f5a88f53516ba7ca35637624a88d..3e7d7f8f7dea348fc4c7505706593f56549e1c97 100644
--- a/dart/pkg/compiler/lib/src/ssa/builder.dart
+++ b/dart/pkg/compiler/lib/src/ssa/builder.dart
@@ -1218,6 +1218,9 @@ class SsaBuilder extends ResolvedVisitor {
// Ensure that [element] is an implementation element.
element = element.implementation;
+
+ if (compiler.elementHasCompileTimeError(element)) return false;
+
FunctionElement function = element;
bool insideLoop = loopNesting > 0 || graph.calledInLoop;
@@ -1840,6 +1843,9 @@ class SsaBuilder extends ResolvedVisitor {
handleConstantForOptionalParameter,
compiler.world);
if (!match) {
+ if (compiler.elementHasCompileTimeError(constructor)) {
+ return;
+ }
// If this fails, the selector we constructed for the call to a
// forwarding constructor in a mixin application did not match the
// constructor (which, for example, may happen when the libraries are
@@ -1935,6 +1941,7 @@ class SsaBuilder extends ResolvedVisitor {
assert(invariant(classElement, classElement.isImplementation));
classElement.forEachInstanceField(
(ClassElement enclosingClass, VariableElement member) {
+ if (compiler.elementHasCompileTimeError(member)) return;
compiler.withCurrentElement(member, () {
TreeElements definitions = member.treeElements;
ast.Node node = member.node;
@@ -3209,10 +3216,17 @@ class SsaBuilder extends ResolvedVisitor {
// TODO(ahe): This should be registered in codegen.
registry.registerGetOfStaticFunction(element.declaration);
} else if (Elements.isErroneousElement(element)) {
- // An erroneous element indicates an unresolved static getter.
- generateThrowNoSuchMethod(send,
- noSuchMethodTargetSymbolString(element, 'get'),
- argumentNodes: const Link<ast.Node>());
+ if (element is ErroneousElement) {
+ // An erroneous element indicates an unresolved static getter.
+ generateThrowNoSuchMethod(
+ send,
+ noSuchMethodTargetSymbolString(element, 'get'),
+ argumentNodes: const Link<ast.Node>());
+ } else {
+ // TODO(ahe): Do something like the above, that is, emit a runtime
+ // error.
+ stack.add(graph.addConstantNull(compiler));
+ }
} else {
LocalElement local = element;
stack.add(localsHandler.readLocal(local));
@@ -4287,6 +4301,11 @@ class SsaBuilder extends ResolvedVisitor {
constructorDeclaration.computeEffectiveTargetType(type);
expectedType = localsHandler.substInContext(expectedType);
+ if (compiler.elementHasCompileTimeError(constructor)) {
+ // TODO(ahe): Do something like [generateWrongArgumentCountError].
+ stack.add(graph.addConstantNull(compiler));
+ return;
+ }
if (checkTypeVariableBounds(node, type)) return;
var inputs = <HInstruction>[];
@@ -4654,6 +4673,11 @@ class SsaBuilder extends ResolvedVisitor {
element = function.effectiveTarget;
}
if (Elements.isErroneousElement(element)) {
+ if (element is !ErroneousElement) {
+ // TODO(ahe): Do something like [generateWrongArgumentCountError].
+ stack.add(graph.addConstantNull(compiler));
+ return;
+ }
ErroneousElement error = element;
if (error.messageKind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
generateThrowNoSuchMethod(
« no previous file with comments | « dart/pkg/compiler/lib/src/resolution/members.dart ('k') | dart/pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698