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

Unified Diff: dart/lib/compiler/implementation/ssa/builder.dart

Issue 10389143: Add locations to diagnostics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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/lib/compiler/implementation/resolver.dart ('k') | dart/lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/ssa/builder.dart
diff --git a/dart/lib/compiler/implementation/ssa/builder.dart b/dart/lib/compiler/implementation/ssa/builder.dart
index ad243f84150b76a2654e8ed312d7c4a66606f8f8..9ecfff1553e2f43531354dfa04c2b2cf5af78924 100644
--- a/dart/lib/compiler/implementation/ssa/builder.dart
+++ b/dart/lib/compiler/implementation/ssa/builder.dart
@@ -677,8 +677,19 @@ interface JumpHandler default JumpHandlerImpl {
// handler associated with it.
class NullJumpHandler implements JumpHandler {
const NullJumpHandler();
- void generateBreak([LabelElement label]) { unreachable(); }
- void generateContinue([LabelElement label]) { unreachable(); }
+
+ void generateBreak([LabelElement label]) {
+ // TODO(lrn): Report a proper diagnostic, needed: compiler (for
+ // reporting) and a position.
+ unreachable();
kasperl 2012/05/15 12:09:16 Didn't you remove unreachable()?
ahe 2012/05/15 12:28:04 I did. I have have uploaded a change.
+ }
+
+ void generateContinue([LabelElement label]) {
+ // TODO(lrn): Report a proper diagnostic, needed: compiler (for
+ // reporting) and a position.
+ unreachable();
+ }
+
void forEachBreak(Function ignored) { }
void forEachContinue(Function ignored) { }
void close() { }
@@ -1150,7 +1161,7 @@ class SsaBuilder implements Visitor {
}
visitClassNode(ClassNode node) {
- unreachable();
+ compiler.internalError('visitClassNode should not be called', node: node);
}
visitExpressionStatement(ExpressionStatement node) {
@@ -1660,10 +1671,13 @@ class SsaBuilder implements Visitor {
new HStatic(interceptors.getPrefixOperatorInterceptor(op));
add(target);
HInvokeUnary result;
- switch (op.source.stringValue) {
+ String value = op.source.stringValue;
+ switch (value) {
case "-": result = new HNegate(target, operand); break;
case "~": result = new HBitNot(target, operand); break;
- default: unreachable();
+ default:
+ compiler.internalError('Unexpected unary operator: $value.', node: op);
+ break;
}
// See if we can constant-fold right away. This avoids rewrites later on.
if (operand is HConstant) {
@@ -2248,7 +2262,7 @@ class SsaBuilder implements Visitor {
var inputs = <HInstruction>[
target,
self,
- graph.addConstantString(new DartString.literal(name)),
+ graph.addConstantString(new DartString.literal(name), node),
pop()];
push(new HInvokeSuper(Selector.INVOCATION_2, inputs));
return;
@@ -2538,20 +2552,20 @@ class SsaBuilder implements Visitor {
}
void visitLiteralString(LiteralString node) {
- stack.add(graph.addConstantString(node.dartString));
+ stack.add(graph.addConstantString(node.dartString, node));
}
void visitStringJuxtaposition(StringJuxtaposition node) {
if (!node.isInterpolation) {
// This is a simple string with no interpolations.
- stack.add(graph.addConstantString(node.dartString));
+ stack.add(graph.addConstantString(node.dartString, node));
return;
}
int offset = node.getBeginToken().charOffset;
StringBuilderVisitor stringBuilder =
new StringBuilderVisitor(this, offset);
stringBuilder.visit(node);
- stack.add(stringBuilder.result());
+ stack.add(stringBuilder.result(node));
}
void visitLiteralNull(LiteralNull node) {
@@ -2574,7 +2588,7 @@ class SsaBuilder implements Visitor {
visitOperator(Operator node) {
// Operators are intercepted in their surrounding Send nodes.
- unreachable();
+ compiler.internalError('visitOperator should not be called', node: node);
}
visitCascade(Cascade node) {
@@ -2705,12 +2719,13 @@ class SsaBuilder implements Visitor {
StringBuilderVisitor stringBuilder =
new StringBuilderVisitor(this, offset);
stringBuilder.visit(node);
- stack.add(stringBuilder.result());
+ stack.add(stringBuilder.result(node));
}
visitStringInterpolationPart(StringInterpolationPart node) {
// The parts are iterated in visitStringInterpolation.
- unreachable();
+ compiler.internalError('visitStringInterpolation should not be called',
+ node: node);
}
visitEmptyStatement(EmptyStatement node) {
@@ -3170,20 +3185,6 @@ class SsaBuilder implements Visitor {
compiler.internalError('SsaBuilder.visitTypeVariable');
}
- generateUnimplemented(String reason, [bool isExpression = false]) {
- DartString string = new DartString.literal(reason);
- HInstruction message = graph.addConstantString(string);
-
- // Normally, we would call [close] here. However, then we hit
- // another unimplemented feature: aborting loop body. Simply
- // calling [add] does not work as it asserts that the instruction
- // isn't a control flow instruction. So we inline parts of [add].
- current.addAfter(current.last, new HThrow(message));
- if (isExpression) {
- stack.add(graph.addConstantNull());
- }
- }
-
/** HACK HACK HACK */
void hackAroundPossiblyAbortingBody(Node statement, void body()) {
visitCondition() {
@@ -3243,7 +3244,7 @@ class StringBuilderVisitor extends AbstractVisitor {
}
void visitExpression(Node node) {
- flushLiterals();
+ flushLiterals(node);
node.accept(builder);
HInstruction asString = buildToString(node, builder.pop());
prefix = buildConcat(prefix, asString);
@@ -3298,14 +3299,15 @@ class StringBuilderVisitor extends AbstractVisitor {
* Combine the strings in [literalAccumulator] into the prefix instruction.
* After this, the [literalAccumulator] is empty and [prefix] is non-null.
*/
- void flushLiterals() {
+ void flushLiterals(Node node) {
if (literalAccumulator.isEmpty()) {
if (prefix === null) {
- prefix = builder.graph.addConstantString(literalAccumulator);
+ prefix = builder.graph.addConstantString(literalAccumulator, node);
}
return;
}
- HInstruction string = builder.graph.addConstantString(literalAccumulator);
+ HInstruction string =
+ builder.graph.addConstantString(literalAccumulator, node);
literalAccumulator = new DartString.empty();
if (prefix !== null) {
prefix = buildConcat(prefix, string);
@@ -3330,8 +3332,8 @@ class StringBuilderVisitor extends AbstractVisitor {
return builder.pop();
}
- HInstruction result() {
- flushLiterals();
+ HInstruction result(Node node) {
+ flushLiterals(node);
return prefix;
}
}
« no previous file with comments | « dart/lib/compiler/implementation/resolver.dart ('k') | dart/lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698