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

Side by Side Diff: dart/frog/leg/tree/nodes.dart

Issue 9646030: Find diagnostic locations for use in new compiler API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 8 years, 9 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
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/tests/leg/src/mock_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 Visitor<R> { 5 interface Visitor<R> {
6 R visitBlock(Block node); 6 R visitBlock(Block node);
7 R visitBreakStatement(BreakStatement node); 7 R visitBreakStatement(BreakStatement node);
8 R visitCatchBlock(CatchBlock node); 8 R visitCatchBlock(CatchBlock node);
9 R visitClassNode(ClassNode node); 9 R visitClassNode(ClassNode node);
10 R visitConditional(Conditional node); 10 R visitConditional(Conditional node);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (isPrefix && !isIndex) return selector.getBeginToken(); 255 if (isPrefix && !isIndex) return selector.getBeginToken();
256 return firstBeginToken(receiver, selector); 256 return firstBeginToken(receiver, selector);
257 } 257 }
258 258
259 Token getEndToken() { 259 Token getEndToken() {
260 if (isPrefix) { 260 if (isPrefix) {
261 if (receiver !== null) return receiver.getEndToken(); 261 if (receiver !== null) return receiver.getEndToken();
262 if (selector !== null) return selector.getEndToken(); 262 if (selector !== null) return selector.getEndToken();
263 return null; 263 return null;
264 } 264 }
265 if (argumentsNode !== null) return argumentsNode.getEndToken(); 265 if (!isPostfix && argumentsNode !== null) {
266 return argumentsNode.getEndToken();
267 }
266 if (selector !== null) return selector.getEndToken(); 268 if (selector !== null) return selector.getEndToken();
267 return receiver.getBeginToken(); 269 return receiver.getBeginToken();
268 } 270 }
269 271
270 Send copyWithReceiver(Node newReceiver) { 272 Send copyWithReceiver(Node newReceiver) {
271 assert(receiver === null); 273 assert(receiver === null);
272 return new Send(newReceiver, selector, argumentsNode); 274 return new Send(newReceiver, selector, argumentsNode);
273 } 275 }
274 } 276 }
275 277
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 } 573 }
572 574
573 Token getBeginToken() { 575 Token getBeginToken() {
574 Token token = firstBeginToken(modifiers, returnType); 576 Token token = firstBeginToken(modifiers, returnType);
575 if (token !== null) return token; 577 if (token !== null) return token;
576 if (getOrSet !== null) return getOrSet; 578 if (getOrSet !== null) return getOrSet;
577 return firstBeginToken(name, parameters); 579 return firstBeginToken(name, parameters);
578 } 580 }
579 581
580 Token getEndToken() { 582 Token getEndToken() {
581 return (body === null) ? parameters.getEndToken() : body.getEndToken(); 583 Token token = (body === null) ? null : body.getEndToken();
584 token = (token === null) ? parameters.getEndToken() : token;
585 return (token === null) ? name.getEndToken() : token;
582 } 586 }
583 } 587 }
584 588
585 typedef void DecodeErrorHandler(Token token, var error); 589 typedef void DecodeErrorHandler(Token token, var error);
586 590
587 class Literal<T> extends Expression { 591 class Literal<T> extends Expression {
588 final Token token; 592 final Token token;
589 final DecodeErrorHandler handler; 593 final DecodeErrorHandler handler;
590 594
591 Literal(Token this.token, DecodeErrorHandler this.handler); 595 Literal(Token this.token, DecodeErrorHandler this.handler);
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 visitChildren(Visitor visitor) { 1645 visitChildren(Visitor visitor) {
1642 tryBlock.accept(visitor); 1646 tryBlock.accept(visitor);
1643 catchBlocks.accept(visitor); 1647 catchBlocks.accept(visitor);
1644 if (finallyBlock !== null) finallyBlock.accept(visitor); 1648 if (finallyBlock !== null) finallyBlock.accept(visitor);
1645 } 1649 }
1646 1650
1647 Token getBeginToken() => tryKeyword; 1651 Token getBeginToken() => tryKeyword;
1648 1652
1649 Token getEndToken() { 1653 Token getEndToken() {
1650 if (finallyBlock !== null) return finallyBlock.getEndToken(); 1654 if (finallyBlock !== null) return finallyBlock.getEndToken();
1651 return catchBlocks.getEndToken(); 1655 if (!catchBlocks.isEmpty()) return catchBlocks.getEndToken();
1656 return tryBlock.getEndToken();
1652 } 1657 }
1653 } 1658 }
1654 1659
1655 class CatchBlock extends Node { 1660 class CatchBlock extends Node {
1656 final NodeList formals; 1661 final NodeList formals;
1657 final Block block; 1662 final Block block;
1658 1663
1659 final catchKeyword; 1664 final catchKeyword;
1660 1665
1661 CatchBlock(this.formals, this.block, this.catchKeyword); 1666 CatchBlock(this.formals, this.block, this.catchKeyword);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 static bool isConstructorRedirect(Send node) { 1707 static bool isConstructorRedirect(Send node) {
1703 return (node.receiver === null && 1708 return (node.receiver === null &&
1704 node.selector.asIdentifier() !== null && 1709 node.selector.asIdentifier() !== null &&
1705 node.selector.asIdentifier().isThis()) || 1710 node.selector.asIdentifier().isThis()) ||
1706 (node.receiver !== null && 1711 (node.receiver !== null &&
1707 node.receiver.asIdentifier() !== null && 1712 node.receiver.asIdentifier() !== null &&
1708 node.receiver.asIdentifier().isThis() && 1713 node.receiver.asIdentifier().isThis() &&
1709 node.selector.asIdentifier() !== null); 1714 node.selector.asIdentifier() !== null);
1710 } 1715 }
1711 } 1716 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/tests/leg/src/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698