| 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 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 visitCascade(Cascade node); | 8 R visitCascade(Cascade node); |
| 9 R visitCascadeReceiver(CascadeReceiver node); | 9 R visitCascadeReceiver(CascadeReceiver node); |
| 10 R visitCaseMatch(CaseMatch node); | 10 R visitCaseMatch(CaseMatch node); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 if (token.value == Keyword.TRUE) return true; | 701 if (token.value == Keyword.TRUE) return true; |
| 702 if (token.value == Keyword.FALSE) return false; | 702 if (token.value == Keyword.FALSE) return false; |
| 703 (this.handler)(token, "not a bool ${token.value}"); | 703 (this.handler)(token, "not a bool ${token.value}"); |
| 704 } | 704 } |
| 705 | 705 |
| 706 accept(Visitor visitor) => visitor.visitLiteralBool(this); | 706 accept(Visitor visitor) => visitor.visitLiteralBool(this); |
| 707 } | 707 } |
| 708 | 708 |
| 709 | 709 |
| 710 class StringQuoting { | 710 class StringQuoting { |
| 711 static final StringQuoting SINGLELINE_DQ = | 711 static const StringQuoting SINGLELINE_DQ = |
| 712 const StringQuoting($DQ, raw: false, leftQuoteLength: 1); | 712 const StringQuoting($DQ, raw: false, leftQuoteLength: 1); |
| 713 static final StringQuoting RAW_SINGLELINE_DQ = | 713 static const StringQuoting RAW_SINGLELINE_DQ = |
| 714 const StringQuoting($DQ, raw: true, leftQuoteLength: 1); | 714 const StringQuoting($DQ, raw: true, leftQuoteLength: 1); |
| 715 static final StringQuoting MULTILINE_DQ = | 715 static const StringQuoting MULTILINE_DQ = |
| 716 const StringQuoting($DQ, raw: false, leftQuoteLength: 3); | 716 const StringQuoting($DQ, raw: false, leftQuoteLength: 3); |
| 717 static final StringQuoting RAW_MULTILINE_DQ = | 717 static const StringQuoting RAW_MULTILINE_DQ = |
| 718 const StringQuoting($DQ, raw: true, leftQuoteLength: 3); | 718 const StringQuoting($DQ, raw: true, leftQuoteLength: 3); |
| 719 static final StringQuoting MULTILINE_NL_DQ = | 719 static const StringQuoting MULTILINE_NL_DQ = |
| 720 const StringQuoting($DQ, raw: false, leftQuoteLength: 4); | 720 const StringQuoting($DQ, raw: false, leftQuoteLength: 4); |
| 721 static final StringQuoting RAW_MULTILINE_NL_DQ = | 721 static const StringQuoting RAW_MULTILINE_NL_DQ = |
| 722 const StringQuoting($DQ, raw: true, leftQuoteLength: 4); | 722 const StringQuoting($DQ, raw: true, leftQuoteLength: 4); |
| 723 static final StringQuoting MULTILINE_NL2_DQ = | 723 static const StringQuoting MULTILINE_NL2_DQ = |
| 724 const StringQuoting($DQ, raw: false, leftQuoteLength: 5); | 724 const StringQuoting($DQ, raw: false, leftQuoteLength: 5); |
| 725 static final StringQuoting RAW_MULTILINE_NL2_DQ = | 725 static const StringQuoting RAW_MULTILINE_NL2_DQ = |
| 726 const StringQuoting($DQ, raw: true, leftQuoteLength: 5); | 726 const StringQuoting($DQ, raw: true, leftQuoteLength: 5); |
| 727 static final StringQuoting SINGLELINE_SQ = | 727 static const StringQuoting SINGLELINE_SQ = |
| 728 const StringQuoting($SQ, raw: false, leftQuoteLength: 1); | 728 const StringQuoting($SQ, raw: false, leftQuoteLength: 1); |
| 729 static final StringQuoting RAW_SINGLELINE_SQ = | 729 static const StringQuoting RAW_SINGLELINE_SQ = |
| 730 const StringQuoting($SQ, raw: true, leftQuoteLength: 1); | 730 const StringQuoting($SQ, raw: true, leftQuoteLength: 1); |
| 731 static final StringQuoting MULTILINE_SQ = | 731 static const StringQuoting MULTILINE_SQ = |
| 732 const StringQuoting($SQ, raw: false, leftQuoteLength: 3); | 732 const StringQuoting($SQ, raw: false, leftQuoteLength: 3); |
| 733 static final StringQuoting RAW_MULTILINE_SQ = | 733 static const StringQuoting RAW_MULTILINE_SQ = |
| 734 const StringQuoting($SQ, raw: true, leftQuoteLength: 3); | 734 const StringQuoting($SQ, raw: true, leftQuoteLength: 3); |
| 735 static final StringQuoting MULTILINE_NL_SQ = | 735 static const StringQuoting MULTILINE_NL_SQ = |
| 736 const StringQuoting($SQ, raw: false, leftQuoteLength: 4); | 736 const StringQuoting($SQ, raw: false, leftQuoteLength: 4); |
| 737 static final StringQuoting RAW_MULTILINE_NL_SQ = | 737 static const StringQuoting RAW_MULTILINE_NL_SQ = |
| 738 const StringQuoting($SQ, raw: true, leftQuoteLength: 4); | 738 const StringQuoting($SQ, raw: true, leftQuoteLength: 4); |
| 739 static final StringQuoting MULTILINE_NL2_SQ = | 739 static const StringQuoting MULTILINE_NL2_SQ = |
| 740 const StringQuoting($SQ, raw: false, leftQuoteLength: 5); | 740 const StringQuoting($SQ, raw: false, leftQuoteLength: 5); |
| 741 static final StringQuoting RAW_MULTILINE_NL2_SQ = | 741 static const StringQuoting RAW_MULTILINE_NL2_SQ = |
| 742 const StringQuoting($SQ, raw: true, leftQuoteLength: 5); | 742 const StringQuoting($SQ, raw: true, leftQuoteLength: 5); |
| 743 | 743 |
| 744 | 744 |
| 745 static final List<StringQuoting> mapping = const <StringQuoting>[ | 745 static const List<StringQuoting> mapping = const <StringQuoting>[ |
| 746 SINGLELINE_DQ, | 746 SINGLELINE_DQ, |
| 747 RAW_SINGLELINE_DQ, | 747 RAW_SINGLELINE_DQ, |
| 748 MULTILINE_DQ, | 748 MULTILINE_DQ, |
| 749 RAW_MULTILINE_DQ, | 749 RAW_MULTILINE_DQ, |
| 750 MULTILINE_NL_DQ, | 750 MULTILINE_NL_DQ, |
| 751 RAW_MULTILINE_NL_DQ, | 751 RAW_MULTILINE_NL_DQ, |
| 752 MULTILINE_NL2_DQ, | 752 MULTILINE_NL2_DQ, |
| 753 RAW_MULTILINE_NL2_DQ, | 753 RAW_MULTILINE_NL2_DQ, |
| 754 SINGLELINE_SQ, | 754 SINGLELINE_SQ, |
| 755 RAW_SINGLELINE_SQ, | 755 RAW_SINGLELINE_SQ, |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 * 1. The nodes must come in a certain order. | 1089 * 1. The nodes must come in a certain order. |
| 1090 * 2. The keywords "var" and "final" may not be used at the same time. | 1090 * 2. The keywords "var" and "final" may not be used at the same time. |
| 1091 * 3. The keywords "abstract" and "external" may not be used at the same time. | 1091 * 3. The keywords "abstract" and "external" may not be used at the same time. |
| 1092 * 4. The type of an element must be null if isVar() is true. | 1092 * 4. The type of an element must be null if isVar() is true. |
| 1093 */ | 1093 */ |
| 1094 | 1094 |
| 1095 final NodeList nodes; | 1095 final NodeList nodes; |
| 1096 /** Bit pattern to easy check what modifiers are present. */ | 1096 /** Bit pattern to easy check what modifiers are present. */ |
| 1097 final int flags; | 1097 final int flags; |
| 1098 | 1098 |
| 1099 static final int FLAG_STATIC = 1; | 1099 static const int FLAG_STATIC = 1; |
| 1100 static final int FLAG_ABSTRACT = FLAG_STATIC << 1; | 1100 static const int FLAG_ABSTRACT = FLAG_STATIC << 1; |
| 1101 static final int FLAG_FINAL = FLAG_ABSTRACT << 1; | 1101 static const int FLAG_FINAL = FLAG_ABSTRACT << 1; |
| 1102 static final int FLAG_VAR = FLAG_FINAL << 1; | 1102 static const int FLAG_VAR = FLAG_FINAL << 1; |
| 1103 static final int FLAG_CONST = FLAG_VAR << 1; | 1103 static const int FLAG_CONST = FLAG_VAR << 1; |
| 1104 static final int FLAG_FACTORY = FLAG_CONST << 1; | 1104 static const int FLAG_FACTORY = FLAG_CONST << 1; |
| 1105 static final int FLAG_EXTERNAL = FLAG_FACTORY << 1; | 1105 static const int FLAG_EXTERNAL = FLAG_FACTORY << 1; |
| 1106 | 1106 |
| 1107 Modifiers(NodeList nodes) : this.withFlags(nodes, computeFlags(nodes.nodes)); | 1107 Modifiers(NodeList nodes) : this.withFlags(nodes, computeFlags(nodes.nodes)); |
| 1108 | 1108 |
| 1109 Modifiers.empty() : this(new NodeList.empty()); | 1109 Modifiers.empty() : this(new NodeList.empty()); |
| 1110 | 1110 |
| 1111 Modifiers.withFlags(this.nodes, this.flags); | 1111 Modifiers.withFlags(this.nodes, this.flags); |
| 1112 | 1112 |
| 1113 static int computeFlags(Link<Node> nodes) { | 1113 static int computeFlags(Link<Node> nodes) { |
| 1114 int flags = 0; | 1114 int flags = 0; |
| 1115 for (; !nodes.isEmpty(); nodes = nodes.tail) { | 1115 for (; !nodes.isEmpty(); nodes = nodes.tail) { |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 * argument). | 1762 * argument). |
| 1763 * | 1763 * |
| 1764 * TODO(ahe): This method is controversial, the team needs to discuss | 1764 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1765 * if top-level methods are acceptable and what naming conventions to | 1765 * if top-level methods are acceptable and what naming conventions to |
| 1766 * use. | 1766 * use. |
| 1767 */ | 1767 */ |
| 1768 initializerDo(Node node, f(Node node)) { | 1768 initializerDo(Node node, f(Node node)) { |
| 1769 SendSet send = node.asSendSet(); | 1769 SendSet send = node.asSendSet(); |
| 1770 if (send !== null) return f(send.arguments.head); | 1770 if (send !== null) return f(send.arguments.head); |
| 1771 } | 1771 } |
| OLD | NEW |