| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 abstract class Visitor<R> { | 5 abstract class Visitor<R> { |
| 6 const Visitor(); | 6 const Visitor(); |
| 7 | 7 |
| 8 abstract R visitNode(Node node); | 8 abstract R visitNode(Node node); |
| 9 | 9 |
| 10 R visitBlock(Block node) => visitStatement(node); | 10 R visitBlock(Block node) => visitStatement(node); |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 | 1628 |
| 1629 Token getBeginToken() => beginToken; | 1629 Token getBeginToken() => beginToken; |
| 1630 | 1630 |
| 1631 Token getEndToken() => endToken; | 1631 Token getEndToken() => endToken; |
| 1632 | 1632 |
| 1633 LibraryTag toLibraryTag() { | 1633 LibraryTag toLibraryTag() { |
| 1634 if (isImport()) { | 1634 if (isImport()) { |
| 1635 Identifier prefixNode; | 1635 Identifier prefixNode; |
| 1636 if (prefix !== null) { | 1636 if (prefix !== null) { |
| 1637 SourceString source = prefix.dartString.source; | 1637 SourceString source = prefix.dartString.source; |
| 1638 Token prefixToken = prefix.getBeginToken(); |
| 1638 Token token = new StringToken.fromSource(IDENTIFIER_INFO, source, | 1639 Token token = new StringToken.fromSource(IDENTIFIER_INFO, source, |
| 1639 prefix.token.charOffset); | 1640 prefixToken.charOffset); |
| 1640 token.next = prefix.token.next; | 1641 token.next = prefixToken.next; |
| 1641 prefixNode = new Identifier(token); | 1642 prefixNode = new Identifier(token); |
| 1642 } | 1643 } |
| 1643 return new Import(tag.token, argument, prefixNode, null); | 1644 return new Import(tag.token, argument, prefixNode, null); |
| 1644 } else if (isLibrary()) { | 1645 } else if (isLibrary()) { |
| 1645 return new LibraryName(tag.token, argument); | 1646 return new LibraryName(tag.token, argument); |
| 1646 } else if (isSource()) { | 1647 } else if (isSource()) { |
| 1647 return new Part(tag.token, argument); | 1648 return new Part(tag.token, argument); |
| 1648 } else { | 1649 } else { |
| 1649 throw 'Unknown script tag ${tag.token.slowToString()}'; | 1650 throw 'Unknown script tag ${tag.token.slowToString()}'; |
| 1650 } | 1651 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 * argument). | 1977 * argument). |
| 1977 * | 1978 * |
| 1978 * TODO(ahe): This method is controversial, the team needs to discuss | 1979 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1979 * if top-level methods are acceptable and what naming conventions to | 1980 * if top-level methods are acceptable and what naming conventions to |
| 1980 * use. | 1981 * use. |
| 1981 */ | 1982 */ |
| 1982 initializerDo(Node node, f(Node node)) { | 1983 initializerDo(Node node, f(Node node)) { |
| 1983 SendSet send = node.asSendSet(); | 1984 SendSet send = node.asSendSet(); |
| 1984 if (send !== null) return f(send.arguments.head); | 1985 if (send !== null) return f(send.arguments.head); |
| 1985 } | 1986 } |
| OLD | NEW |