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

Side by Side Diff: dart/lib/compiler/implementation/ssa/nodes.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 interface HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBitAnd(HBitAnd node); 7 R visitBitAnd(HBitAnd node);
8 R visitBitNot(HBitNot node); 8 R visitBitNot(HBitNot node);
9 R visitBitOr(HBitOr node); 9 R visitBitOr(HBitOr node);
10 R visitBitXor(HBitXor node); 10 R visitBitXor(HBitXor node);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 170 }
171 171
172 HConstant addConstantInt(int i) { 172 HConstant addConstantInt(int i) {
173 return addConstant(new IntConstant(i)); 173 return addConstant(new IntConstant(i));
174 } 174 }
175 175
176 HConstant addConstantDouble(double d) { 176 HConstant addConstantDouble(double d) {
177 return addConstant(new DoubleConstant(d)); 177 return addConstant(new DoubleConstant(d));
178 } 178 }
179 179
180 HConstant addConstantString(DartString str) { 180 HConstant addConstantString(DartString str, Node node) {
181 return addConstant(new StringConstant(str)); 181 return addConstant(new StringConstant(str, node));
182 } 182 }
183 183
184 HConstant addConstantBool(bool value) { 184 HConstant addConstantBool(bool value) {
185 return addConstant(new BoolConstant(value)); 185 return addConstant(new BoolConstant(value));
186 } 186 }
187 187
188 HConstant addConstantNull() { 188 HConstant addConstantNull() {
189 return addConstant(new NullConstant()); 189 return addConstant(new NullConstant());
190 } 190 }
191 191
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 HBasicBlock get start() => body.start; 2359 HBasicBlock get start() => body.start;
2360 HBasicBlock get end() => body.end; 2360 HBasicBlock get end() => body.end;
2361 2361
2362 bool accept(HStatementInformationVisitor visitor) => 2362 bool accept(HStatementInformationVisitor visitor) =>
2363 visitor.visitLabeledBlockInfo(this); 2363 visitor.visitLabeledBlockInfo(this);
2364 } 2364 }
2365 2365
2366 class LoopTypeVisitor extends AbstractVisitor { 2366 class LoopTypeVisitor extends AbstractVisitor {
2367 const LoopTypeVisitor(); 2367 const LoopTypeVisitor();
2368 int visitNode(Node node) { 2368 int visitNode(Node node) {
2369 unreachable(); 2369 // TODO(lrn): Need a compiler object here.
2370 compiler.internalError('visitNode should not be called', node: node);
2370 } 2371 }
2371 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; 2372 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP;
2372 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; 2373 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP;
2373 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 2374 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
2374 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 2375 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
2375 } 2376 }
2376 2377
2377 class HLoopBlockInformation implements HStatementInformation { 2378 class HLoopBlockInformation implements HStatementInformation {
2378 static final int WHILE_LOOP = 0; 2379 static final int WHILE_LOOP = 0;
2379 static final int FOR_LOOP = 1; 2380 static final int FOR_LOOP = 1;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 final HExpressionInformation left; 2441 final HExpressionInformation left;
2441 final HExpressionInformation right; 2442 final HExpressionInformation right;
2442 HAndOrBlockInformation(this.isAnd, 2443 HAndOrBlockInformation(this.isAnd,
2443 this.left, 2444 this.left,
2444 this.right); 2445 this.right);
2445 2446
2446 HBasicBlock get start() => left.start; 2447 HBasicBlock get start() => left.start;
2447 HBasicBlock get end() => right.end; 2448 HBasicBlock get end() => right.end;
2448 2449
2449 // We don't currently use HAndOrBlockInformation. 2450 // We don't currently use HAndOrBlockInformation.
2450 HInstruction get conditionExpression() { unreachable(); } 2451 HInstruction get conditionExpression() {
2452 // TODO(lrn): Need a compiler object.
2453 compiler.internalError('conditionExpression should not be called',
2454 instruction: this);
2455 }
2451 bool accept(HExpressionInformationVisitor visitor) => 2456 bool accept(HExpressionInformationVisitor visitor) =>
2452 visitor.visitAndOrInfo(this); 2457 visitor.visitAndOrInfo(this);
2453 } 2458 }
2454 2459
2455 class HTryBlockInformation implements HStatementInformation { 2460 class HTryBlockInformation implements HStatementInformation {
2456 final HStatementInformation body; 2461 final HStatementInformation body;
2457 final HParameterValue catchVariable; 2462 final HParameterValue catchVariable;
2458 final HStatementInformation catchBlock; 2463 final HStatementInformation catchBlock;
2459 final HStatementInformation finallyBlock; 2464 final HStatementInformation finallyBlock;
2460 HTryBlockInformation(this.body, 2465 HTryBlockInformation(this.body,
2461 this.catchVariable, 2466 this.catchVariable,
2462 this.catchBlock, 2467 this.catchBlock,
2463 this.finallyBlock); 2468 this.finallyBlock);
2464 2469
2465 HBasicBlock get start() => body.start; 2470 HBasicBlock get start() => body.start;
2466 HBasicBlock get end() => 2471 HBasicBlock get end() =>
2467 finallyBlock === null ? catchBlock.end : finallyBlock.end; 2472 finallyBlock === null ? catchBlock.end : finallyBlock.end;
2468 2473
2469 bool accept(HStatementInformationVisitor visitor) => 2474 bool accept(HStatementInformationVisitor visitor) =>
2470 visitor.visitTryInfo(this); 2475 visitor.visitTryInfo(this);
2471 } 2476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698