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

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

Issue 8993009: Implement string interpolation up to SSA. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address (some) review comments and update status file Created 9 years 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/tools/mini_parser.dart ('k') | dart/frog/leg/tree/unparser.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 visitClassNode(ClassNode node); 7 R visitClassNode(ClassNode node);
8 R visitConditional(Conditional node); 8 R visitConditional(Conditional node);
9 R visitDoWhile(DoWhile node); 9 R visitDoWhile(DoWhile node);
10 R visitExpressionStatement(ExpressionStatement node); 10 R visitExpressionStatement(ExpressionStatement node);
11 R visitFor(For node); 11 R visitFor(For node);
12 R visitFunctionExpression(FunctionExpression node); 12 R visitFunctionExpression(FunctionExpression node);
13 R visitIdentifier(Identifier node); 13 R visitIdentifier(Identifier node);
14 R visitIf(If node); 14 R visitIf(If node);
15 R visitLiteralBool(LiteralBool node); 15 R visitLiteralBool(LiteralBool node);
16 R visitLiteralDouble(LiteralDouble node); 16 R visitLiteralDouble(LiteralDouble node);
17 R visitLiteralInt(LiteralInt node); 17 R visitLiteralInt(LiteralInt node);
18 R visitLiteralList(LiteralList node); 18 R visitLiteralList(LiteralList node);
19 R visitLiteralNull(LiteralNull node); 19 R visitLiteralNull(LiteralNull node);
20 R visitLiteralString(LiteralString node); 20 R visitLiteralString(LiteralString node);
21 R visitModifiers(Modifiers node); 21 R visitModifiers(Modifiers node);
22 R visitNewExpression(NewExpression node); 22 R visitNewExpression(NewExpression node);
23 R visitNodeList(NodeList node); 23 R visitNodeList(NodeList node);
24 R visitOperator(Operator node); 24 R visitOperator(Operator node);
25 R visitParenthesizedExpression(ParenthesizedExpression node); 25 R visitParenthesizedExpression(ParenthesizedExpression node);
26 R visitReturn(Return node); 26 R visitReturn(Return node);
27 R visitSend(Send node); 27 R visitSend(Send node);
28 R visitSendSet(SendSet node); 28 R visitSendSet(SendSet node);
29 R visitStringInterpolation(StringInterpolation node);
30 R visitStringInterpolationPart(StringInterpolationPart node);
29 R visitThrow(Throw node); 31 R visitThrow(Throw node);
30 R visitTypeAnnotation(TypeAnnotation node); 32 R visitTypeAnnotation(TypeAnnotation node);
31 R visitVariableDefinitions(VariableDefinitions node); 33 R visitVariableDefinitions(VariableDefinitions node);
32 R visitWhile(While node); 34 R visitWhile(While node);
33 } 35 }
34 36
35 Token firstBeginToken(Node first, Node second) { 37 Token firstBeginToken(Node first, Node second) {
36 return (first !== null) ? first.getBeginToken() 38 return (first !== null) ? first.getBeginToken()
37 : second.getBeginToken(); 39 : second.getBeginToken();
38 } 40 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 LiteralNull asLiteralNull() => null; 94 LiteralNull asLiteralNull() => null;
93 LiteralString asLiteralString() => null; 95 LiteralString asLiteralString() => null;
94 LiteralList asLiteralList() => null; 96 LiteralList asLiteralList() => null;
95 Modifiers asModifiers() => null; 97 Modifiers asModifiers() => null;
96 NodeList asNodeList() => null; 98 NodeList asNodeList() => null;
97 Operator asOperator() => null; 99 Operator asOperator() => null;
98 ParenthesizedExpression asParenthesizedExpression() => null; 100 ParenthesizedExpression asParenthesizedExpression() => null;
99 Return asReturn() => null; 101 Return asReturn() => null;
100 Send asSend() => null; 102 Send asSend() => null;
101 SendSet asSendSet() => null; 103 SendSet asSendSet() => null;
104 StringInterpolation asStringInterpolation() => null;
105 StringInterpolationPart asStringInterpolationPart() => null;
102 Throw asThrow() => null; 106 Throw asThrow() => null;
103 TypeAnnotation asTypeAnnotation() => null; 107 TypeAnnotation asTypeAnnotation() => null;
104 VariableDefinitions asVariableDefinitions() => null; 108 VariableDefinitions asVariableDefinitions() => null;
105 While asWhile() => null; 109 While asWhile() => null;
106 } 110 }
107 111
108 class ClassNode extends Node { 112 class ClassNode extends Node {
109 final Identifier name; 113 final Identifier name;
110 final TypeAnnotation superclass; 114 final TypeAnnotation superclass;
111 final NodeList interfaces; 115 final NodeList interfaces;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 accept(Visitor visitor) => visitor.visitModifiers(this); 823 accept(Visitor visitor) => visitor.visitModifiers(this);
820 visitChilren(Visitor visitor) => nodes.accept(visitor); 824 visitChilren(Visitor visitor) => nodes.accept(visitor);
821 825
822 bool isStatic() => (flags & FLAG_STATIC) != 0; 826 bool isStatic() => (flags & FLAG_STATIC) != 0;
823 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; 827 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0;
824 bool isFinal() => (flags & FLAG_FINAL) != 0; 828 bool isFinal() => (flags & FLAG_FINAL) != 0;
825 bool isVar() => (flags & FLAG_VAR) != 0; 829 bool isVar() => (flags & FLAG_VAR) != 0;
826 bool isConst() => (flags & FLAG_CONST) != 0; 830 bool isConst() => (flags & FLAG_CONST) != 0;
827 } 831 }
828 832
833 class StringInterpolation extends Expression {
834 final LiteralString string;
835 final NodeList parts;
836
837 StringInterpolation(this.string, this.parts);
838
839 StringInterpolation asStringInterpolation() => this;
840
841 accept(Visitor visitor) => visitor.visitStringInterpolation(this);
842
843 visitChildren(Visitor visitor) {
844 string.accept(visitor);
845 parts.accept(visitor);
846 }
847
848 Token getBeginToken() => string.getBeginToken();
849
850 Token getEndToken() => parts.getEndToken();
851 }
852
853 class StringInterpolationPart extends Node {
854 final Expression expression;
855 final LiteralString string;
856
857 StringInterpolationPart(this.expression, this.string);
858
859 StringInterpolationPart asStringInterpolationPart() => this;
860
861 accept(Visitor visitor) => visitor.visitStringInterpolationPart(this);
862
863 visitChildren(Visitor visitor) {
864 expression.accept(visitor);
865 string.accept(visitor);
866 }
867
868 Token getBeginToken() => expression.getBeginToken();
869
870 Token getEndToken() => string.getEndToken();
871 }
872
829 class UnimplementedExpression extends Expression { 873 class UnimplementedExpression extends Expression {
830 final String description; 874 final String description;
831 final NodeList nodes; 875 final NodeList nodes;
832 876
833 UnimplementedExpression(this.description, List<Node> nodes) 877 UnimplementedExpression(this.description, List<Node> nodes)
834 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); 878 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes));
835 879
836 toString() => '$description($nodes)'; 880 toString() => '$description($nodes)';
837 881
838 Token getBeginToken() => nodes.getBeginToken(); 882 Token getBeginToken() => nodes.getBeginToken();
839 883
840 Token getEndToken() => nodes.getEndToken(); 884 Token getEndToken() => nodes.getEndToken();
841 } 885 }
842 886
843 class UnimplementedStatement extends Statement { 887 class UnimplementedStatement extends Statement {
844 final String description; 888 final String description;
845 final NodeList nodes; 889 final NodeList nodes;
846 890
847 UnimplementedStatement(this.description, List<Node> nodes) 891 UnimplementedStatement(this.description, List<Node> nodes)
848 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes)); 892 : this.nodes = new NodeList(null, new Link<Node>.fromList(nodes));
849 893
850 toString() => '$description($nodes)'; 894 toString() => '$description($nodes)';
851 895
852 Token getBeginToken() => nodes.getBeginToken(); 896 Token getBeginToken() => nodes.getBeginToken();
853 897
854 Token getEndToken() => nodes.getEndToken(); 898 Token getEndToken() => nodes.getEndToken();
855 } 899 }
OLDNEW
« no previous file with comments | « dart/frog/leg/tools/mini_parser.dart ('k') | dart/frog/leg/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698