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

Side by Side Diff: pkg/analyzer/test/generated/parser_test.dart

Issue 68233003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3
3 library engine.parser_test; 4 library engine.parser_test;
5
4 import 'package:analyzer/src/generated/java_core.dart'; 6 import 'package:analyzer/src/generated/java_core.dart';
5 import 'package:analyzer/src/generated/java_junit.dart'; 7 import 'package:analyzer/src/generated/java_junit.dart';
6 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
7 import 'package:analyzer/src/generated/source.dart' show Source; 9 import 'package:analyzer/src/generated/source.dart' show Source;
8 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 11 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/parser.dart'; 12 import 'package:analyzer/src/generated/parser.dart';
11 import 'package:analyzer/src/generated/element.dart'; 13 import 'package:analyzer/src/generated/element.dart';
12 import 'package:analyzer/src/generated/utilities_dart.dart'; 14 import 'package:analyzer/src/generated/utilities_dart.dart';
13 import 'package:unittest/unittest.dart' as _ut; 15 import 'package:unittest/unittest.dart' as _ut;
14 import 'test_support.dart'; 16 import 'test_support.dart';
15 import 'scanner_test.dart' show TokenFactory; 17 import 'scanner_test.dart' show TokenFactory;
16 import 'ast_test.dart' show ASTFactory; 18 import 'ast_test.dart' show ASTFactory;
17 import 'element_test.dart' show ElementFactory; 19 import 'element_test.dart' show ElementFactory;
20
18 /** 21 /**
19 * The class `SimpleParserTest` defines parser tests that test individual parsin g method. The 22 * The class `SimpleParserTest` defines parser tests that test individual parsin g method. The
20 * code fragments should be as minimal as possible in order to test the method, but should not test 23 * code fragments should be as minimal as possible in order to test the method, but should not test
21 * the interactions between the method under test and other methods. 24 * the interactions between the method under test and other methods.
22 * 25 *
23 * More complex tests should be defined in the class [ComplexParserTest]. 26 * More complex tests should be defined in the class [ComplexParserTest].
24 */ 27 */
25 class SimpleParserTest extends ParserTestCase { 28 class SimpleParserTest extends ParserTestCase {
26 void fail_parseCommentReference_this() { 29 void fail_parseCommentReference_this() {
27 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], ""); 30 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["this", 5], "");
28 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier); 31 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier);
29 JUnitTestCase.assertNotNull(identifier.token); 32 JUnitTestCase.assertNotNull(identifier.token);
30 JUnitTestCase.assertEquals("a", identifier.name); 33 JUnitTestCase.assertEquals("a", identifier.name);
31 JUnitTestCase.assertEquals(5, identifier.offset); 34 JUnitTestCase.assertEquals(5, identifier.offset);
32 } 35 }
36
33 void test_computeStringValue_emptyInterpolationPrefix() { 37 void test_computeStringValue_emptyInterpolationPrefix() {
34 JUnitTestCase.assertEquals("", computeStringValue("'''", true, false)); 38 JUnitTestCase.assertEquals("", computeStringValue("'''", true, false));
35 } 39 }
40
36 void test_computeStringValue_escape_b() { 41 void test_computeStringValue_escape_b() {
37 JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'", true, true)); 42 JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'", true, true));
38 } 43 }
44
39 void test_computeStringValue_escape_f() { 45 void test_computeStringValue_escape_f() {
40 JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'", true, true)); 46 JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'", true, true));
41 } 47 }
48
42 void test_computeStringValue_escape_n() { 49 void test_computeStringValue_escape_n() {
43 JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'", true, true)); 50 JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'", true, true));
44 } 51 }
52
45 void test_computeStringValue_escape_notSpecial() { 53 void test_computeStringValue_escape_notSpecial() {
46 JUnitTestCase.assertEquals(":", computeStringValue("'\\:'", true, true)); 54 JUnitTestCase.assertEquals(":", computeStringValue("'\\:'", true, true));
47 } 55 }
56
48 void test_computeStringValue_escape_r() { 57 void test_computeStringValue_escape_r() {
49 JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'", true, true)); 58 JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'", true, true));
50 } 59 }
60
51 void test_computeStringValue_escape_t() { 61 void test_computeStringValue_escape_t() {
52 JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'", true, true)); 62 JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'", true, true));
53 } 63 }
64
54 void test_computeStringValue_escape_u_fixed() { 65 void test_computeStringValue_escape_u_fixed() {
55 JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'", true, t rue)); 66 JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'", true, t rue));
56 } 67 }
68
57 void test_computeStringValue_escape_u_variable() { 69 void test_computeStringValue_escape_u_variable() {
58 JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'", true, true)); 70 JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'", true, true));
59 } 71 }
72
60 void test_computeStringValue_escape_v() { 73 void test_computeStringValue_escape_v() {
61 JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'", true, true) ); 74 JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'", true, true) );
62 } 75 }
76
63 void test_computeStringValue_escape_x() { 77 void test_computeStringValue_escape_x() {
64 JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'", true, tru e)); 78 JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'", true, tru e));
65 } 79 }
80
66 void test_computeStringValue_noEscape_single() { 81 void test_computeStringValue_noEscape_single() {
67 JUnitTestCase.assertEquals("text", computeStringValue("'text'", true, true)) ; 82 JUnitTestCase.assertEquals("text", computeStringValue("'text'", true, true)) ;
68 } 83 }
84
69 void test_computeStringValue_noEscape_triple() { 85 void test_computeStringValue_noEscape_triple() {
70 JUnitTestCase.assertEquals("text", computeStringValue("'''text'''", true, tr ue)); 86 JUnitTestCase.assertEquals("text", computeStringValue("'''text'''", true, tr ue));
71 } 87 }
88
72 void test_computeStringValue_raw_single() { 89 void test_computeStringValue_raw_single() {
73 JUnitTestCase.assertEquals("text", computeStringValue("r'text'", true, true) ); 90 JUnitTestCase.assertEquals("text", computeStringValue("r'text'", true, true) );
74 } 91 }
92
75 void test_computeStringValue_raw_triple() { 93 void test_computeStringValue_raw_triple() {
76 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''", true, t rue)); 94 JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''", true, t rue));
77 } 95 }
96
78 void test_computeStringValue_raw_withEscape() { 97 void test_computeStringValue_raw_withEscape() {
79 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' ", true, true)); 98 JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines' ", true, true));
80 } 99 }
100
81 void test_computeStringValue_triple_internalQuote_first_empty() { 101 void test_computeStringValue_triple_internalQuote_first_empty() {
82 JUnitTestCase.assertEquals("'", computeStringValue("''''", true, false)); 102 JUnitTestCase.assertEquals("'", computeStringValue("''''", true, false));
83 } 103 }
104
84 void test_computeStringValue_triple_internalQuote_first_nonEmpty() { 105 void test_computeStringValue_triple_internalQuote_first_nonEmpty() {
85 JUnitTestCase.assertEquals("'text", computeStringValue("''''text", true, fal se)); 106 JUnitTestCase.assertEquals("'text", computeStringValue("''''text", true, fal se));
86 } 107 }
108
87 void test_computeStringValue_triple_internalQuote_last_empty() { 109 void test_computeStringValue_triple_internalQuote_last_empty() {
88 JUnitTestCase.assertEquals("", computeStringValue("'''", false, true)); 110 JUnitTestCase.assertEquals("", computeStringValue("'''", false, true));
89 } 111 }
112
90 void test_computeStringValue_triple_internalQuote_last_nonEmpty() { 113 void test_computeStringValue_triple_internalQuote_last_nonEmpty() {
91 JUnitTestCase.assertEquals("text", computeStringValue("text'''", false, true )); 114 JUnitTestCase.assertEquals("text", computeStringValue("text'''", false, true ));
92 } 115 }
116
93 void test_constFactory() { 117 void test_constFactory() {
94 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;"); 118 ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
95 } 119 }
120
96 void test_createSyntheticIdentifier() { 121 void test_createSyntheticIdentifier() {
97 SimpleIdentifier identifier = createSyntheticIdentifier(); 122 SimpleIdentifier identifier = createSyntheticIdentifier();
98 JUnitTestCase.assertTrue(identifier.isSynthetic); 123 JUnitTestCase.assertTrue(identifier.isSynthetic);
99 } 124 }
125
100 void test_createSyntheticStringLiteral() { 126 void test_createSyntheticStringLiteral() {
101 SimpleStringLiteral literal = createSyntheticStringLiteral(); 127 SimpleStringLiteral literal = createSyntheticStringLiteral();
102 JUnitTestCase.assertTrue(literal.isSynthetic); 128 JUnitTestCase.assertTrue(literal.isSynthetic);
103 } 129 }
130
104 void test_isFunctionDeclaration_nameButNoReturn_block() { 131 void test_isFunctionDeclaration_nameButNoReturn_block() {
105 JUnitTestCase.assertTrue(isFunctionDeclaration("f() {}")); 132 JUnitTestCase.assertTrue(isFunctionDeclaration("f() {}"));
106 } 133 }
134
107 void test_isFunctionDeclaration_nameButNoReturn_expression() { 135 void test_isFunctionDeclaration_nameButNoReturn_expression() {
108 JUnitTestCase.assertTrue(isFunctionDeclaration("f() => e")); 136 JUnitTestCase.assertTrue(isFunctionDeclaration("f() => e"));
109 } 137 }
138
110 void test_isFunctionDeclaration_normalReturn_block() { 139 void test_isFunctionDeclaration_normalReturn_block() {
111 JUnitTestCase.assertTrue(isFunctionDeclaration("C f() {}")); 140 JUnitTestCase.assertTrue(isFunctionDeclaration("C f() {}"));
112 } 141 }
142
113 void test_isFunctionDeclaration_normalReturn_expression() { 143 void test_isFunctionDeclaration_normalReturn_expression() {
114 JUnitTestCase.assertTrue(isFunctionDeclaration("C f() => e")); 144 JUnitTestCase.assertTrue(isFunctionDeclaration("C f() => e"));
115 } 145 }
146
116 void test_isFunctionDeclaration_voidReturn_block() { 147 void test_isFunctionDeclaration_voidReturn_block() {
117 JUnitTestCase.assertTrue(isFunctionDeclaration("void f() {}")); 148 JUnitTestCase.assertTrue(isFunctionDeclaration("void f() {}"));
118 } 149 }
150
119 void test_isFunctionDeclaration_voidReturn_expression() { 151 void test_isFunctionDeclaration_voidReturn_expression() {
120 JUnitTestCase.assertTrue(isFunctionDeclaration("void f() => e")); 152 JUnitTestCase.assertTrue(isFunctionDeclaration("void f() => e"));
121 } 153 }
154
122 void test_isFunctionExpression_false_noBody() { 155 void test_isFunctionExpression_false_noBody() {
123 JUnitTestCase.assertFalse(isFunctionExpression("f();")); 156 JUnitTestCase.assertFalse(isFunctionExpression("f();"));
124 } 157 }
158
125 void test_isFunctionExpression_false_notParameters() { 159 void test_isFunctionExpression_false_notParameters() {
126 JUnitTestCase.assertFalse(isFunctionExpression("(a + b) {")); 160 JUnitTestCase.assertFalse(isFunctionExpression("(a + b) {"));
127 } 161 }
162
128 void test_isFunctionExpression_noName_block() { 163 void test_isFunctionExpression_noName_block() {
129 JUnitTestCase.assertTrue(isFunctionExpression("() {}")); 164 JUnitTestCase.assertTrue(isFunctionExpression("() {}"));
130 } 165 }
166
131 void test_isFunctionExpression_noName_expression() { 167 void test_isFunctionExpression_noName_expression() {
132 JUnitTestCase.assertTrue(isFunctionExpression("() => e")); 168 JUnitTestCase.assertTrue(isFunctionExpression("() => e"));
133 } 169 }
170
171 void test_isFunctionExpression_parameter_final() {
172 JUnitTestCase.assertTrue(isFunctionExpression("(final a) {}"));
173 JUnitTestCase.assertTrue(isFunctionExpression("(final a, b) {}"));
174 JUnitTestCase.assertTrue(isFunctionExpression("(final a, final b) {}"));
175 }
176
177 void test_isFunctionExpression_parameter_final_typed() {
178 JUnitTestCase.assertTrue(isFunctionExpression("(final int a) {}"));
179 JUnitTestCase.assertTrue(isFunctionExpression("(final prefix.List a) {}"));
180 JUnitTestCase.assertTrue(isFunctionExpression("(final List<int> a) {}"));
181 JUnitTestCase.assertTrue(isFunctionExpression("(final prefix.List<int> a) {} "));
182 }
183
134 void test_isFunctionExpression_parameter_multiple() { 184 void test_isFunctionExpression_parameter_multiple() {
135 JUnitTestCase.assertTrue(isFunctionExpression("(a, b) {}")); 185 JUnitTestCase.assertTrue(isFunctionExpression("(a, b) {}"));
136 } 186 }
187
137 void test_isFunctionExpression_parameter_named() { 188 void test_isFunctionExpression_parameter_named() {
138 JUnitTestCase.assertTrue(isFunctionExpression("({a}) {}")); 189 JUnitTestCase.assertTrue(isFunctionExpression("({a}) {}"));
139 } 190 }
191
140 void test_isFunctionExpression_parameter_optional() { 192 void test_isFunctionExpression_parameter_optional() {
141 JUnitTestCase.assertTrue(isFunctionExpression("([a]) {}")); 193 JUnitTestCase.assertTrue(isFunctionExpression("([a]) {}"));
142 } 194 }
195
143 void test_isFunctionExpression_parameter_single() { 196 void test_isFunctionExpression_parameter_single() {
144 JUnitTestCase.assertTrue(isFunctionExpression("(a) {}")); 197 JUnitTestCase.assertTrue(isFunctionExpression("(a) {}"));
145 } 198 }
199
146 void test_isFunctionExpression_parameter_typed() { 200 void test_isFunctionExpression_parameter_typed() {
147 JUnitTestCase.assertTrue(isFunctionExpression("(int a, int b) {}")); 201 JUnitTestCase.assertTrue(isFunctionExpression("(int a, int b) {}"));
148 } 202 }
203
149 void test_isInitializedVariableDeclaration_assignment() { 204 void test_isInitializedVariableDeclaration_assignment() {
150 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a = null;")); 205 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a = null;"));
151 } 206 }
207
152 void test_isInitializedVariableDeclaration_comparison() { 208 void test_isInitializedVariableDeclaration_comparison() {
153 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a < 0;")); 209 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a < 0;"));
154 } 210 }
211
155 void test_isInitializedVariableDeclaration_conditional() { 212 void test_isInitializedVariableDeclaration_conditional() {
156 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a == null ? init () : update();")); 213 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("a == null ? init () : update();"));
157 } 214 }
215
158 void test_isInitializedVariableDeclaration_const_noType_initialized() { 216 void test_isInitializedVariableDeclaration_const_noType_initialized() {
159 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const a = 0;")); 217 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const a = 0;"));
160 } 218 }
219
161 void test_isInitializedVariableDeclaration_const_noType_uninitialized() { 220 void test_isInitializedVariableDeclaration_const_noType_uninitialized() {
162 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const a;")); 221 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const a;"));
163 } 222 }
223
164 void test_isInitializedVariableDeclaration_const_simpleType_uninitialized() { 224 void test_isInitializedVariableDeclaration_const_simpleType_uninitialized() {
165 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const A a;")); 225 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("const A a;"));
166 } 226 }
227
167 void test_isInitializedVariableDeclaration_final_noType_initialized() { 228 void test_isInitializedVariableDeclaration_final_noType_initialized() {
168 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final a = 0;")); 229 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final a = 0;"));
169 } 230 }
231
170 void test_isInitializedVariableDeclaration_final_noType_uninitialized() { 232 void test_isInitializedVariableDeclaration_final_noType_uninitialized() {
171 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final a;")); 233 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final a;"));
172 } 234 }
235
173 void test_isInitializedVariableDeclaration_final_simpleType_initialized() { 236 void test_isInitializedVariableDeclaration_final_simpleType_initialized() {
174 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final A a = 0;")) ; 237 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("final A a = 0;")) ;
175 } 238 }
239
176 void test_isInitializedVariableDeclaration_functionDeclaration_typed() { 240 void test_isInitializedVariableDeclaration_functionDeclaration_typed() {
177 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("A f() {};")); 241 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("A f() {};"));
178 } 242 }
243
179 void test_isInitializedVariableDeclaration_functionDeclaration_untyped() { 244 void test_isInitializedVariableDeclaration_functionDeclaration_untyped() {
180 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("f() {};")); 245 JUnitTestCase.assertFalse(isInitializedVariableDeclaration("f() {};"));
181 } 246 }
247
182 void test_isInitializedVariableDeclaration_noType_initialized() { 248 void test_isInitializedVariableDeclaration_noType_initialized() {
183 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("var a = 0;")); 249 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("var a = 0;"));
184 } 250 }
251
185 void test_isInitializedVariableDeclaration_noType_uninitialized() { 252 void test_isInitializedVariableDeclaration_noType_uninitialized() {
186 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("var a;")); 253 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("var a;"));
187 } 254 }
255
188 void test_isInitializedVariableDeclaration_parameterizedType_initialized() { 256 void test_isInitializedVariableDeclaration_parameterizedType_initialized() {
189 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("List<int> a = nul l;")); 257 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("List<int> a = nul l;"));
190 } 258 }
259
191 void test_isInitializedVariableDeclaration_parameterizedType_uninitialized() { 260 void test_isInitializedVariableDeclaration_parameterizedType_uninitialized() {
192 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("List<int> a;")); 261 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("List<int> a;"));
193 } 262 }
263
194 void test_isInitializedVariableDeclaration_simpleType_initialized() { 264 void test_isInitializedVariableDeclaration_simpleType_initialized() {
195 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("A a = 0;")); 265 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("A a = 0;"));
196 } 266 }
267
197 void test_isInitializedVariableDeclaration_simpleType_uninitialized() { 268 void test_isInitializedVariableDeclaration_simpleType_uninitialized() {
198 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("A a;")); 269 JUnitTestCase.assertTrue(isInitializedVariableDeclaration("A a;"));
199 } 270 }
271
200 void test_isSwitchMember_case_labeled() { 272 void test_isSwitchMember_case_labeled() {
201 JUnitTestCase.assertTrue(isSwitchMember("l1: l2: case")); 273 JUnitTestCase.assertTrue(isSwitchMember("l1: l2: case"));
202 } 274 }
275
203 void test_isSwitchMember_case_unlabeled() { 276 void test_isSwitchMember_case_unlabeled() {
204 JUnitTestCase.assertTrue(isSwitchMember("case")); 277 JUnitTestCase.assertTrue(isSwitchMember("case"));
205 } 278 }
279
206 void test_isSwitchMember_default_labeled() { 280 void test_isSwitchMember_default_labeled() {
207 JUnitTestCase.assertTrue(isSwitchMember("l1: l2: default")); 281 JUnitTestCase.assertTrue(isSwitchMember("l1: l2: default"));
208 } 282 }
283
209 void test_isSwitchMember_default_unlabeled() { 284 void test_isSwitchMember_default_unlabeled() {
210 JUnitTestCase.assertTrue(isSwitchMember("default")); 285 JUnitTestCase.assertTrue(isSwitchMember("default"));
211 } 286 }
287
212 void test_isSwitchMember_false() { 288 void test_isSwitchMember_false() {
213 JUnitTestCase.assertFalse(isSwitchMember("break;")); 289 JUnitTestCase.assertFalse(isSwitchMember("break;"));
214 } 290 }
291
215 void test_parseAdditiveExpression_normal() { 292 void test_parseAdditiveExpression_normal() {
216 BinaryExpression expression = ParserTestCase.parse5("parseAdditiveExpression ", "x + y", []); 293 BinaryExpression expression = ParserTestCase.parse5("parseAdditiveExpression ", "x + y", []);
217 JUnitTestCase.assertNotNull(expression.leftOperand); 294 JUnitTestCase.assertNotNull(expression.leftOperand);
218 JUnitTestCase.assertNotNull(expression.operator); 295 JUnitTestCase.assertNotNull(expression.operator);
219 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type); 296 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type);
220 JUnitTestCase.assertNotNull(expression.rightOperand); 297 JUnitTestCase.assertNotNull(expression.rightOperand);
221 } 298 }
299
222 void test_parseAdditiveExpression_super() { 300 void test_parseAdditiveExpression_super() {
223 BinaryExpression expression = ParserTestCase.parse5("parseAdditiveExpression ", "super + y", []); 301 BinaryExpression expression = ParserTestCase.parse5("parseAdditiveExpression ", "super + y", []);
224 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 302 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
225 JUnitTestCase.assertNotNull(expression.operator); 303 JUnitTestCase.assertNotNull(expression.operator);
226 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type); 304 JUnitTestCase.assertEquals(TokenType.PLUS, expression.operator.type);
227 JUnitTestCase.assertNotNull(expression.rightOperand); 305 JUnitTestCase.assertNotNull(expression.rightOperand);
228 } 306 }
307
229 void test_parseAnnotation_n1() { 308 void test_parseAnnotation_n1() {
230 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A", []); 309 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A", []);
231 JUnitTestCase.assertNotNull(annotation.atSign); 310 JUnitTestCase.assertNotNull(annotation.atSign);
232 JUnitTestCase.assertNotNull(annotation.name); 311 JUnitTestCase.assertNotNull(annotation.name);
233 JUnitTestCase.assertNull(annotation.period); 312 JUnitTestCase.assertNull(annotation.period);
234 JUnitTestCase.assertNull(annotation.constructorName); 313 JUnitTestCase.assertNull(annotation.constructorName);
235 JUnitTestCase.assertNull(annotation.arguments); 314 JUnitTestCase.assertNull(annotation.arguments);
236 } 315 }
316
237 void test_parseAnnotation_n1_a() { 317 void test_parseAnnotation_n1_a() {
238 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A(x,y)", []); 318 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A(x,y)", []);
239 JUnitTestCase.assertNotNull(annotation.atSign); 319 JUnitTestCase.assertNotNull(annotation.atSign);
240 JUnitTestCase.assertNotNull(annotation.name); 320 JUnitTestCase.assertNotNull(annotation.name);
241 JUnitTestCase.assertNull(annotation.period); 321 JUnitTestCase.assertNull(annotation.period);
242 JUnitTestCase.assertNull(annotation.constructorName); 322 JUnitTestCase.assertNull(annotation.constructorName);
243 JUnitTestCase.assertNotNull(annotation.arguments); 323 JUnitTestCase.assertNotNull(annotation.arguments);
244 } 324 }
325
245 void test_parseAnnotation_n2() { 326 void test_parseAnnotation_n2() {
246 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B", []) ; 327 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B", []) ;
247 JUnitTestCase.assertNotNull(annotation.atSign); 328 JUnitTestCase.assertNotNull(annotation.atSign);
248 JUnitTestCase.assertNotNull(annotation.name); 329 JUnitTestCase.assertNotNull(annotation.name);
249 JUnitTestCase.assertNull(annotation.period); 330 JUnitTestCase.assertNull(annotation.period);
250 JUnitTestCase.assertNull(annotation.constructorName); 331 JUnitTestCase.assertNull(annotation.constructorName);
251 JUnitTestCase.assertNull(annotation.arguments); 332 JUnitTestCase.assertNull(annotation.arguments);
252 } 333 }
334
253 void test_parseAnnotation_n2_a() { 335 void test_parseAnnotation_n2_a() {
254 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B(x,y)" , []); 336 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B(x,y)" , []);
255 JUnitTestCase.assertNotNull(annotation.atSign); 337 JUnitTestCase.assertNotNull(annotation.atSign);
256 JUnitTestCase.assertNotNull(annotation.name); 338 JUnitTestCase.assertNotNull(annotation.name);
257 JUnitTestCase.assertNull(annotation.period); 339 JUnitTestCase.assertNull(annotation.period);
258 JUnitTestCase.assertNull(annotation.constructorName); 340 JUnitTestCase.assertNull(annotation.constructorName);
259 JUnitTestCase.assertNotNull(annotation.arguments); 341 JUnitTestCase.assertNotNull(annotation.arguments);
260 } 342 }
343
261 void test_parseAnnotation_n3() { 344 void test_parseAnnotation_n3() {
262 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B.C", [ ]); 345 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B.C", [ ]);
263 JUnitTestCase.assertNotNull(annotation.atSign); 346 JUnitTestCase.assertNotNull(annotation.atSign);
264 JUnitTestCase.assertNotNull(annotation.name); 347 JUnitTestCase.assertNotNull(annotation.name);
265 JUnitTestCase.assertNotNull(annotation.period); 348 JUnitTestCase.assertNotNull(annotation.period);
266 JUnitTestCase.assertNotNull(annotation.constructorName); 349 JUnitTestCase.assertNotNull(annotation.constructorName);
267 JUnitTestCase.assertNull(annotation.arguments); 350 JUnitTestCase.assertNull(annotation.arguments);
268 } 351 }
352
269 void test_parseAnnotation_n3_a() { 353 void test_parseAnnotation_n3_a() {
270 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B.C(x,y )", []); 354 Annotation annotation = ParserTestCase.parse5("parseAnnotation", "@A.B.C(x,y )", []);
271 JUnitTestCase.assertNotNull(annotation.atSign); 355 JUnitTestCase.assertNotNull(annotation.atSign);
272 JUnitTestCase.assertNotNull(annotation.name); 356 JUnitTestCase.assertNotNull(annotation.name);
273 JUnitTestCase.assertNotNull(annotation.period); 357 JUnitTestCase.assertNotNull(annotation.period);
274 JUnitTestCase.assertNotNull(annotation.constructorName); 358 JUnitTestCase.assertNotNull(annotation.constructorName);
275 JUnitTestCase.assertNotNull(annotation.arguments); 359 JUnitTestCase.assertNotNull(annotation.arguments);
276 } 360 }
361
277 void test_parseArgument_named() { 362 void test_parseArgument_named() {
278 NamedExpression expression = ParserTestCase.parse5("parseArgument", "n: x", []); 363 NamedExpression expression = ParserTestCase.parse5("parseArgument", "n: x", []);
279 Label name = expression.name; 364 Label name = expression.name;
280 JUnitTestCase.assertNotNull(name); 365 JUnitTestCase.assertNotNull(name);
281 JUnitTestCase.assertNotNull(name.label); 366 JUnitTestCase.assertNotNull(name.label);
282 JUnitTestCase.assertNotNull(name.colon); 367 JUnitTestCase.assertNotNull(name.colon);
283 JUnitTestCase.assertNotNull(expression.expression); 368 JUnitTestCase.assertNotNull(expression.expression);
284 } 369 }
370
285 void test_parseArgument_unnamed() { 371 void test_parseArgument_unnamed() {
286 String lexeme = "x"; 372 String lexeme = "x";
287 SimpleIdentifier identifier = ParserTestCase.parse5("parseArgument", lexeme, []); 373 SimpleIdentifier identifier = ParserTestCase.parse5("parseArgument", lexeme, []);
288 JUnitTestCase.assertEquals(lexeme, identifier.name); 374 JUnitTestCase.assertEquals(lexeme, identifier.name);
289 } 375 }
376
290 void test_parseArgumentDefinitionTest() { 377 void test_parseArgumentDefinitionTest() {
291 ArgumentDefinitionTest test = ParserTestCase.parse5("parseArgumentDefinition Test", "?x", [ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]); 378 ArgumentDefinitionTest test = ParserTestCase.parse5("parseArgumentDefinition Test", "?x", [ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST]);
292 JUnitTestCase.assertNotNull(test.question); 379 JUnitTestCase.assertNotNull(test.question);
293 JUnitTestCase.assertNotNull(test.identifier); 380 JUnitTestCase.assertNotNull(test.identifier);
294 } 381 }
382
295 void test_parseArgumentList_empty() { 383 void test_parseArgumentList_empty() {
296 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "()", []); 384 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "()", []);
297 NodeList<Expression> arguments = argumentList.arguments; 385 NodeList<Expression> arguments = argumentList.arguments;
298 EngineTestCase.assertSize(0, arguments); 386 EngineTestCase.assertSize(0, arguments);
299 } 387 }
388
300 void test_parseArgumentList_mixed() { 389 void test_parseArgumentList_mixed() {
301 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(w, x, y: y, z: z)", []); 390 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(w, x, y: y, z: z)", []);
302 NodeList<Expression> arguments = argumentList.arguments; 391 NodeList<Expression> arguments = argumentList.arguments;
303 EngineTestCase.assertSize(4, arguments); 392 EngineTestCase.assertSize(4, arguments);
304 } 393 }
394
305 void test_parseArgumentList_noNamed() { 395 void test_parseArgumentList_noNamed() {
306 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(x, y, z)", []); 396 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(x, y, z)", []);
307 NodeList<Expression> arguments = argumentList.arguments; 397 NodeList<Expression> arguments = argumentList.arguments;
308 EngineTestCase.assertSize(3, arguments); 398 EngineTestCase.assertSize(3, arguments);
309 } 399 }
400
310 void test_parseArgumentList_onlyNamed() { 401 void test_parseArgumentList_onlyNamed() {
311 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(x: x, y: y)", []); 402 ArgumentList argumentList = ParserTestCase.parse5("parseArgumentList", "(x: x, y: y)", []);
312 NodeList<Expression> arguments = argumentList.arguments; 403 NodeList<Expression> arguments = argumentList.arguments;
313 EngineTestCase.assertSize(2, arguments); 404 EngineTestCase.assertSize(2, arguments);
314 } 405 }
406
315 void test_parseAssertStatement() { 407 void test_parseAssertStatement() {
316 AssertStatement statement = ParserTestCase.parse5("parseAssertStatement", "a ssert (x);", []); 408 AssertStatement statement = ParserTestCase.parse5("parseAssertStatement", "a ssert (x);", []);
317 JUnitTestCase.assertNotNull(statement.keyword); 409 JUnitTestCase.assertNotNull(statement.keyword);
318 JUnitTestCase.assertNotNull(statement.leftParenthesis); 410 JUnitTestCase.assertNotNull(statement.leftParenthesis);
319 JUnitTestCase.assertNotNull(statement.condition); 411 JUnitTestCase.assertNotNull(statement.condition);
320 JUnitTestCase.assertNotNull(statement.rightParenthesis); 412 JUnitTestCase.assertNotNull(statement.rightParenthesis);
321 JUnitTestCase.assertNotNull(statement.semicolon); 413 JUnitTestCase.assertNotNull(statement.semicolon);
322 } 414 }
415
323 void test_parseAssignableExpression_expression_args_dot() { 416 void test_parseAssignableExpression_expression_args_dot() {
324 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z"); 417 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x)(y).z");
325 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation; 418 FunctionExpressionInvocation invocation = propertyAccess.target as FunctionE xpressionInvocation;
326 JUnitTestCase.assertNotNull(invocation.function); 419 JUnitTestCase.assertNotNull(invocation.function);
327 ArgumentList argumentList = invocation.argumentList; 420 ArgumentList argumentList = invocation.argumentList;
328 JUnitTestCase.assertNotNull(argumentList); 421 JUnitTestCase.assertNotNull(argumentList);
329 EngineTestCase.assertSize(1, argumentList.arguments); 422 EngineTestCase.assertSize(1, argumentList.arguments);
330 JUnitTestCase.assertNotNull(propertyAccess.operator); 423 JUnitTestCase.assertNotNull(propertyAccess.operator);
331 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 424 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
332 } 425 }
426
333 void test_parseAssignableExpression_expression_dot() { 427 void test_parseAssignableExpression_expression_dot() {
334 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y"); 428 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "(x).y");
335 JUnitTestCase.assertNotNull(propertyAccess.target); 429 JUnitTestCase.assertNotNull(propertyAccess.target);
336 JUnitTestCase.assertNotNull(propertyAccess.operator); 430 JUnitTestCase.assertNotNull(propertyAccess.operator);
337 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 431 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
338 } 432 }
433
339 void test_parseAssignableExpression_expression_index() { 434 void test_parseAssignableExpression_expression_index() {
340 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]"); 435 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "(x)[y]");
341 JUnitTestCase.assertNotNull(expression.target); 436 JUnitTestCase.assertNotNull(expression.target);
342 JUnitTestCase.assertNotNull(expression.leftBracket); 437 JUnitTestCase.assertNotNull(expression.leftBracket);
343 JUnitTestCase.assertNotNull(expression.index); 438 JUnitTestCase.assertNotNull(expression.index);
344 JUnitTestCase.assertNotNull(expression.rightBracket); 439 JUnitTestCase.assertNotNull(expression.rightBracket);
345 } 440 }
441
346 void test_parseAssignableExpression_identifier() { 442 void test_parseAssignableExpression_identifier() {
347 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x"); 443 SimpleIdentifier identifier = ParserTestCase.parse("parseAssignableExpressio n", <Object> [false], "x");
348 JUnitTestCase.assertNotNull(identifier); 444 JUnitTestCase.assertNotNull(identifier);
349 } 445 }
446
350 void test_parseAssignableExpression_identifier_args_dot() { 447 void test_parseAssignableExpression_identifier_args_dot() {
351 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z"); 448 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x(y).z");
352 MethodInvocation invocation = propertyAccess.target as MethodInvocation; 449 MethodInvocation invocation = propertyAccess.target as MethodInvocation;
353 JUnitTestCase.assertEquals("x", invocation.methodName.name); 450 JUnitTestCase.assertEquals("x", invocation.methodName.name);
354 ArgumentList argumentList = invocation.argumentList; 451 ArgumentList argumentList = invocation.argumentList;
355 JUnitTestCase.assertNotNull(argumentList); 452 JUnitTestCase.assertNotNull(argumentList);
356 EngineTestCase.assertSize(1, argumentList.arguments); 453 EngineTestCase.assertSize(1, argumentList.arguments);
357 JUnitTestCase.assertNotNull(propertyAccess.operator); 454 JUnitTestCase.assertNotNull(propertyAccess.operator);
358 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 455 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
359 } 456 }
457
360 void test_parseAssignableExpression_identifier_dot() { 458 void test_parseAssignableExpression_identifier_dot() {
361 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y"); 459 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "x.y");
362 JUnitTestCase.assertNotNull(propertyAccess.target); 460 JUnitTestCase.assertNotNull(propertyAccess.target);
363 JUnitTestCase.assertNotNull(propertyAccess.operator); 461 JUnitTestCase.assertNotNull(propertyAccess.operator);
364 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 462 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
365 } 463 }
464
366 void test_parseAssignableExpression_identifier_index() { 465 void test_parseAssignableExpression_identifier_index() {
367 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]"); 466 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "x[y]");
368 JUnitTestCase.assertNotNull(expression.target); 467 JUnitTestCase.assertNotNull(expression.target);
369 JUnitTestCase.assertNotNull(expression.leftBracket); 468 JUnitTestCase.assertNotNull(expression.leftBracket);
370 JUnitTestCase.assertNotNull(expression.index); 469 JUnitTestCase.assertNotNull(expression.index);
371 JUnitTestCase.assertNotNull(expression.rightBracket); 470 JUnitTestCase.assertNotNull(expression.rightBracket);
372 } 471 }
472
373 void test_parseAssignableExpression_super_dot() { 473 void test_parseAssignableExpression_super_dot() {
374 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y"); 474 PropertyAccess propertyAccess = ParserTestCase.parse("parseAssignableExpress ion", <Object> [false], "super.y");
375 EngineTestCase.assertInstanceOf(SuperExpression, propertyAccess.target); 475 EngineTestCase.assertInstanceOf(SuperExpression, propertyAccess.target);
376 JUnitTestCase.assertNotNull(propertyAccess.operator); 476 JUnitTestCase.assertNotNull(propertyAccess.operator);
377 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 477 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
378 } 478 }
479
379 void test_parseAssignableExpression_super_index() { 480 void test_parseAssignableExpression_super_index() {
380 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]"); 481 IndexExpression expression = ParserTestCase.parse("parseAssignableExpression ", <Object> [false], "super[y]");
381 EngineTestCase.assertInstanceOf(SuperExpression, expression.target); 482 EngineTestCase.assertInstanceOf(SuperExpression, expression.target);
382 JUnitTestCase.assertNotNull(expression.leftBracket); 483 JUnitTestCase.assertNotNull(expression.leftBracket);
383 JUnitTestCase.assertNotNull(expression.index); 484 JUnitTestCase.assertNotNull(expression.index);
384 JUnitTestCase.assertNotNull(expression.rightBracket); 485 JUnitTestCase.assertNotNull(expression.rightBracket);
385 } 486 }
487
386 void test_parseAssignableSelector_dot() { 488 void test_parseAssignableSelector_dot() {
387 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x"); 489 PropertyAccess selector = ParserTestCase.parse("parseAssignableSelector", <O bject> [null, true], ".x");
388 JUnitTestCase.assertNotNull(selector.operator); 490 JUnitTestCase.assertNotNull(selector.operator);
389 JUnitTestCase.assertNotNull(selector.propertyName); 491 JUnitTestCase.assertNotNull(selector.propertyName);
390 } 492 }
493
391 void test_parseAssignableSelector_index() { 494 void test_parseAssignableSelector_index() {
392 IndexExpression selector = ParserTestCase.parse("parseAssignableSelector", < Object> [null, true], "[x]"); 495 IndexExpression selector = ParserTestCase.parse("parseAssignableSelector", < Object> [null, true], "[x]");
393 JUnitTestCase.assertNotNull(selector.leftBracket); 496 JUnitTestCase.assertNotNull(selector.leftBracket);
394 JUnitTestCase.assertNotNull(selector.index); 497 JUnitTestCase.assertNotNull(selector.index);
395 JUnitTestCase.assertNotNull(selector.rightBracket); 498 JUnitTestCase.assertNotNull(selector.rightBracket);
396 } 499 }
500
397 void test_parseAssignableSelector_none() { 501 void test_parseAssignableSelector_none() {
398 SimpleIdentifier selector = ParserTestCase.parse("parseAssignableSelector", <Object> [new SimpleIdentifier.full(null), true], ";"); 502 SimpleIdentifier selector = ParserTestCase.parse("parseAssignableSelector", <Object> [new SimpleIdentifier.full(null), true], ";");
399 JUnitTestCase.assertNotNull(selector); 503 JUnitTestCase.assertNotNull(selector);
400 } 504 }
505
401 void test_parseBitwiseAndExpression_normal() { 506 void test_parseBitwiseAndExpression_normal() {
402 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseAndExpressi on", "x & y", []); 507 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseAndExpressi on", "x & y", []);
403 JUnitTestCase.assertNotNull(expression.leftOperand); 508 JUnitTestCase.assertNotNull(expression.leftOperand);
404 JUnitTestCase.assertNotNull(expression.operator); 509 JUnitTestCase.assertNotNull(expression.operator);
405 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type); 510 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type);
406 JUnitTestCase.assertNotNull(expression.rightOperand); 511 JUnitTestCase.assertNotNull(expression.rightOperand);
407 } 512 }
513
408 void test_parseBitwiseAndExpression_super() { 514 void test_parseBitwiseAndExpression_super() {
409 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseAndExpressi on", "super & y", []); 515 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseAndExpressi on", "super & y", []);
410 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 516 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
411 JUnitTestCase.assertNotNull(expression.operator); 517 JUnitTestCase.assertNotNull(expression.operator);
412 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type); 518 JUnitTestCase.assertEquals(TokenType.AMPERSAND, expression.operator.type);
413 JUnitTestCase.assertNotNull(expression.rightOperand); 519 JUnitTestCase.assertNotNull(expression.rightOperand);
414 } 520 }
521
415 void test_parseBitwiseOrExpression_normal() { 522 void test_parseBitwiseOrExpression_normal() {
416 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseOrExpressio n", "x | y", []); 523 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseOrExpressio n", "x | y", []);
417 JUnitTestCase.assertNotNull(expression.leftOperand); 524 JUnitTestCase.assertNotNull(expression.leftOperand);
418 JUnitTestCase.assertNotNull(expression.operator); 525 JUnitTestCase.assertNotNull(expression.operator);
419 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type); 526 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type);
420 JUnitTestCase.assertNotNull(expression.rightOperand); 527 JUnitTestCase.assertNotNull(expression.rightOperand);
421 } 528 }
529
422 void test_parseBitwiseOrExpression_super() { 530 void test_parseBitwiseOrExpression_super() {
423 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseOrExpressio n", "super | y", []); 531 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseOrExpressio n", "super | y", []);
424 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 532 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
425 JUnitTestCase.assertNotNull(expression.operator); 533 JUnitTestCase.assertNotNull(expression.operator);
426 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type); 534 JUnitTestCase.assertEquals(TokenType.BAR, expression.operator.type);
427 JUnitTestCase.assertNotNull(expression.rightOperand); 535 JUnitTestCase.assertNotNull(expression.rightOperand);
428 } 536 }
537
429 void test_parseBitwiseXorExpression_normal() { 538 void test_parseBitwiseXorExpression_normal() {
430 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseXorExpressi on", "x ^ y", []); 539 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseXorExpressi on", "x ^ y", []);
431 JUnitTestCase.assertNotNull(expression.leftOperand); 540 JUnitTestCase.assertNotNull(expression.leftOperand);
432 JUnitTestCase.assertNotNull(expression.operator); 541 JUnitTestCase.assertNotNull(expression.operator);
433 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type); 542 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type);
434 JUnitTestCase.assertNotNull(expression.rightOperand); 543 JUnitTestCase.assertNotNull(expression.rightOperand);
435 } 544 }
545
436 void test_parseBitwiseXorExpression_super() { 546 void test_parseBitwiseXorExpression_super() {
437 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseXorExpressi on", "super ^ y", []); 547 BinaryExpression expression = ParserTestCase.parse5("parseBitwiseXorExpressi on", "super ^ y", []);
438 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 548 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
439 JUnitTestCase.assertNotNull(expression.operator); 549 JUnitTestCase.assertNotNull(expression.operator);
440 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type); 550 JUnitTestCase.assertEquals(TokenType.CARET, expression.operator.type);
441 JUnitTestCase.assertNotNull(expression.rightOperand); 551 JUnitTestCase.assertNotNull(expression.rightOperand);
442 } 552 }
553
443 void test_parseBlock_empty() { 554 void test_parseBlock_empty() {
444 Block block = ParserTestCase.parse5("parseBlock", "{}", []); 555 Block block = ParserTestCase.parse5("parseBlock", "{}", []);
445 JUnitTestCase.assertNotNull(block.leftBracket); 556 JUnitTestCase.assertNotNull(block.leftBracket);
446 EngineTestCase.assertSize(0, block.statements); 557 EngineTestCase.assertSize(0, block.statements);
447 JUnitTestCase.assertNotNull(block.rightBracket); 558 JUnitTestCase.assertNotNull(block.rightBracket);
448 } 559 }
560
449 void test_parseBlock_nonEmpty() { 561 void test_parseBlock_nonEmpty() {
450 Block block = ParserTestCase.parse5("parseBlock", "{;}", []); 562 Block block = ParserTestCase.parse5("parseBlock", "{;}", []);
451 JUnitTestCase.assertNotNull(block.leftBracket); 563 JUnitTestCase.assertNotNull(block.leftBracket);
452 EngineTestCase.assertSize(1, block.statements); 564 EngineTestCase.assertSize(1, block.statements);
453 JUnitTestCase.assertNotNull(block.rightBracket); 565 JUnitTestCase.assertNotNull(block.rightBracket);
454 } 566 }
567
455 void test_parseBreakStatement_label() { 568 void test_parseBreakStatement_label() {
456 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak foo;", []); 569 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak foo;", []);
457 JUnitTestCase.assertNotNull(statement.keyword); 570 JUnitTestCase.assertNotNull(statement.keyword);
458 JUnitTestCase.assertNotNull(statement.label); 571 JUnitTestCase.assertNotNull(statement.label);
459 JUnitTestCase.assertNotNull(statement.semicolon); 572 JUnitTestCase.assertNotNull(statement.semicolon);
460 } 573 }
574
461 void test_parseBreakStatement_noLabel() { 575 void test_parseBreakStatement_noLabel() {
462 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]); 576 BreakStatement statement = ParserTestCase.parse5("parseBreakStatement", "bre ak;", [ParserErrorCode.BREAK_OUTSIDE_OF_LOOP]);
463 JUnitTestCase.assertNotNull(statement.keyword); 577 JUnitTestCase.assertNotNull(statement.keyword);
464 JUnitTestCase.assertNull(statement.label); 578 JUnitTestCase.assertNull(statement.label);
465 JUnitTestCase.assertNotNull(statement.semicolon); 579 JUnitTestCase.assertNotNull(statement.semicolon);
466 } 580 }
581
467 void test_parseCascadeSection_i() { 582 void test_parseCascadeSection_i() {
468 IndexExpression section = ParserTestCase.parse5("parseCascadeSection", "..[i ]", []); 583 IndexExpression section = ParserTestCase.parse5("parseCascadeSection", "..[i ]", []);
469 JUnitTestCase.assertNull(section.target); 584 JUnitTestCase.assertNull(section.target);
470 JUnitTestCase.assertNotNull(section.leftBracket); 585 JUnitTestCase.assertNotNull(section.leftBracket);
471 JUnitTestCase.assertNotNull(section.index); 586 JUnitTestCase.assertNotNull(section.index);
472 JUnitTestCase.assertNotNull(section.rightBracket); 587 JUnitTestCase.assertNotNull(section.rightBracket);
473 } 588 }
589
474 void test_parseCascadeSection_ia() { 590 void test_parseCascadeSection_ia() {
475 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..[i](b)", []); 591 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..[i](b)", []);
476 EngineTestCase.assertInstanceOf(IndexExpression, section.function); 592 EngineTestCase.assertInstanceOf(IndexExpression, section.function);
477 JUnitTestCase.assertNotNull(section.argumentList); 593 JUnitTestCase.assertNotNull(section.argumentList);
478 } 594 }
595
479 void test_parseCascadeSection_ii() { 596 void test_parseCascadeSection_ii() {
480 MethodInvocation section = ParserTestCase.parse5("parseCascadeSection", "..a (b).c(d)", []); 597 MethodInvocation section = ParserTestCase.parse5("parseCascadeSection", "..a (b).c(d)", []);
481 EngineTestCase.assertInstanceOf(MethodInvocation, section.target); 598 EngineTestCase.assertInstanceOf(MethodInvocation, section.target);
482 JUnitTestCase.assertNotNull(section.period); 599 JUnitTestCase.assertNotNull(section.period);
483 JUnitTestCase.assertNotNull(section.methodName); 600 JUnitTestCase.assertNotNull(section.methodName);
484 JUnitTestCase.assertNotNull(section.argumentList); 601 JUnitTestCase.assertNotNull(section.argumentList);
485 EngineTestCase.assertSize(1, section.argumentList.arguments); 602 EngineTestCase.assertSize(1, section.argumentList.arguments);
486 } 603 }
604
487 void test_parseCascadeSection_p() { 605 void test_parseCascadeSection_p() {
488 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a", []); 606 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a", []);
489 JUnitTestCase.assertNull(section.target); 607 JUnitTestCase.assertNull(section.target);
490 JUnitTestCase.assertNotNull(section.operator); 608 JUnitTestCase.assertNotNull(section.operator);
491 JUnitTestCase.assertNotNull(section.propertyName); 609 JUnitTestCase.assertNotNull(section.propertyName);
492 } 610 }
611
493 void test_parseCascadeSection_p_assign() { 612 void test_parseCascadeSection_p_assign() {
494 AssignmentExpression section = ParserTestCase.parse5("parseCascadeSection", "..a = 3", []); 613 AssignmentExpression section = ParserTestCase.parse5("parseCascadeSection", "..a = 3", []);
495 JUnitTestCase.assertNotNull(section.leftHandSide); 614 JUnitTestCase.assertNotNull(section.leftHandSide);
496 JUnitTestCase.assertNotNull(section.operator); 615 JUnitTestCase.assertNotNull(section.operator);
497 Expression rhs = section.rightHandSide; 616 Expression rhs = section.rightHandSide;
498 JUnitTestCase.assertNotNull(rhs); 617 JUnitTestCase.assertNotNull(rhs);
499 } 618 }
619
500 void test_parseCascadeSection_p_assign_withCascade() { 620 void test_parseCascadeSection_p_assign_withCascade() {
501 AssignmentExpression section = ParserTestCase.parse5("parseCascadeSection", "..a = 3..m()", []); 621 AssignmentExpression section = ParserTestCase.parse5("parseCascadeSection", "..a = 3..m()", []);
502 JUnitTestCase.assertNotNull(section.leftHandSide); 622 JUnitTestCase.assertNotNull(section.leftHandSide);
503 JUnitTestCase.assertNotNull(section.operator); 623 JUnitTestCase.assertNotNull(section.operator);
504 Expression rhs = section.rightHandSide; 624 Expression rhs = section.rightHandSide;
505 EngineTestCase.assertInstanceOf(IntegerLiteral, rhs); 625 EngineTestCase.assertInstanceOf(IntegerLiteral, rhs);
506 } 626 }
627
507 void test_parseCascadeSection_p_builtIn() { 628 void test_parseCascadeSection_p_builtIn() {
508 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..as" , []); 629 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..as" , []);
509 JUnitTestCase.assertNull(section.target); 630 JUnitTestCase.assertNull(section.target);
510 JUnitTestCase.assertNotNull(section.operator); 631 JUnitTestCase.assertNotNull(section.operator);
511 JUnitTestCase.assertNotNull(section.propertyName); 632 JUnitTestCase.assertNotNull(section.propertyName);
512 } 633 }
634
513 void test_parseCascadeSection_pa() { 635 void test_parseCascadeSection_pa() {
514 MethodInvocation section = ParserTestCase.parse5("parseCascadeSection", "..a (b)", []); 636 MethodInvocation section = ParserTestCase.parse5("parseCascadeSection", "..a (b)", []);
515 JUnitTestCase.assertNull(section.target); 637 JUnitTestCase.assertNull(section.target);
516 JUnitTestCase.assertNotNull(section.period); 638 JUnitTestCase.assertNotNull(section.period);
517 JUnitTestCase.assertNotNull(section.methodName); 639 JUnitTestCase.assertNotNull(section.methodName);
518 JUnitTestCase.assertNotNull(section.argumentList); 640 JUnitTestCase.assertNotNull(section.argumentList);
519 EngineTestCase.assertSize(1, section.argumentList.arguments); 641 EngineTestCase.assertSize(1, section.argumentList.arguments);
520 } 642 }
643
521 void test_parseCascadeSection_paa() { 644 void test_parseCascadeSection_paa() {
522 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..a(b)(c)", []); 645 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..a(b)(c)", []);
523 EngineTestCase.assertInstanceOf(MethodInvocation, section.function); 646 EngineTestCase.assertInstanceOf(MethodInvocation, section.function);
524 JUnitTestCase.assertNotNull(section.argumentList); 647 JUnitTestCase.assertNotNull(section.argumentList);
525 EngineTestCase.assertSize(1, section.argumentList.arguments); 648 EngineTestCase.assertSize(1, section.argumentList.arguments);
526 } 649 }
650
527 void test_parseCascadeSection_paapaa() { 651 void test_parseCascadeSection_paapaa() {
528 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..a(b)(c).d(e)(f)", []); 652 FunctionExpressionInvocation section = ParserTestCase.parse5("parseCascadeSe ction", "..a(b)(c).d(e)(f)", []);
529 EngineTestCase.assertInstanceOf(MethodInvocation, section.function); 653 EngineTestCase.assertInstanceOf(MethodInvocation, section.function);
530 JUnitTestCase.assertNotNull(section.argumentList); 654 JUnitTestCase.assertNotNull(section.argumentList);
531 EngineTestCase.assertSize(1, section.argumentList.arguments); 655 EngineTestCase.assertSize(1, section.argumentList.arguments);
532 } 656 }
657
533 void test_parseCascadeSection_pap() { 658 void test_parseCascadeSection_pap() {
534 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a(b ).c", []); 659 PropertyAccess section = ParserTestCase.parse5("parseCascadeSection", "..a(b ).c", []);
535 JUnitTestCase.assertNotNull(section.target); 660 JUnitTestCase.assertNotNull(section.target);
536 JUnitTestCase.assertNotNull(section.operator); 661 JUnitTestCase.assertNotNull(section.operator);
537 JUnitTestCase.assertNotNull(section.propertyName); 662 JUnitTestCase.assertNotNull(section.propertyName);
538 } 663 }
664
539 void test_parseClassDeclaration_abstract() { 665 void test_parseClassDeclaration_abstract() {
540 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [ 666 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [
541 emptyCommentAndMetadata(), 667 emptyCommentAndMetadata(),
542 TokenFactory.token(Keyword.ABSTRACT)], "class A {}"); 668 TokenFactory.token(Keyword.ABSTRACT)], "class A {}");
543 JUnitTestCase.assertNull(declaration.documentationComment); 669 JUnitTestCase.assertNull(declaration.documentationComment);
544 JUnitTestCase.assertNotNull(declaration.abstractKeyword); 670 JUnitTestCase.assertNotNull(declaration.abstractKeyword);
545 JUnitTestCase.assertNull(declaration.extendsClause); 671 JUnitTestCase.assertNull(declaration.extendsClause);
546 JUnitTestCase.assertNull(declaration.implementsClause); 672 JUnitTestCase.assertNull(declaration.implementsClause);
547 JUnitTestCase.assertNotNull(declaration.classKeyword); 673 JUnitTestCase.assertNotNull(declaration.classKeyword);
548 JUnitTestCase.assertNotNull(declaration.leftBracket); 674 JUnitTestCase.assertNotNull(declaration.leftBracket);
549 JUnitTestCase.assertNotNull(declaration.name); 675 JUnitTestCase.assertNotNull(declaration.name);
550 EngineTestCase.assertSize(0, declaration.members); 676 EngineTestCase.assertSize(0, declaration.members);
551 JUnitTestCase.assertNotNull(declaration.rightBracket); 677 JUnitTestCase.assertNotNull(declaration.rightBracket);
552 JUnitTestCase.assertNull(declaration.typeParameters); 678 JUnitTestCase.assertNull(declaration.typeParameters);
553 } 679 }
680
554 void test_parseClassDeclaration_empty() { 681 void test_parseClassDeclaration_empty() {
555 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}"); 682 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {}");
556 JUnitTestCase.assertNull(declaration.documentationComment); 683 JUnitTestCase.assertNull(declaration.documentationComment);
557 JUnitTestCase.assertNull(declaration.abstractKeyword); 684 JUnitTestCase.assertNull(declaration.abstractKeyword);
558 JUnitTestCase.assertNull(declaration.extendsClause); 685 JUnitTestCase.assertNull(declaration.extendsClause);
559 JUnitTestCase.assertNull(declaration.implementsClause); 686 JUnitTestCase.assertNull(declaration.implementsClause);
560 JUnitTestCase.assertNotNull(declaration.classKeyword); 687 JUnitTestCase.assertNotNull(declaration.classKeyword);
561 JUnitTestCase.assertNotNull(declaration.leftBracket); 688 JUnitTestCase.assertNotNull(declaration.leftBracket);
562 JUnitTestCase.assertNotNull(declaration.name); 689 JUnitTestCase.assertNotNull(declaration.name);
563 EngineTestCase.assertSize(0, declaration.members); 690 EngineTestCase.assertSize(0, declaration.members);
564 JUnitTestCase.assertNotNull(declaration.rightBracket); 691 JUnitTestCase.assertNotNull(declaration.rightBracket);
565 JUnitTestCase.assertNull(declaration.typeParameters); 692 JUnitTestCase.assertNull(declaration.typeParameters);
566 } 693 }
694
567 void test_parseClassDeclaration_extends() { 695 void test_parseClassDeclaration_extends() {
568 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B {}"); 696 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B {}");
569 JUnitTestCase.assertNull(declaration.documentationComment); 697 JUnitTestCase.assertNull(declaration.documentationComment);
570 JUnitTestCase.assertNull(declaration.abstractKeyword); 698 JUnitTestCase.assertNull(declaration.abstractKeyword);
571 JUnitTestCase.assertNotNull(declaration.extendsClause); 699 JUnitTestCase.assertNotNull(declaration.extendsClause);
572 JUnitTestCase.assertNull(declaration.implementsClause); 700 JUnitTestCase.assertNull(declaration.implementsClause);
573 JUnitTestCase.assertNotNull(declaration.classKeyword); 701 JUnitTestCase.assertNotNull(declaration.classKeyword);
574 JUnitTestCase.assertNotNull(declaration.leftBracket); 702 JUnitTestCase.assertNotNull(declaration.leftBracket);
575 JUnitTestCase.assertNotNull(declaration.name); 703 JUnitTestCase.assertNotNull(declaration.name);
576 EngineTestCase.assertSize(0, declaration.members); 704 EngineTestCase.assertSize(0, declaration.members);
577 JUnitTestCase.assertNotNull(declaration.rightBracket); 705 JUnitTestCase.assertNotNull(declaration.rightBracket);
578 JUnitTestCase.assertNull(declaration.typeParameters); 706 JUnitTestCase.assertNull(declaration.typeParameters);
579 } 707 }
708
580 void test_parseClassDeclaration_extendsAndImplements() { 709 void test_parseClassDeclaration_extendsAndImplements() {
581 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B implements C {}" ); 710 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B implements C {}" );
582 JUnitTestCase.assertNull(declaration.documentationComment); 711 JUnitTestCase.assertNull(declaration.documentationComment);
583 JUnitTestCase.assertNull(declaration.abstractKeyword); 712 JUnitTestCase.assertNull(declaration.abstractKeyword);
584 JUnitTestCase.assertNotNull(declaration.extendsClause); 713 JUnitTestCase.assertNotNull(declaration.extendsClause);
585 JUnitTestCase.assertNotNull(declaration.implementsClause); 714 JUnitTestCase.assertNotNull(declaration.implementsClause);
586 JUnitTestCase.assertNotNull(declaration.classKeyword); 715 JUnitTestCase.assertNotNull(declaration.classKeyword);
587 JUnitTestCase.assertNotNull(declaration.leftBracket); 716 JUnitTestCase.assertNotNull(declaration.leftBracket);
588 JUnitTestCase.assertNotNull(declaration.name); 717 JUnitTestCase.assertNotNull(declaration.name);
589 EngineTestCase.assertSize(0, declaration.members); 718 EngineTestCase.assertSize(0, declaration.members);
590 JUnitTestCase.assertNotNull(declaration.rightBracket); 719 JUnitTestCase.assertNotNull(declaration.rightBracket);
591 JUnitTestCase.assertNull(declaration.typeParameters); 720 JUnitTestCase.assertNull(declaration.typeParameters);
592 } 721 }
722
593 void test_parseClassDeclaration_extendsAndWith() { 723 void test_parseClassDeclaration_extendsAndWith() {
594 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C {}"); 724 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C {}");
595 JUnitTestCase.assertNull(declaration.documentationComment); 725 JUnitTestCase.assertNull(declaration.documentationComment);
596 JUnitTestCase.assertNull(declaration.abstractKeyword); 726 JUnitTestCase.assertNull(declaration.abstractKeyword);
597 JUnitTestCase.assertNotNull(declaration.classKeyword); 727 JUnitTestCase.assertNotNull(declaration.classKeyword);
598 JUnitTestCase.assertNotNull(declaration.name); 728 JUnitTestCase.assertNotNull(declaration.name);
599 JUnitTestCase.assertNull(declaration.typeParameters); 729 JUnitTestCase.assertNull(declaration.typeParameters);
600 JUnitTestCase.assertNotNull(declaration.extendsClause); 730 JUnitTestCase.assertNotNull(declaration.extendsClause);
601 JUnitTestCase.assertNotNull(declaration.withClause); 731 JUnitTestCase.assertNotNull(declaration.withClause);
602 JUnitTestCase.assertNull(declaration.implementsClause); 732 JUnitTestCase.assertNull(declaration.implementsClause);
603 JUnitTestCase.assertNotNull(declaration.leftBracket); 733 JUnitTestCase.assertNotNull(declaration.leftBracket);
604 EngineTestCase.assertSize(0, declaration.members); 734 EngineTestCase.assertSize(0, declaration.members);
605 JUnitTestCase.assertNotNull(declaration.rightBracket); 735 JUnitTestCase.assertNotNull(declaration.rightBracket);
606 } 736 }
737
607 void test_parseClassDeclaration_extendsAndWithAndImplements() { 738 void test_parseClassDeclaration_extendsAndWithAndImplements() {
608 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C implement s D {}"); 739 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A extends B with C implement s D {}");
609 JUnitTestCase.assertNull(declaration.documentationComment); 740 JUnitTestCase.assertNull(declaration.documentationComment);
610 JUnitTestCase.assertNull(declaration.abstractKeyword); 741 JUnitTestCase.assertNull(declaration.abstractKeyword);
611 JUnitTestCase.assertNotNull(declaration.classKeyword); 742 JUnitTestCase.assertNotNull(declaration.classKeyword);
612 JUnitTestCase.assertNotNull(declaration.name); 743 JUnitTestCase.assertNotNull(declaration.name);
613 JUnitTestCase.assertNull(declaration.typeParameters); 744 JUnitTestCase.assertNull(declaration.typeParameters);
614 JUnitTestCase.assertNotNull(declaration.extendsClause); 745 JUnitTestCase.assertNotNull(declaration.extendsClause);
615 JUnitTestCase.assertNotNull(declaration.withClause); 746 JUnitTestCase.assertNotNull(declaration.withClause);
616 JUnitTestCase.assertNotNull(declaration.implementsClause); 747 JUnitTestCase.assertNotNull(declaration.implementsClause);
617 JUnitTestCase.assertNotNull(declaration.leftBracket); 748 JUnitTestCase.assertNotNull(declaration.leftBracket);
618 EngineTestCase.assertSize(0, declaration.members); 749 EngineTestCase.assertSize(0, declaration.members);
619 JUnitTestCase.assertNotNull(declaration.rightBracket); 750 JUnitTestCase.assertNotNull(declaration.rightBracket);
620 } 751 }
752
621 void test_parseClassDeclaration_implements() { 753 void test_parseClassDeclaration_implements() {
622 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A implements C {}"); 754 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A implements C {}");
623 JUnitTestCase.assertNull(declaration.documentationComment); 755 JUnitTestCase.assertNull(declaration.documentationComment);
624 JUnitTestCase.assertNull(declaration.abstractKeyword); 756 JUnitTestCase.assertNull(declaration.abstractKeyword);
625 JUnitTestCase.assertNull(declaration.extendsClause); 757 JUnitTestCase.assertNull(declaration.extendsClause);
626 JUnitTestCase.assertNotNull(declaration.implementsClause); 758 JUnitTestCase.assertNotNull(declaration.implementsClause);
627 JUnitTestCase.assertNotNull(declaration.classKeyword); 759 JUnitTestCase.assertNotNull(declaration.classKeyword);
628 JUnitTestCase.assertNotNull(declaration.leftBracket); 760 JUnitTestCase.assertNotNull(declaration.leftBracket);
629 JUnitTestCase.assertNotNull(declaration.name); 761 JUnitTestCase.assertNotNull(declaration.name);
630 EngineTestCase.assertSize(0, declaration.members); 762 EngineTestCase.assertSize(0, declaration.members);
631 JUnitTestCase.assertNotNull(declaration.rightBracket); 763 JUnitTestCase.assertNotNull(declaration.rightBracket);
632 JUnitTestCase.assertNull(declaration.typeParameters); 764 JUnitTestCase.assertNull(declaration.typeParameters);
633 } 765 }
766
634 void test_parseClassDeclaration_native() { 767 void test_parseClassDeclaration_native() {
635 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}"); 768 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A native 'nativeValue' {}");
636 NativeClause nativeClause = declaration.nativeClause; 769 NativeClause nativeClause = declaration.nativeClause;
637 JUnitTestCase.assertNotNull(nativeClause); 770 JUnitTestCase.assertNotNull(nativeClause);
638 JUnitTestCase.assertNotNull(nativeClause.keyword); 771 JUnitTestCase.assertNotNull(nativeClause.keyword);
639 JUnitTestCase.assertEquals("nativeValue", nativeClause.name.stringValue); 772 JUnitTestCase.assertEquals("nativeValue", nativeClause.name.stringValue);
640 JUnitTestCase.assertSame(nativeClause.keyword, nativeClause.beginToken); 773 JUnitTestCase.assertSame(nativeClause.keyword, nativeClause.beginToken);
641 JUnitTestCase.assertSame(nativeClause.name.endToken, nativeClause.endToken); 774 JUnitTestCase.assertSame(nativeClause.name.endToken, nativeClause.endToken);
642 } 775 }
776
643 void test_parseClassDeclaration_nonEmpty() { 777 void test_parseClassDeclaration_nonEmpty() {
644 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}"); 778 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A {var f;}");
645 JUnitTestCase.assertNull(declaration.documentationComment); 779 JUnitTestCase.assertNull(declaration.documentationComment);
646 JUnitTestCase.assertNull(declaration.abstractKeyword); 780 JUnitTestCase.assertNull(declaration.abstractKeyword);
647 JUnitTestCase.assertNull(declaration.extendsClause); 781 JUnitTestCase.assertNull(declaration.extendsClause);
648 JUnitTestCase.assertNull(declaration.implementsClause); 782 JUnitTestCase.assertNull(declaration.implementsClause);
649 JUnitTestCase.assertNotNull(declaration.classKeyword); 783 JUnitTestCase.assertNotNull(declaration.classKeyword);
650 JUnitTestCase.assertNotNull(declaration.leftBracket); 784 JUnitTestCase.assertNotNull(declaration.leftBracket);
651 JUnitTestCase.assertNotNull(declaration.name); 785 JUnitTestCase.assertNotNull(declaration.name);
652 EngineTestCase.assertSize(1, declaration.members); 786 EngineTestCase.assertSize(1, declaration.members);
653 JUnitTestCase.assertNotNull(declaration.rightBracket); 787 JUnitTestCase.assertNotNull(declaration.rightBracket);
654 JUnitTestCase.assertNull(declaration.typeParameters); 788 JUnitTestCase.assertNull(declaration.typeParameters);
655 } 789 }
790
656 void test_parseClassDeclaration_typeAlias_implementsC() { 791 void test_parseClassDeclaration_typeAlias_implementsC() {
657 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B implements C;" ); 792 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B implements C;" );
658 JUnitTestCase.assertNotNull(typeAlias.keyword); 793 JUnitTestCase.assertNotNull(typeAlias.keyword);
659 JUnitTestCase.assertNotNull(typeAlias.name); 794 JUnitTestCase.assertNotNull(typeAlias.name);
660 JUnitTestCase.assertNull(typeAlias.typeParameters); 795 JUnitTestCase.assertNull(typeAlias.typeParameters);
661 JUnitTestCase.assertNotNull(typeAlias.withClause); 796 JUnitTestCase.assertNotNull(typeAlias.withClause);
662 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 797 JUnitTestCase.assertNotNull(typeAlias.implementsClause);
663 JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword); 798 JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword);
664 JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length); 799 JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length);
665 JUnitTestCase.assertNotNull(typeAlias.semicolon); 800 JUnitTestCase.assertNotNull(typeAlias.semicolon);
666 } 801 }
802
667 void test_parseClassDeclaration_typeAlias_withB() { 803 void test_parseClassDeclaration_typeAlias_withB() {
668 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B;"); 804 ClassTypeAlias typeAlias = ParserTestCase.parse("parseClassDeclaration", <Ob ject> [emptyCommentAndMetadata(), null], "class A = Object with B;");
669 JUnitTestCase.assertNotNull(typeAlias.keyword); 805 JUnitTestCase.assertNotNull(typeAlias.keyword);
670 JUnitTestCase.assertNotNull(typeAlias.name); 806 JUnitTestCase.assertNotNull(typeAlias.name);
671 JUnitTestCase.assertNull(typeAlias.typeParameters); 807 JUnitTestCase.assertNull(typeAlias.typeParameters);
672 JUnitTestCase.assertNotNull(typeAlias.withClause); 808 JUnitTestCase.assertNotNull(typeAlias.withClause);
673 JUnitTestCase.assertNotNull(typeAlias.withClause.withKeyword); 809 JUnitTestCase.assertNotNull(typeAlias.withClause.withKeyword);
674 JUnitTestCase.assertEquals(1, typeAlias.withClause.mixinTypes.length); 810 JUnitTestCase.assertEquals(1, typeAlias.withClause.mixinTypes.length);
675 JUnitTestCase.assertNull(typeAlias.implementsClause); 811 JUnitTestCase.assertNull(typeAlias.implementsClause);
676 JUnitTestCase.assertNotNull(typeAlias.semicolon); 812 JUnitTestCase.assertNotNull(typeAlias.semicolon);
677 } 813 }
814
678 void test_parseClassDeclaration_typeParameters() { 815 void test_parseClassDeclaration_typeParameters() {
679 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}"); 816 ClassDeclaration declaration = ParserTestCase.parse("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class A<B> {}");
680 JUnitTestCase.assertNull(declaration.documentationComment); 817 JUnitTestCase.assertNull(declaration.documentationComment);
681 JUnitTestCase.assertNull(declaration.abstractKeyword); 818 JUnitTestCase.assertNull(declaration.abstractKeyword);
682 JUnitTestCase.assertNull(declaration.extendsClause); 819 JUnitTestCase.assertNull(declaration.extendsClause);
683 JUnitTestCase.assertNull(declaration.implementsClause); 820 JUnitTestCase.assertNull(declaration.implementsClause);
684 JUnitTestCase.assertNotNull(declaration.classKeyword); 821 JUnitTestCase.assertNotNull(declaration.classKeyword);
685 JUnitTestCase.assertNotNull(declaration.leftBracket); 822 JUnitTestCase.assertNotNull(declaration.leftBracket);
686 JUnitTestCase.assertNotNull(declaration.name); 823 JUnitTestCase.assertNotNull(declaration.name);
687 EngineTestCase.assertSize(0, declaration.members); 824 EngineTestCase.assertSize(0, declaration.members);
688 JUnitTestCase.assertNotNull(declaration.rightBracket); 825 JUnitTestCase.assertNotNull(declaration.rightBracket);
689 JUnitTestCase.assertNotNull(declaration.typeParameters); 826 JUnitTestCase.assertNotNull(declaration.typeParameters);
690 EngineTestCase.assertSize(1, declaration.typeParameters.typeParameters); 827 EngineTestCase.assertSize(1, declaration.typeParameters.typeParameters);
691 } 828 }
829
692 void test_parseClassMember_constructor_withInitializers() { 830 void test_parseClassMember_constructor_withInitializers() {
693 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}"); 831 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "C(_, _\$, this.__) : _a = _ + _\$ {}");
694 JUnitTestCase.assertNotNull(constructor.body); 832 JUnitTestCase.assertNotNull(constructor.body);
695 JUnitTestCase.assertNotNull(constructor.separator); 833 JUnitTestCase.assertNotNull(constructor.separator);
696 JUnitTestCase.assertNull(constructor.externalKeyword); 834 JUnitTestCase.assertNull(constructor.externalKeyword);
697 JUnitTestCase.assertNull(constructor.constKeyword); 835 JUnitTestCase.assertNull(constructor.constKeyword);
698 JUnitTestCase.assertNull(constructor.factoryKeyword); 836 JUnitTestCase.assertNull(constructor.factoryKeyword);
699 JUnitTestCase.assertNull(constructor.name); 837 JUnitTestCase.assertNull(constructor.name);
700 JUnitTestCase.assertNotNull(constructor.parameters); 838 JUnitTestCase.assertNotNull(constructor.parameters);
701 JUnitTestCase.assertNull(constructor.period); 839 JUnitTestCase.assertNull(constructor.period);
702 JUnitTestCase.assertNotNull(constructor.returnType); 840 JUnitTestCase.assertNotNull(constructor.returnType);
703 EngineTestCase.assertSize(1, constructor.initializers); 841 EngineTestCase.assertSize(1, constructor.initializers);
704 } 842 }
843
705 void test_parseClassMember_field_instance_prefixedType() { 844 void test_parseClassMember_field_instance_prefixedType() {
706 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;"); 845 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "p.A f;");
707 JUnitTestCase.assertNull(field.documentationComment); 846 JUnitTestCase.assertNull(field.documentationComment);
708 EngineTestCase.assertSize(0, field.metadata); 847 EngineTestCase.assertSize(0, field.metadata);
709 JUnitTestCase.assertNull(field.staticKeyword); 848 JUnitTestCase.assertNull(field.staticKeyword);
710 VariableDeclarationList list = field.fields; 849 VariableDeclarationList list = field.fields;
711 JUnitTestCase.assertNotNull(list); 850 JUnitTestCase.assertNotNull(list);
712 NodeList<VariableDeclaration> variables = list.variables; 851 NodeList<VariableDeclaration> variables = list.variables;
713 EngineTestCase.assertSize(1, variables); 852 EngineTestCase.assertSize(1, variables);
714 VariableDeclaration variable = variables[0]; 853 VariableDeclaration variable = variables[0];
715 JUnitTestCase.assertNotNull(variable.name); 854 JUnitTestCase.assertNotNull(variable.name);
716 } 855 }
856
717 void test_parseClassMember_field_namedGet() { 857 void test_parseClassMember_field_namedGet() {
718 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;"); 858 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var get;");
719 JUnitTestCase.assertNull(field.documentationComment); 859 JUnitTestCase.assertNull(field.documentationComment);
720 EngineTestCase.assertSize(0, field.metadata); 860 EngineTestCase.assertSize(0, field.metadata);
721 JUnitTestCase.assertNull(field.staticKeyword); 861 JUnitTestCase.assertNull(field.staticKeyword);
722 VariableDeclarationList list = field.fields; 862 VariableDeclarationList list = field.fields;
723 JUnitTestCase.assertNotNull(list); 863 JUnitTestCase.assertNotNull(list);
724 NodeList<VariableDeclaration> variables = list.variables; 864 NodeList<VariableDeclaration> variables = list.variables;
725 EngineTestCase.assertSize(1, variables); 865 EngineTestCase.assertSize(1, variables);
726 VariableDeclaration variable = variables[0]; 866 VariableDeclaration variable = variables[0];
727 JUnitTestCase.assertNotNull(variable.name); 867 JUnitTestCase.assertNotNull(variable.name);
728 } 868 }
869
729 void test_parseClassMember_field_namedOperator() { 870 void test_parseClassMember_field_namedOperator() {
730 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;"); 871 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator;");
731 JUnitTestCase.assertNull(field.documentationComment); 872 JUnitTestCase.assertNull(field.documentationComment);
732 EngineTestCase.assertSize(0, field.metadata); 873 EngineTestCase.assertSize(0, field.metadata);
733 JUnitTestCase.assertNull(field.staticKeyword); 874 JUnitTestCase.assertNull(field.staticKeyword);
734 VariableDeclarationList list = field.fields; 875 VariableDeclarationList list = field.fields;
735 JUnitTestCase.assertNotNull(list); 876 JUnitTestCase.assertNotNull(list);
736 NodeList<VariableDeclaration> variables = list.variables; 877 NodeList<VariableDeclaration> variables = list.variables;
737 EngineTestCase.assertSize(1, variables); 878 EngineTestCase.assertSize(1, variables);
738 VariableDeclaration variable = variables[0]; 879 VariableDeclaration variable = variables[0];
739 JUnitTestCase.assertNotNull(variable.name); 880 JUnitTestCase.assertNotNull(variable.name);
740 } 881 }
882
883 void test_parseClassMember_field_namedOperator_withAssignment() {
884 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var operator = (5);");
885 JUnitTestCase.assertNull(field.documentationComment);
886 EngineTestCase.assertSize(0, field.metadata);
887 JUnitTestCase.assertNull(field.staticKeyword);
888 VariableDeclarationList list = field.fields;
889 JUnitTestCase.assertNotNull(list);
890 NodeList<VariableDeclaration> variables = list.variables;
891 EngineTestCase.assertSize(1, variables);
892 VariableDeclaration variable = variables[0];
893 JUnitTestCase.assertNotNull(variable.name);
894 JUnitTestCase.assertNotNull(variable.initializer);
895 }
896
741 void test_parseClassMember_field_namedSet() { 897 void test_parseClassMember_field_namedSet() {
742 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;"); 898 FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> [ "C"], "var set;");
743 JUnitTestCase.assertNull(field.documentationComment); 899 JUnitTestCase.assertNull(field.documentationComment);
744 EngineTestCase.assertSize(0, field.metadata); 900 EngineTestCase.assertSize(0, field.metadata);
745 JUnitTestCase.assertNull(field.staticKeyword); 901 JUnitTestCase.assertNull(field.staticKeyword);
746 VariableDeclarationList list = field.fields; 902 VariableDeclarationList list = field.fields;
747 JUnitTestCase.assertNotNull(list); 903 JUnitTestCase.assertNotNull(list);
748 NodeList<VariableDeclaration> variables = list.variables; 904 NodeList<VariableDeclaration> variables = list.variables;
749 EngineTestCase.assertSize(1, variables); 905 EngineTestCase.assertSize(1, variables);
750 VariableDeclaration variable = variables[0]; 906 VariableDeclaration variable = variables[0];
751 JUnitTestCase.assertNotNull(variable.name); 907 JUnitTestCase.assertNotNull(variable.name);
752 } 908 }
909
753 void test_parseClassMember_getter_void() { 910 void test_parseClassMember_getter_void() {
754 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}"); 911 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get g {}");
755 JUnitTestCase.assertNull(method.documentationComment); 912 JUnitTestCase.assertNull(method.documentationComment);
756 JUnitTestCase.assertNull(method.externalKeyword); 913 JUnitTestCase.assertNull(method.externalKeyword);
757 JUnitTestCase.assertNull(method.modifierKeyword); 914 JUnitTestCase.assertNull(method.modifierKeyword);
758 JUnitTestCase.assertNotNull(method.propertyKeyword); 915 JUnitTestCase.assertNotNull(method.propertyKeyword);
759 JUnitTestCase.assertNotNull(method.returnType); 916 JUnitTestCase.assertNotNull(method.returnType);
760 JUnitTestCase.assertNotNull(method.name); 917 JUnitTestCase.assertNotNull(method.name);
761 JUnitTestCase.assertNull(method.operatorKeyword); 918 JUnitTestCase.assertNull(method.operatorKeyword);
762 JUnitTestCase.assertNotNull(method.body); 919 JUnitTestCase.assertNotNull(method.body);
763 } 920 }
921
764 void test_parseClassMember_method_external() { 922 void test_parseClassMember_method_external() {
765 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external m();"); 923 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external m();");
766 JUnitTestCase.assertNotNull(method.body); 924 JUnitTestCase.assertNotNull(method.body);
767 JUnitTestCase.assertNull(method.documentationComment); 925 JUnitTestCase.assertNull(method.documentationComment);
768 JUnitTestCase.assertNotNull(method.externalKeyword); 926 JUnitTestCase.assertNotNull(method.externalKeyword);
769 JUnitTestCase.assertNull(method.modifierKeyword); 927 JUnitTestCase.assertNull(method.modifierKeyword);
770 JUnitTestCase.assertNotNull(method.name); 928 JUnitTestCase.assertNotNull(method.name);
771 JUnitTestCase.assertNull(method.operatorKeyword); 929 JUnitTestCase.assertNull(method.operatorKeyword);
772 JUnitTestCase.assertNotNull(method.parameters); 930 JUnitTestCase.assertNotNull(method.parameters);
773 JUnitTestCase.assertNull(method.propertyKeyword); 931 JUnitTestCase.assertNull(method.propertyKeyword);
774 JUnitTestCase.assertNull(method.returnType); 932 JUnitTestCase.assertNull(method.returnType);
775 } 933 }
934
776 void test_parseClassMember_method_external_withTypeAndArgs() { 935 void test_parseClassMember_method_external_withTypeAndArgs() {
777 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external int m(int a);"); 936 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "external int m(int a);");
778 JUnitTestCase.assertNotNull(method.body); 937 JUnitTestCase.assertNotNull(method.body);
779 JUnitTestCase.assertNull(method.documentationComment); 938 JUnitTestCase.assertNull(method.documentationComment);
780 JUnitTestCase.assertNotNull(method.externalKeyword); 939 JUnitTestCase.assertNotNull(method.externalKeyword);
781 JUnitTestCase.assertNull(method.modifierKeyword); 940 JUnitTestCase.assertNull(method.modifierKeyword);
782 JUnitTestCase.assertNotNull(method.name); 941 JUnitTestCase.assertNotNull(method.name);
783 JUnitTestCase.assertNull(method.operatorKeyword); 942 JUnitTestCase.assertNull(method.operatorKeyword);
784 JUnitTestCase.assertNotNull(method.parameters); 943 JUnitTestCase.assertNotNull(method.parameters);
785 JUnitTestCase.assertNull(method.propertyKeyword); 944 JUnitTestCase.assertNull(method.propertyKeyword);
786 JUnitTestCase.assertNotNull(method.returnType); 945 JUnitTestCase.assertNotNull(method.returnType);
787 } 946 }
947
788 void test_parseClassMember_method_get_noType() { 948 void test_parseClassMember_method_get_noType() {
789 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "get() {}"); 949 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "get() {}");
790 JUnitTestCase.assertNull(method.documentationComment); 950 JUnitTestCase.assertNull(method.documentationComment);
791 JUnitTestCase.assertNull(method.externalKeyword); 951 JUnitTestCase.assertNull(method.externalKeyword);
792 JUnitTestCase.assertNull(method.modifierKeyword); 952 JUnitTestCase.assertNull(method.modifierKeyword);
793 JUnitTestCase.assertNull(method.propertyKeyword); 953 JUnitTestCase.assertNull(method.propertyKeyword);
794 JUnitTestCase.assertNull(method.returnType); 954 JUnitTestCase.assertNull(method.returnType);
795 JUnitTestCase.assertNotNull(method.name); 955 JUnitTestCase.assertNotNull(method.name);
796 JUnitTestCase.assertNull(method.operatorKeyword); 956 JUnitTestCase.assertNull(method.operatorKeyword);
797 JUnitTestCase.assertNotNull(method.parameters); 957 JUnitTestCase.assertNotNull(method.parameters);
798 JUnitTestCase.assertNotNull(method.body); 958 JUnitTestCase.assertNotNull(method.body);
799 } 959 }
960
800 void test_parseClassMember_method_get_type() { 961 void test_parseClassMember_method_get_type() {
801 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int get() {}"); 962 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int get() {}");
802 JUnitTestCase.assertNull(method.documentationComment); 963 JUnitTestCase.assertNull(method.documentationComment);
803 JUnitTestCase.assertNull(method.externalKeyword); 964 JUnitTestCase.assertNull(method.externalKeyword);
804 JUnitTestCase.assertNull(method.modifierKeyword); 965 JUnitTestCase.assertNull(method.modifierKeyword);
805 JUnitTestCase.assertNull(method.propertyKeyword); 966 JUnitTestCase.assertNull(method.propertyKeyword);
806 JUnitTestCase.assertNotNull(method.returnType); 967 JUnitTestCase.assertNotNull(method.returnType);
807 JUnitTestCase.assertNotNull(method.name); 968 JUnitTestCase.assertNotNull(method.name);
808 JUnitTestCase.assertNull(method.operatorKeyword); 969 JUnitTestCase.assertNull(method.operatorKeyword);
809 JUnitTestCase.assertNotNull(method.parameters); 970 JUnitTestCase.assertNotNull(method.parameters);
810 JUnitTestCase.assertNotNull(method.body); 971 JUnitTestCase.assertNotNull(method.body);
811 } 972 }
973
812 void test_parseClassMember_method_get_void() { 974 void test_parseClassMember_method_get_void() {
813 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get() {}"); 975 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void get() {}");
814 JUnitTestCase.assertNull(method.documentationComment); 976 JUnitTestCase.assertNull(method.documentationComment);
815 JUnitTestCase.assertNull(method.externalKeyword); 977 JUnitTestCase.assertNull(method.externalKeyword);
816 JUnitTestCase.assertNull(method.modifierKeyword); 978 JUnitTestCase.assertNull(method.modifierKeyword);
817 JUnitTestCase.assertNull(method.propertyKeyword); 979 JUnitTestCase.assertNull(method.propertyKeyword);
818 JUnitTestCase.assertNotNull(method.returnType); 980 JUnitTestCase.assertNotNull(method.returnType);
819 JUnitTestCase.assertNotNull(method.name); 981 JUnitTestCase.assertNotNull(method.name);
820 JUnitTestCase.assertNull(method.operatorKeyword); 982 JUnitTestCase.assertNull(method.operatorKeyword);
821 JUnitTestCase.assertNotNull(method.parameters); 983 JUnitTestCase.assertNotNull(method.parameters);
822 JUnitTestCase.assertNotNull(method.body); 984 JUnitTestCase.assertNotNull(method.body);
823 } 985 }
986
824 void test_parseClassMember_method_operator_noType() { 987 void test_parseClassMember_method_operator_noType() {
825 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "operator() {}"); 988 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "operator() {}");
826 JUnitTestCase.assertNull(method.documentationComment); 989 JUnitTestCase.assertNull(method.documentationComment);
827 JUnitTestCase.assertNull(method.externalKeyword); 990 JUnitTestCase.assertNull(method.externalKeyword);
828 JUnitTestCase.assertNull(method.modifierKeyword); 991 JUnitTestCase.assertNull(method.modifierKeyword);
829 JUnitTestCase.assertNull(method.propertyKeyword); 992 JUnitTestCase.assertNull(method.propertyKeyword);
830 JUnitTestCase.assertNull(method.returnType); 993 JUnitTestCase.assertNull(method.returnType);
831 JUnitTestCase.assertNotNull(method.name); 994 JUnitTestCase.assertNotNull(method.name);
832 JUnitTestCase.assertNull(method.operatorKeyword); 995 JUnitTestCase.assertNull(method.operatorKeyword);
833 JUnitTestCase.assertNotNull(method.parameters); 996 JUnitTestCase.assertNotNull(method.parameters);
834 JUnitTestCase.assertNotNull(method.body); 997 JUnitTestCase.assertNotNull(method.body);
835 } 998 }
999
836 void test_parseClassMember_method_operator_type() { 1000 void test_parseClassMember_method_operator_type() {
837 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator() {}"); 1001 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator() {}");
838 JUnitTestCase.assertNull(method.documentationComment); 1002 JUnitTestCase.assertNull(method.documentationComment);
839 JUnitTestCase.assertNull(method.externalKeyword); 1003 JUnitTestCase.assertNull(method.externalKeyword);
840 JUnitTestCase.assertNull(method.modifierKeyword); 1004 JUnitTestCase.assertNull(method.modifierKeyword);
841 JUnitTestCase.assertNull(method.propertyKeyword); 1005 JUnitTestCase.assertNull(method.propertyKeyword);
842 JUnitTestCase.assertNotNull(method.returnType); 1006 JUnitTestCase.assertNotNull(method.returnType);
843 JUnitTestCase.assertNotNull(method.name); 1007 JUnitTestCase.assertNotNull(method.name);
844 JUnitTestCase.assertNull(method.operatorKeyword); 1008 JUnitTestCase.assertNull(method.operatorKeyword);
845 JUnitTestCase.assertNotNull(method.parameters); 1009 JUnitTestCase.assertNotNull(method.parameters);
846 JUnitTestCase.assertNotNull(method.body); 1010 JUnitTestCase.assertNotNull(method.body);
847 } 1011 }
1012
848 void test_parseClassMember_method_operator_void() { 1013 void test_parseClassMember_method_operator_void() {
849 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void operator() {}"); 1014 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void operator() {}");
850 JUnitTestCase.assertNull(method.documentationComment); 1015 JUnitTestCase.assertNull(method.documentationComment);
851 JUnitTestCase.assertNull(method.externalKeyword); 1016 JUnitTestCase.assertNull(method.externalKeyword);
852 JUnitTestCase.assertNull(method.modifierKeyword); 1017 JUnitTestCase.assertNull(method.modifierKeyword);
853 JUnitTestCase.assertNull(method.propertyKeyword); 1018 JUnitTestCase.assertNull(method.propertyKeyword);
854 JUnitTestCase.assertNotNull(method.returnType); 1019 JUnitTestCase.assertNotNull(method.returnType);
855 JUnitTestCase.assertNotNull(method.name); 1020 JUnitTestCase.assertNotNull(method.name);
856 JUnitTestCase.assertNull(method.operatorKeyword); 1021 JUnitTestCase.assertNull(method.operatorKeyword);
857 JUnitTestCase.assertNotNull(method.parameters); 1022 JUnitTestCase.assertNotNull(method.parameters);
858 JUnitTestCase.assertNotNull(method.body); 1023 JUnitTestCase.assertNotNull(method.body);
859 } 1024 }
1025
860 void test_parseClassMember_method_returnType_parameterized() { 1026 void test_parseClassMember_method_returnType_parameterized() {
861 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A m() {}"); 1027 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A m() {}");
862 JUnitTestCase.assertNull(method.documentationComment); 1028 JUnitTestCase.assertNull(method.documentationComment);
863 JUnitTestCase.assertNull(method.externalKeyword); 1029 JUnitTestCase.assertNull(method.externalKeyword);
864 JUnitTestCase.assertNull(method.modifierKeyword); 1030 JUnitTestCase.assertNull(method.modifierKeyword);
865 JUnitTestCase.assertNull(method.propertyKeyword); 1031 JUnitTestCase.assertNull(method.propertyKeyword);
866 JUnitTestCase.assertNotNull(method.returnType); 1032 JUnitTestCase.assertNotNull(method.returnType);
867 JUnitTestCase.assertNotNull(method.name); 1033 JUnitTestCase.assertNotNull(method.name);
868 JUnitTestCase.assertNull(method.operatorKeyword); 1034 JUnitTestCase.assertNull(method.operatorKeyword);
869 JUnitTestCase.assertNotNull(method.parameters); 1035 JUnitTestCase.assertNotNull(method.parameters);
870 JUnitTestCase.assertNotNull(method.body); 1036 JUnitTestCase.assertNotNull(method.body);
871 } 1037 }
1038
872 void test_parseClassMember_method_set_noType() { 1039 void test_parseClassMember_method_set_noType() {
873 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "set() {}"); 1040 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "set() {}");
874 JUnitTestCase.assertNull(method.documentationComment); 1041 JUnitTestCase.assertNull(method.documentationComment);
875 JUnitTestCase.assertNull(method.externalKeyword); 1042 JUnitTestCase.assertNull(method.externalKeyword);
876 JUnitTestCase.assertNull(method.modifierKeyword); 1043 JUnitTestCase.assertNull(method.modifierKeyword);
877 JUnitTestCase.assertNull(method.propertyKeyword); 1044 JUnitTestCase.assertNull(method.propertyKeyword);
878 JUnitTestCase.assertNull(method.returnType); 1045 JUnitTestCase.assertNull(method.returnType);
879 JUnitTestCase.assertNotNull(method.name); 1046 JUnitTestCase.assertNotNull(method.name);
880 JUnitTestCase.assertNull(method.operatorKeyword); 1047 JUnitTestCase.assertNull(method.operatorKeyword);
881 JUnitTestCase.assertNotNull(method.parameters); 1048 JUnitTestCase.assertNotNull(method.parameters);
882 JUnitTestCase.assertNotNull(method.body); 1049 JUnitTestCase.assertNotNull(method.body);
883 } 1050 }
1051
884 void test_parseClassMember_method_set_type() { 1052 void test_parseClassMember_method_set_type() {
885 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int set() {}"); 1053 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int set() {}");
886 JUnitTestCase.assertNull(method.documentationComment); 1054 JUnitTestCase.assertNull(method.documentationComment);
887 JUnitTestCase.assertNull(method.externalKeyword); 1055 JUnitTestCase.assertNull(method.externalKeyword);
888 JUnitTestCase.assertNull(method.modifierKeyword); 1056 JUnitTestCase.assertNull(method.modifierKeyword);
889 JUnitTestCase.assertNull(method.propertyKeyword); 1057 JUnitTestCase.assertNull(method.propertyKeyword);
890 JUnitTestCase.assertNotNull(method.returnType); 1058 JUnitTestCase.assertNotNull(method.returnType);
891 JUnitTestCase.assertNotNull(method.name); 1059 JUnitTestCase.assertNotNull(method.name);
892 JUnitTestCase.assertNull(method.operatorKeyword); 1060 JUnitTestCase.assertNull(method.operatorKeyword);
893 JUnitTestCase.assertNotNull(method.parameters); 1061 JUnitTestCase.assertNotNull(method.parameters);
894 JUnitTestCase.assertNotNull(method.body); 1062 JUnitTestCase.assertNotNull(method.body);
895 } 1063 }
1064
896 void test_parseClassMember_method_set_void() { 1065 void test_parseClassMember_method_set_void() {
897 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void set() {}"); 1066 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "void set() {}");
898 JUnitTestCase.assertNull(method.documentationComment); 1067 JUnitTestCase.assertNull(method.documentationComment);
899 JUnitTestCase.assertNull(method.externalKeyword); 1068 JUnitTestCase.assertNull(method.externalKeyword);
900 JUnitTestCase.assertNull(method.modifierKeyword); 1069 JUnitTestCase.assertNull(method.modifierKeyword);
901 JUnitTestCase.assertNull(method.propertyKeyword); 1070 JUnitTestCase.assertNull(method.propertyKeyword);
902 JUnitTestCase.assertNotNull(method.returnType); 1071 JUnitTestCase.assertNotNull(method.returnType);
903 JUnitTestCase.assertNotNull(method.name); 1072 JUnitTestCase.assertNotNull(method.name);
904 JUnitTestCase.assertNull(method.operatorKeyword); 1073 JUnitTestCase.assertNull(method.operatorKeyword);
905 JUnitTestCase.assertNotNull(method.parameters); 1074 JUnitTestCase.assertNotNull(method.parameters);
906 JUnitTestCase.assertNotNull(method.body); 1075 JUnitTestCase.assertNotNull(method.body);
907 } 1076 }
1077
908 void test_parseClassMember_operator_index() { 1078 void test_parseClassMember_operator_index() {
909 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator [](int i) {}"); 1079 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator [](int i) {}");
910 JUnitTestCase.assertNull(method.documentationComment); 1080 JUnitTestCase.assertNull(method.documentationComment);
911 JUnitTestCase.assertNull(method.externalKeyword); 1081 JUnitTestCase.assertNull(method.externalKeyword);
912 JUnitTestCase.assertNull(method.modifierKeyword); 1082 JUnitTestCase.assertNull(method.modifierKeyword);
913 JUnitTestCase.assertNull(method.propertyKeyword); 1083 JUnitTestCase.assertNull(method.propertyKeyword);
914 JUnitTestCase.assertNotNull(method.returnType); 1084 JUnitTestCase.assertNotNull(method.returnType);
915 JUnitTestCase.assertNotNull(method.name); 1085 JUnitTestCase.assertNotNull(method.name);
916 JUnitTestCase.assertNotNull(method.operatorKeyword); 1086 JUnitTestCase.assertNotNull(method.operatorKeyword);
917 JUnitTestCase.assertNotNull(method.parameters); 1087 JUnitTestCase.assertNotNull(method.parameters);
918 JUnitTestCase.assertNotNull(method.body); 1088 JUnitTestCase.assertNotNull(method.body);
919 } 1089 }
1090
920 void test_parseClassMember_operator_indexAssign() { 1091 void test_parseClassMember_operator_indexAssign() {
921 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator []=(int i) {}"); 1092 MethodDeclaration method = ParserTestCase.parse("parseClassMember", <Object> ["C"], "int operator []=(int i) {}");
922 JUnitTestCase.assertNull(method.documentationComment); 1093 JUnitTestCase.assertNull(method.documentationComment);
923 JUnitTestCase.assertNull(method.externalKeyword); 1094 JUnitTestCase.assertNull(method.externalKeyword);
924 JUnitTestCase.assertNull(method.modifierKeyword); 1095 JUnitTestCase.assertNull(method.modifierKeyword);
925 JUnitTestCase.assertNull(method.propertyKeyword); 1096 JUnitTestCase.assertNull(method.propertyKeyword);
926 JUnitTestCase.assertNotNull(method.returnType); 1097 JUnitTestCase.assertNotNull(method.returnType);
927 JUnitTestCase.assertNotNull(method.name); 1098 JUnitTestCase.assertNotNull(method.name);
928 JUnitTestCase.assertNotNull(method.operatorKeyword); 1099 JUnitTestCase.assertNotNull(method.operatorKeyword);
929 JUnitTestCase.assertNotNull(method.parameters); 1100 JUnitTestCase.assertNotNull(method.parameters);
930 JUnitTestCase.assertNotNull(method.body); 1101 JUnitTestCase.assertNotNull(method.body);
931 } 1102 }
1103
932 void test_parseClassMember_redirectingFactory_const() { 1104 void test_parseClassMember_redirectingFactory_const() {
933 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;"); 1105 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "const factory C() = B;");
934 JUnitTestCase.assertNull(constructor.externalKeyword); 1106 JUnitTestCase.assertNull(constructor.externalKeyword);
935 JUnitTestCase.assertNotNull(constructor.constKeyword); 1107 JUnitTestCase.assertNotNull(constructor.constKeyword);
936 JUnitTestCase.assertNotNull(constructor.factoryKeyword); 1108 JUnitTestCase.assertNotNull(constructor.factoryKeyword);
937 JUnitTestCase.assertNotNull(constructor.returnType); 1109 JUnitTestCase.assertNotNull(constructor.returnType);
938 JUnitTestCase.assertNull(constructor.period); 1110 JUnitTestCase.assertNull(constructor.period);
939 JUnitTestCase.assertNull(constructor.name); 1111 JUnitTestCase.assertNull(constructor.name);
940 JUnitTestCase.assertNotNull(constructor.parameters); 1112 JUnitTestCase.assertNotNull(constructor.parameters);
941 JUnitTestCase.assertNotNull(constructor.separator); 1113 JUnitTestCase.assertNotNull(constructor.separator);
942 EngineTestCase.assertSize(0, constructor.initializers); 1114 EngineTestCase.assertSize(0, constructor.initializers);
943 JUnitTestCase.assertNotNull(constructor.redirectedConstructor); 1115 JUnitTestCase.assertNotNull(constructor.redirectedConstructor);
944 JUnitTestCase.assertNotNull(constructor.body); 1116 JUnitTestCase.assertNotNull(constructor.body);
945 } 1117 }
1118
946 void test_parseClassMember_redirectingFactory_nonConst() { 1119 void test_parseClassMember_redirectingFactory_nonConst() {
947 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;"); 1120 ConstructorDeclaration constructor = ParserTestCase.parse("parseClassMember" , <Object> ["C"], "factory C() = B;");
948 JUnitTestCase.assertNull(constructor.externalKeyword); 1121 JUnitTestCase.assertNull(constructor.externalKeyword);
949 JUnitTestCase.assertNull(constructor.constKeyword); 1122 JUnitTestCase.assertNull(constructor.constKeyword);
950 JUnitTestCase.assertNotNull(constructor.factoryKeyword); 1123 JUnitTestCase.assertNotNull(constructor.factoryKeyword);
951 JUnitTestCase.assertNotNull(constructor.returnType); 1124 JUnitTestCase.assertNotNull(constructor.returnType);
952 JUnitTestCase.assertNull(constructor.period); 1125 JUnitTestCase.assertNull(constructor.period);
953 JUnitTestCase.assertNull(constructor.name); 1126 JUnitTestCase.assertNull(constructor.name);
954 JUnitTestCase.assertNotNull(constructor.parameters); 1127 JUnitTestCase.assertNotNull(constructor.parameters);
955 JUnitTestCase.assertNotNull(constructor.separator); 1128 JUnitTestCase.assertNotNull(constructor.separator);
956 EngineTestCase.assertSize(0, constructor.initializers); 1129 EngineTestCase.assertSize(0, constructor.initializers);
957 JUnitTestCase.assertNotNull(constructor.redirectedConstructor); 1130 JUnitTestCase.assertNotNull(constructor.redirectedConstructor);
958 JUnitTestCase.assertNotNull(constructor.body); 1131 JUnitTestCase.assertNotNull(constructor.body);
959 } 1132 }
1133
960 void test_parseClassTypeAlias() { 1134 void test_parseClassTypeAlias() {
961 Token token = TokenFactory.token(Keyword.CLASS); 1135 Token token = TokenFactory.token(Keyword.CLASS);
962 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B;"); 1136 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B;");
963 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 1137 JUnitTestCase.assertNotNull(classTypeAlias.keyword);
964 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 1138 JUnitTestCase.assertEquals("A", classTypeAlias.name.name);
965 JUnitTestCase.assertNotNull(classTypeAlias.equals); 1139 JUnitTestCase.assertNotNull(classTypeAlias.equals);
966 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 1140 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword);
967 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 1141 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name);
968 JUnitTestCase.assertNull(classTypeAlias.withClause); 1142 JUnitTestCase.assertNull(classTypeAlias.withClause);
969 JUnitTestCase.assertNull(classTypeAlias.implementsClause); 1143 JUnitTestCase.assertNull(classTypeAlias.implementsClause);
970 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 1144 JUnitTestCase.assertNotNull(classTypeAlias.semicolon);
971 } 1145 }
1146
972 void test_parseClassTypeAlias_abstract() { 1147 void test_parseClassTypeAlias_abstract() {
973 Token token = TokenFactory.token(Keyword.CLASS); 1148 Token token = TokenFactory.token(Keyword.CLASS);
974 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = abstract B;"); 1149 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = abstract B;");
975 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 1150 JUnitTestCase.assertNotNull(classTypeAlias.keyword);
976 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 1151 JUnitTestCase.assertEquals("A", classTypeAlias.name.name);
977 JUnitTestCase.assertNotNull(classTypeAlias.equals); 1152 JUnitTestCase.assertNotNull(classTypeAlias.equals);
978 JUnitTestCase.assertNotNull(classTypeAlias.abstractKeyword); 1153 JUnitTestCase.assertNotNull(classTypeAlias.abstractKeyword);
979 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 1154 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name);
980 JUnitTestCase.assertNull(classTypeAlias.withClause); 1155 JUnitTestCase.assertNull(classTypeAlias.withClause);
981 JUnitTestCase.assertNull(classTypeAlias.implementsClause); 1156 JUnitTestCase.assertNull(classTypeAlias.implementsClause);
982 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 1157 JUnitTestCase.assertNotNull(classTypeAlias.semicolon);
983 } 1158 }
1159
984 void test_parseClassTypeAlias_implements() { 1160 void test_parseClassTypeAlias_implements() {
985 Token token = TokenFactory.token(Keyword.CLASS); 1161 Token token = TokenFactory.token(Keyword.CLASS);
986 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B implements C;"); 1162 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B implements C;");
987 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 1163 JUnitTestCase.assertNotNull(classTypeAlias.keyword);
988 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 1164 JUnitTestCase.assertEquals("A", classTypeAlias.name.name);
989 JUnitTestCase.assertNotNull(classTypeAlias.equals); 1165 JUnitTestCase.assertNotNull(classTypeAlias.equals);
990 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 1166 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword);
991 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 1167 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name);
992 JUnitTestCase.assertNull(classTypeAlias.withClause); 1168 JUnitTestCase.assertNull(classTypeAlias.withClause);
993 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause); 1169 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause);
994 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 1170 JUnitTestCase.assertNotNull(classTypeAlias.semicolon);
995 } 1171 }
1172
996 void test_parseClassTypeAlias_with() { 1173 void test_parseClassTypeAlias_with() {
997 Token token = TokenFactory.token(Keyword.CLASS); 1174 Token token = TokenFactory.token(Keyword.CLASS);
998 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B with C;"); 1175 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B with C;");
999 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 1176 JUnitTestCase.assertNotNull(classTypeAlias.keyword);
1000 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 1177 JUnitTestCase.assertEquals("A", classTypeAlias.name.name);
1001 JUnitTestCase.assertNotNull(classTypeAlias.equals); 1178 JUnitTestCase.assertNotNull(classTypeAlias.equals);
1002 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 1179 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword);
1003 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 1180 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name);
1004 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 1181 JUnitTestCase.assertNotNull(classTypeAlias.withClause);
1005 JUnitTestCase.assertNull(classTypeAlias.implementsClause); 1182 JUnitTestCase.assertNull(classTypeAlias.implementsClause);
1006 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 1183 JUnitTestCase.assertNotNull(classTypeAlias.semicolon);
1007 } 1184 }
1185
1008 void test_parseClassTypeAlias_with_implements() { 1186 void test_parseClassTypeAlias_with_implements() {
1009 Token token = TokenFactory.token(Keyword.CLASS); 1187 Token token = TokenFactory.token(Keyword.CLASS);
1010 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B with C implements D;"); 1188 ClassTypeAlias classTypeAlias = ParserTestCase.parse("parseClassTypeAlias", <Object> [emptyCommentAndMetadata(), token], "A = B with C implements D;");
1011 JUnitTestCase.assertNotNull(classTypeAlias.keyword); 1189 JUnitTestCase.assertNotNull(classTypeAlias.keyword);
1012 JUnitTestCase.assertEquals("A", classTypeAlias.name.name); 1190 JUnitTestCase.assertEquals("A", classTypeAlias.name.name);
1013 JUnitTestCase.assertNotNull(classTypeAlias.equals); 1191 JUnitTestCase.assertNotNull(classTypeAlias.equals);
1014 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword); 1192 JUnitTestCase.assertNull(classTypeAlias.abstractKeyword);
1015 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name); 1193 JUnitTestCase.assertNotNullMsg("B", classTypeAlias.superclass.name.name);
1016 JUnitTestCase.assertNotNull(classTypeAlias.withClause); 1194 JUnitTestCase.assertNotNull(classTypeAlias.withClause);
1017 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause); 1195 JUnitTestCase.assertNotNull(classTypeAlias.implementsClause);
1018 JUnitTestCase.assertNotNull(classTypeAlias.semicolon); 1196 JUnitTestCase.assertNotNull(classTypeAlias.semicolon);
1019 } 1197 }
1198
1020 void test_parseCombinators_h() { 1199 void test_parseCombinators_h() {
1021 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a;", []); 1200 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a;", []);
1022 EngineTestCase.assertSize(1, combinators); 1201 EngineTestCase.assertSize(1, combinators);
1023 HideCombinator combinator = combinators[0] as HideCombinator; 1202 HideCombinator combinator = combinators[0] as HideCombinator;
1024 JUnitTestCase.assertNotNull(combinator); 1203 JUnitTestCase.assertNotNull(combinator);
1025 JUnitTestCase.assertNotNull(combinator.keyword); 1204 JUnitTestCase.assertNotNull(combinator.keyword);
1026 EngineTestCase.assertSize(1, combinator.hiddenNames); 1205 EngineTestCase.assertSize(1, combinator.hiddenNames);
1027 } 1206 }
1207
1028 void test_parseCombinators_hs() { 1208 void test_parseCombinators_hs() {
1029 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a show b;", []); 1209 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a show b;", []);
1030 EngineTestCase.assertSize(2, combinators); 1210 EngineTestCase.assertSize(2, combinators);
1031 HideCombinator hideCombinator = combinators[0] as HideCombinator; 1211 HideCombinator hideCombinator = combinators[0] as HideCombinator;
1032 JUnitTestCase.assertNotNull(hideCombinator); 1212 JUnitTestCase.assertNotNull(hideCombinator);
1033 JUnitTestCase.assertNotNull(hideCombinator.keyword); 1213 JUnitTestCase.assertNotNull(hideCombinator.keyword);
1034 EngineTestCase.assertSize(1, hideCombinator.hiddenNames); 1214 EngineTestCase.assertSize(1, hideCombinator.hiddenNames);
1035 ShowCombinator showCombinator = combinators[1] as ShowCombinator; 1215 ShowCombinator showCombinator = combinators[1] as ShowCombinator;
1036 JUnitTestCase.assertNotNull(showCombinator); 1216 JUnitTestCase.assertNotNull(showCombinator);
1037 JUnitTestCase.assertNotNull(showCombinator.keyword); 1217 JUnitTestCase.assertNotNull(showCombinator.keyword);
1038 EngineTestCase.assertSize(1, showCombinator.shownNames); 1218 EngineTestCase.assertSize(1, showCombinator.shownNames);
1039 } 1219 }
1220
1040 void test_parseCombinators_hshs() { 1221 void test_parseCombinators_hshs() {
1041 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a show b hide c show d;", []); 1222 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "hi de a show b hide c show d;", []);
1042 EngineTestCase.assertSize(4, combinators); 1223 EngineTestCase.assertSize(4, combinators);
1043 } 1224 }
1225
1044 void test_parseCombinators_s() { 1226 void test_parseCombinators_s() {
1045 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "sh ow a;", []); 1227 List<Combinator> combinators = ParserTestCase.parse5("parseCombinators", "sh ow a;", []);
1046 EngineTestCase.assertSize(1, combinators); 1228 EngineTestCase.assertSize(1, combinators);
1047 ShowCombinator combinator = combinators[0] as ShowCombinator; 1229 ShowCombinator combinator = combinators[0] as ShowCombinator;
1048 JUnitTestCase.assertNotNull(combinator); 1230 JUnitTestCase.assertNotNull(combinator);
1049 JUnitTestCase.assertNotNull(combinator.keyword); 1231 JUnitTestCase.assertNotNull(combinator.keyword);
1050 EngineTestCase.assertSize(1, combinator.shownNames); 1232 EngineTestCase.assertSize(1, combinator.shownNames);
1051 } 1233 }
1234
1052 void test_parseCommentAndMetadata_c() { 1235 void test_parseCommentAndMetadata_c() {
1053 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ void", []); 1236 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ void", []);
1054 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1237 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1055 EngineTestCase.assertSize(0, commentAndMetadata.metadata); 1238 EngineTestCase.assertSize(0, commentAndMetadata.metadata);
1056 } 1239 }
1240
1057 void test_parseCommentAndMetadata_cmc() { 1241 void test_parseCommentAndMetadata_cmc() {
1058 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []); 1242 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ void", []);
1059 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1243 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1060 EngineTestCase.assertSize(1, commentAndMetadata.metadata); 1244 EngineTestCase.assertSize(1, commentAndMetadata.metadata);
1061 } 1245 }
1246
1062 void test_parseCommentAndMetadata_cmcm() { 1247 void test_parseCommentAndMetadata_cmcm() {
1063 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []); 1248 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A /** 2 */ @B void", []);
1064 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1249 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1065 EngineTestCase.assertSize(2, commentAndMetadata.metadata); 1250 EngineTestCase.assertSize(2, commentAndMetadata.metadata);
1066 } 1251 }
1252
1067 void test_parseCommentAndMetadata_cmm() { 1253 void test_parseCommentAndMetadata_cmm() {
1068 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A @B void", []); 1254 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "/** 1 */ @A @B void", []);
1069 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1255 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1070 EngineTestCase.assertSize(2, commentAndMetadata.metadata); 1256 EngineTestCase.assertSize(2, commentAndMetadata.metadata);
1071 } 1257 }
1258
1072 void test_parseCommentAndMetadata_m() { 1259 void test_parseCommentAndMetadata_m() {
1073 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A void", []); 1260 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A void", []);
1074 JUnitTestCase.assertNull(commentAndMetadata.comment); 1261 JUnitTestCase.assertNull(commentAndMetadata.comment);
1075 EngineTestCase.assertSize(1, commentAndMetadata.metadata); 1262 EngineTestCase.assertSize(1, commentAndMetadata.metadata);
1076 } 1263 }
1264
1077 void test_parseCommentAndMetadata_mcm() { 1265 void test_parseCommentAndMetadata_mcm() {
1078 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A /** 1 */ @B void", []); 1266 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A /** 1 */ @B void", []);
1079 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1267 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1080 EngineTestCase.assertSize(2, commentAndMetadata.metadata); 1268 EngineTestCase.assertSize(2, commentAndMetadata.metadata);
1081 } 1269 }
1270
1082 void test_parseCommentAndMetadata_mcmc() { 1271 void test_parseCommentAndMetadata_mcmc() {
1083 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []); 1272 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A /** 1 */ @B /** 2 */ void", []);
1084 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1273 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1085 EngineTestCase.assertSize(2, commentAndMetadata.metadata); 1274 EngineTestCase.assertSize(2, commentAndMetadata.metadata);
1086 } 1275 }
1276
1087 void test_parseCommentAndMetadata_mm() { 1277 void test_parseCommentAndMetadata_mm() {
1088 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A @B(x) void", []); 1278 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "@A @B(x) void", []);
1089 JUnitTestCase.assertNull(commentAndMetadata.comment); 1279 JUnitTestCase.assertNull(commentAndMetadata.comment);
1090 EngineTestCase.assertSize(2, commentAndMetadata.metadata); 1280 EngineTestCase.assertSize(2, commentAndMetadata.metadata);
1091 } 1281 }
1282
1092 void test_parseCommentAndMetadata_none() { 1283 void test_parseCommentAndMetadata_none() {
1093 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "void", []); 1284 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", "void", []);
1094 JUnitTestCase.assertNull(commentAndMetadata.comment); 1285 JUnitTestCase.assertNull(commentAndMetadata.comment);
1095 EngineTestCase.assertSize(0, commentAndMetadata.metadata); 1286 EngineTestCase.assertSize(0, commentAndMetadata.metadata);
1096 } 1287 }
1288
1097 void test_parseCommentAndMetadata_singleLine() { 1289 void test_parseCommentAndMetadata_singleLine() {
1098 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", EngineTestCase.createSource(["/// 1", "/// 2", "void"]), []); 1290 CommentAndMetadata commentAndMetadata = ParserTestCase.parse5("parseCommentA ndMetadata", EngineTestCase.createSource(["/// 1", "/// 2", "void"]), []);
1099 JUnitTestCase.assertNotNull(commentAndMetadata.comment); 1291 JUnitTestCase.assertNotNull(commentAndMetadata.comment);
1100 EngineTestCase.assertSize(0, commentAndMetadata.metadata); 1292 EngineTestCase.assertSize(0, commentAndMetadata.metadata);
1101 } 1293 }
1294
1102 void test_parseCommentReference_new_prefixed() { 1295 void test_parseCommentReference_new_prefixed() {
1103 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], ""); 1296 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a.b", 7], "");
1104 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(Pref ixedIdentifier, reference.identifier); 1297 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(Pref ixedIdentifier, reference.identifier);
1105 SimpleIdentifier prefix = prefixedIdentifier.prefix; 1298 SimpleIdentifier prefix = prefixedIdentifier.prefix;
1106 JUnitTestCase.assertNotNull(prefix.token); 1299 JUnitTestCase.assertNotNull(prefix.token);
1107 JUnitTestCase.assertEquals("a", prefix.name); 1300 JUnitTestCase.assertEquals("a", prefix.name);
1108 JUnitTestCase.assertEquals(11, prefix.offset); 1301 JUnitTestCase.assertEquals(11, prefix.offset);
1109 JUnitTestCase.assertNotNull(prefixedIdentifier.period); 1302 JUnitTestCase.assertNotNull(prefixedIdentifier.period);
1110 SimpleIdentifier identifier = prefixedIdentifier.identifier; 1303 SimpleIdentifier identifier = prefixedIdentifier.identifier;
1111 JUnitTestCase.assertNotNull(identifier.token); 1304 JUnitTestCase.assertNotNull(identifier.token);
1112 JUnitTestCase.assertEquals("b", identifier.name); 1305 JUnitTestCase.assertEquals("b", identifier.name);
1113 JUnitTestCase.assertEquals(13, identifier.offset); 1306 JUnitTestCase.assertEquals(13, identifier.offset);
1114 } 1307 }
1308
1115 void test_parseCommentReference_new_simple() { 1309 void test_parseCommentReference_new_simple() {
1116 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a", 5], ""); 1310 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["new a", 5], "");
1117 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier); 1311 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier);
1118 JUnitTestCase.assertNotNull(identifier.token); 1312 JUnitTestCase.assertNotNull(identifier.token);
1119 JUnitTestCase.assertEquals("a", identifier.name); 1313 JUnitTestCase.assertEquals("a", identifier.name);
1120 JUnitTestCase.assertEquals(9, identifier.offset); 1314 JUnitTestCase.assertEquals(9, identifier.offset);
1121 } 1315 }
1316
1122 void test_parseCommentReference_prefixed() { 1317 void test_parseCommentReference_prefixed() {
1123 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a.b", 7], ""); 1318 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a.b", 7], "");
1124 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(Pref ixedIdentifier, reference.identifier); 1319 PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(Pref ixedIdentifier, reference.identifier);
1125 SimpleIdentifier prefix = prefixedIdentifier.prefix; 1320 SimpleIdentifier prefix = prefixedIdentifier.prefix;
1126 JUnitTestCase.assertNotNull(prefix.token); 1321 JUnitTestCase.assertNotNull(prefix.token);
1127 JUnitTestCase.assertEquals("a", prefix.name); 1322 JUnitTestCase.assertEquals("a", prefix.name);
1128 JUnitTestCase.assertEquals(7, prefix.offset); 1323 JUnitTestCase.assertEquals(7, prefix.offset);
1129 JUnitTestCase.assertNotNull(prefixedIdentifier.period); 1324 JUnitTestCase.assertNotNull(prefixedIdentifier.period);
1130 SimpleIdentifier identifier = prefixedIdentifier.identifier; 1325 SimpleIdentifier identifier = prefixedIdentifier.identifier;
1131 JUnitTestCase.assertNotNull(identifier.token); 1326 JUnitTestCase.assertNotNull(identifier.token);
1132 JUnitTestCase.assertEquals("b", identifier.name); 1327 JUnitTestCase.assertEquals("b", identifier.name);
1133 JUnitTestCase.assertEquals(9, identifier.offset); 1328 JUnitTestCase.assertEquals(9, identifier.offset);
1134 } 1329 }
1330
1135 void test_parseCommentReference_simple() { 1331 void test_parseCommentReference_simple() {
1136 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a", 5], ""); 1332 CommentReference reference = ParserTestCase.parse("parseCommentReference", < Object> ["a", 5], "");
1137 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier); 1333 SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(SimpleIdentifi er, reference.identifier);
1138 JUnitTestCase.assertNotNull(identifier.token); 1334 JUnitTestCase.assertNotNull(identifier.token);
1139 JUnitTestCase.assertEquals("a", identifier.name); 1335 JUnitTestCase.assertEquals("a", identifier.name);
1140 JUnitTestCase.assertEquals(5, identifier.offset); 1336 JUnitTestCase.assertEquals(5, identifier.offset);
1141 } 1337 }
1338
1142 void test_parseCommentReferences_multiLine() { 1339 void test_parseCommentReferences_multiLine() {
1143 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)]; 1340 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** xxx [a] yyy [b] zzz */", 3)];
1144 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1341 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1145 EngineTestCase.assertSize(2, references); 1342 EngineTestCase.assertSize(2, references);
1146 CommentReference reference = references[0]; 1343 CommentReference reference = references[0];
1147 JUnitTestCase.assertNotNull(reference); 1344 JUnitTestCase.assertNotNull(reference);
1148 JUnitTestCase.assertNotNull(reference.identifier); 1345 JUnitTestCase.assertNotNull(reference.identifier);
1149 JUnitTestCase.assertEquals(12, reference.offset); 1346 JUnitTestCase.assertEquals(12, reference.offset);
1150 reference = references[1]; 1347 reference = references[1];
1151 JUnitTestCase.assertNotNull(reference); 1348 JUnitTestCase.assertNotNull(reference);
1152 JUnitTestCase.assertNotNull(reference.identifier); 1349 JUnitTestCase.assertNotNull(reference.identifier);
1153 JUnitTestCase.assertEquals(20, reference.offset); 1350 JUnitTestCase.assertEquals(20, reference.offset);
1154 } 1351 }
1352
1155 void test_parseCommentReferences_singleLine() { 1353 void test_parseCommentReferences_singleLine() {
1156 List<Token> tokens = <Token> [ 1354 List<Token> tokens = <Token> [
1157 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz" , 3), 1355 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// xxx [a] yyy [b] zzz" , 3),
1158 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)]; 1356 new StringToken(TokenType.SINGLE_LINE_COMMENT, "/// x [c]", 28)];
1159 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1357 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1160 EngineTestCase.assertSize(3, references); 1358 EngineTestCase.assertSize(3, references);
1161 CommentReference reference = references[0]; 1359 CommentReference reference = references[0];
1162 JUnitTestCase.assertNotNull(reference); 1360 JUnitTestCase.assertNotNull(reference);
1163 JUnitTestCase.assertNotNull(reference.identifier); 1361 JUnitTestCase.assertNotNull(reference.identifier);
1164 JUnitTestCase.assertEquals(12, reference.offset); 1362 JUnitTestCase.assertEquals(12, reference.offset);
1165 reference = references[1]; 1363 reference = references[1];
1166 JUnitTestCase.assertNotNull(reference); 1364 JUnitTestCase.assertNotNull(reference);
1167 JUnitTestCase.assertNotNull(reference.identifier); 1365 JUnitTestCase.assertNotNull(reference.identifier);
1168 JUnitTestCase.assertEquals(20, reference.offset); 1366 JUnitTestCase.assertEquals(20, reference.offset);
1169 reference = references[2]; 1367 reference = references[2];
1170 JUnitTestCase.assertNotNull(reference); 1368 JUnitTestCase.assertNotNull(reference);
1171 JUnitTestCase.assertNotNull(reference.identifier); 1369 JUnitTestCase.assertNotNull(reference.identifier);
1172 JUnitTestCase.assertEquals(35, reference.offset); 1370 JUnitTestCase.assertEquals(35, reference.offset);
1173 } 1371 }
1372
1174 void test_parseCommentReferences_skipCodeBlock_bracketed() { 1373 void test_parseCommentReferences_skipCodeBlock_bracketed() {
1175 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)]; 1374 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [:xxx [a] yyy:] [b] zzz */", 3)];
1176 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1375 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1177 EngineTestCase.assertSize(1, references); 1376 EngineTestCase.assertSize(1, references);
1178 CommentReference reference = references[0]; 1377 CommentReference reference = references[0];
1179 JUnitTestCase.assertNotNull(reference); 1378 JUnitTestCase.assertNotNull(reference);
1180 JUnitTestCase.assertNotNull(reference.identifier); 1379 JUnitTestCase.assertNotNull(reference.identifier);
1181 JUnitTestCase.assertEquals(24, reference.offset); 1380 JUnitTestCase.assertEquals(24, reference.offset);
1182 } 1381 }
1382
1183 void test_parseCommentReferences_skipCodeBlock_spaces() { 1383 void test_parseCommentReferences_skipCodeBlock_spaces() {
1184 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/**\n * a[i]\n * xxx [i] zzz\n */", 3)]; 1384 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/**\n * a[i]\n * xxx [i] zzz\n */", 3)];
1185 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1385 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1186 EngineTestCase.assertSize(1, references); 1386 EngineTestCase.assertSize(1, references);
1187 CommentReference reference = references[0]; 1387 CommentReference reference = references[0];
1188 JUnitTestCase.assertNotNull(reference); 1388 JUnitTestCase.assertNotNull(reference);
1189 JUnitTestCase.assertNotNull(reference.identifier); 1389 JUnitTestCase.assertNotNull(reference.identifier);
1190 JUnitTestCase.assertEquals(27, reference.offset); 1390 JUnitTestCase.assertEquals(27, reference.offset);
1191 } 1391 }
1392
1192 void test_parseCommentReferences_skipLinkDefinition() { 1393 void test_parseCommentReferences_skipLinkDefinition() {
1193 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a]: http://www.google.com (Google) [b] zzz */", 3)]; 1394 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a]: http://www.google.com (Google) [b] zzz */", 3)];
1194 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1395 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1195 EngineTestCase.assertSize(1, references); 1396 EngineTestCase.assertSize(1, references);
1196 CommentReference reference = references[0]; 1397 CommentReference reference = references[0];
1197 JUnitTestCase.assertNotNull(reference); 1398 JUnitTestCase.assertNotNull(reference);
1198 JUnitTestCase.assertNotNull(reference.identifier); 1399 JUnitTestCase.assertNotNull(reference.identifier);
1199 JUnitTestCase.assertEquals(44, reference.offset); 1400 JUnitTestCase.assertEquals(44, reference.offset);
1200 } 1401 }
1402
1201 void test_parseCommentReferences_skipLinked() { 1403 void test_parseCommentReferences_skipLinked() {
1202 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a](http://www.google.com) [b] zzz */", 3)]; 1404 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a](http://www.google.com) [b] zzz */", 3)];
1203 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1405 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1204 EngineTestCase.assertSize(1, references); 1406 EngineTestCase.assertSize(1, references);
1205 CommentReference reference = references[0]; 1407 CommentReference reference = references[0];
1206 JUnitTestCase.assertNotNull(reference); 1408 JUnitTestCase.assertNotNull(reference);
1207 JUnitTestCase.assertNotNull(reference.identifier); 1409 JUnitTestCase.assertNotNull(reference.identifier);
1208 JUnitTestCase.assertEquals(35, reference.offset); 1410 JUnitTestCase.assertEquals(35, reference.offset);
1209 } 1411 }
1412
1210 void test_parseCommentReferences_skipReferenceLink() { 1413 void test_parseCommentReferences_skipReferenceLink() {
1211 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)]; 1414 List<Token> tokens = <Token> [new StringToken(TokenType.MULTI_LINE_COMMENT, "/** [a][c] [b] zzz */", 3)];
1212 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], ""); 1415 List<CommentReference> references = ParserTestCase.parse("parseCommentRefere nces", <Object> [tokens], "");
1213 EngineTestCase.assertSize(1, references); 1416 EngineTestCase.assertSize(1, references);
1214 CommentReference reference = references[0]; 1417 CommentReference reference = references[0];
1215 JUnitTestCase.assertNotNull(reference); 1418 JUnitTestCase.assertNotNull(reference);
1216 JUnitTestCase.assertNotNull(reference.identifier); 1419 JUnitTestCase.assertNotNull(reference.identifier);
1217 JUnitTestCase.assertEquals(15, reference.offset); 1420 JUnitTestCase.assertEquals(15, reference.offset);
1218 } 1421 }
1422
1219 void test_parseCompilationUnit_abstractAsPrefix_parameterized() { 1423 void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
1220 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "abstra ct<dynamic> _abstract = new abstract.A();", []); 1424 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "abstra ct<dynamic> _abstract = new abstract.A();", []);
1221 JUnitTestCase.assertNull(unit.scriptTag); 1425 JUnitTestCase.assertNull(unit.scriptTag);
1222 EngineTestCase.assertSize(0, unit.directives); 1426 EngineTestCase.assertSize(0, unit.directives);
1223 EngineTestCase.assertSize(1, unit.declarations); 1427 EngineTestCase.assertSize(1, unit.declarations);
1224 } 1428 }
1429
1430 void test_parseCompilationUnit_builtIn_asFunctionName() {
1431 ParserTestCase.parse5("parseCompilationUnit", "abstract(x) => 0;", []);
1432 ParserTestCase.parse5("parseCompilationUnit", "as(x) => 0;", []);
1433 ParserTestCase.parse5("parseCompilationUnit", "dynamic(x) => 0;", []);
1434 ParserTestCase.parse5("parseCompilationUnit", "export(x) => 0;", []);
1435 ParserTestCase.parse5("parseCompilationUnit", "external(x) => 0;", []);
1436 ParserTestCase.parse5("parseCompilationUnit", "factory(x) => 0;", []);
1437 ParserTestCase.parse5("parseCompilationUnit", "get(x) => 0;", []);
1438 ParserTestCase.parse5("parseCompilationUnit", "implements(x) => 0;", []);
1439 ParserTestCase.parse5("parseCompilationUnit", "import(x) => 0;", []);
1440 ParserTestCase.parse5("parseCompilationUnit", "library(x) => 0;", []);
1441 ParserTestCase.parse5("parseCompilationUnit", "operator(x) => 0;", []);
1442 ParserTestCase.parse5("parseCompilationUnit", "part(x) => 0;", []);
1443 ParserTestCase.parse5("parseCompilationUnit", "set(x) => 0;", []);
1444 ParserTestCase.parse5("parseCompilationUnit", "static(x) => 0;", []);
1445 ParserTestCase.parse5("parseCompilationUnit", "typedef(x) => 0;", []);
1446 }
1447
1225 void test_parseCompilationUnit_directives_multiple() { 1448 void test_parseCompilationUnit_directives_multiple() {
1226 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y l;\npart 'a.dart';", []); 1449 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y l;\npart 'a.dart';", []);
1227 JUnitTestCase.assertNull(unit.scriptTag); 1450 JUnitTestCase.assertNull(unit.scriptTag);
1228 EngineTestCase.assertSize(2, unit.directives); 1451 EngineTestCase.assertSize(2, unit.directives);
1229 EngineTestCase.assertSize(0, unit.declarations); 1452 EngineTestCase.assertSize(0, unit.declarations);
1230 } 1453 }
1454
1231 void test_parseCompilationUnit_directives_single() { 1455 void test_parseCompilationUnit_directives_single() {
1232 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y l;", []); 1456 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "librar y l;", []);
1233 JUnitTestCase.assertNull(unit.scriptTag); 1457 JUnitTestCase.assertNull(unit.scriptTag);
1234 EngineTestCase.assertSize(1, unit.directives); 1458 EngineTestCase.assertSize(1, unit.directives);
1235 EngineTestCase.assertSize(0, unit.declarations); 1459 EngineTestCase.assertSize(0, unit.declarations);
1236 } 1460 }
1461
1237 void test_parseCompilationUnit_empty() { 1462 void test_parseCompilationUnit_empty() {
1238 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "", []) ; 1463 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "", []) ;
1239 JUnitTestCase.assertNull(unit.scriptTag); 1464 JUnitTestCase.assertNull(unit.scriptTag);
1240 EngineTestCase.assertSize(0, unit.directives); 1465 EngineTestCase.assertSize(0, unit.directives);
1241 EngineTestCase.assertSize(0, unit.declarations); 1466 EngineTestCase.assertSize(0, unit.declarations);
1242 } 1467 }
1468
1243 void test_parseCompilationUnit_exportAsPrefix() { 1469 void test_parseCompilationUnit_exportAsPrefix() {
1244 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "export .A _export = new export.A();", []); 1470 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "export .A _export = new export.A();", []);
1245 JUnitTestCase.assertNull(unit.scriptTag); 1471 JUnitTestCase.assertNull(unit.scriptTag);
1246 EngineTestCase.assertSize(0, unit.directives); 1472 EngineTestCase.assertSize(0, unit.directives);
1247 EngineTestCase.assertSize(1, unit.declarations); 1473 EngineTestCase.assertSize(1, unit.declarations);
1248 } 1474 }
1475
1249 void test_parseCompilationUnit_exportAsPrefix_parameterized() { 1476 void test_parseCompilationUnit_exportAsPrefix_parameterized() {
1250 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "export <dynamic> _export = new export.A();", []); 1477 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "export <dynamic> _export = new export.A();", []);
1251 JUnitTestCase.assertNull(unit.scriptTag); 1478 JUnitTestCase.assertNull(unit.scriptTag);
1252 EngineTestCase.assertSize(0, unit.directives); 1479 EngineTestCase.assertSize(0, unit.directives);
1253 EngineTestCase.assertSize(1, unit.declarations); 1480 EngineTestCase.assertSize(1, unit.declarations);
1254 } 1481 }
1482
1255 void test_parseCompilationUnit_operatorAsPrefix_parameterized() { 1483 void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
1256 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "operat or<dynamic> _operator = new operator.A();", []); 1484 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "operat or<dynamic> _operator = new operator.A();", []);
1257 JUnitTestCase.assertNull(unit.scriptTag); 1485 JUnitTestCase.assertNull(unit.scriptTag);
1258 EngineTestCase.assertSize(0, unit.directives); 1486 EngineTestCase.assertSize(0, unit.directives);
1259 EngineTestCase.assertSize(1, unit.declarations); 1487 EngineTestCase.assertSize(1, unit.declarations);
1260 } 1488 }
1489
1261 void test_parseCompilationUnit_script() { 1490 void test_parseCompilationUnit_script() {
1262 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "#! /bi n/dart", []); 1491 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "#! /bi n/dart", []);
1263 JUnitTestCase.assertNotNull(unit.scriptTag); 1492 JUnitTestCase.assertNotNull(unit.scriptTag);
1264 EngineTestCase.assertSize(0, unit.directives); 1493 EngineTestCase.assertSize(0, unit.directives);
1265 EngineTestCase.assertSize(0, unit.declarations); 1494 EngineTestCase.assertSize(0, unit.declarations);
1266 } 1495 }
1496
1267 void test_parseCompilationUnit_topLevelDeclaration() { 1497 void test_parseCompilationUnit_topLevelDeclaration() {
1268 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "class A {}", []); 1498 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "class A {}", []);
1269 JUnitTestCase.assertNull(unit.scriptTag); 1499 JUnitTestCase.assertNull(unit.scriptTag);
1270 EngineTestCase.assertSize(0, unit.directives); 1500 EngineTestCase.assertSize(0, unit.directives);
1271 EngineTestCase.assertSize(1, unit.declarations); 1501 EngineTestCase.assertSize(1, unit.declarations);
1272 } 1502 }
1503
1273 void test_parseCompilationUnit_typedefAsPrefix() { 1504 void test_parseCompilationUnit_typedefAsPrefix() {
1274 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "typede f.A _typedef = new typedef.A();", []); 1505 CompilationUnit unit = ParserTestCase.parse5("parseCompilationUnit", "typede f.A _typedef = new typedef.A();", []);
1275 JUnitTestCase.assertNull(unit.scriptTag); 1506 JUnitTestCase.assertNull(unit.scriptTag);
1276 EngineTestCase.assertSize(0, unit.directives); 1507 EngineTestCase.assertSize(0, unit.directives);
1277 EngineTestCase.assertSize(1, unit.declarations); 1508 EngineTestCase.assertSize(1, unit.declarations);
1278 } 1509 }
1510
1279 void test_parseCompilationUnitMember_abstractAsPrefix() { 1511 void test_parseCompilationUnitMember_abstractAsPrefix() {
1280 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "abstract.A _abstract = n ew abstract.A();"); 1512 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "abstract.A _abstract = n ew abstract.A();");
1281 JUnitTestCase.assertNotNull(declaration.semicolon); 1513 JUnitTestCase.assertNotNull(declaration.semicolon);
1282 JUnitTestCase.assertNotNull(declaration.variables); 1514 JUnitTestCase.assertNotNull(declaration.variables);
1283 } 1515 }
1516
1284 void test_parseCompilationUnitMember_class() { 1517 void test_parseCompilationUnitMember_class() {
1285 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}"); 1518 ClassDeclaration declaration = ParserTestCase.parse("parseCompilationUnitMem ber", <Object> [emptyCommentAndMetadata()], "class A {}");
1286 JUnitTestCase.assertEquals("A", declaration.name.name); 1519 JUnitTestCase.assertEquals("A", declaration.name.name);
1287 EngineTestCase.assertSize(0, declaration.members); 1520 EngineTestCase.assertSize(0, declaration.members);
1288 } 1521 }
1522
1289 void test_parseCompilationUnitMember_constVariable() { 1523 void test_parseCompilationUnitMember_constVariable() {
1290 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "const int x = 0;"); 1524 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "const int x = 0;");
1291 JUnitTestCase.assertNotNull(declaration.semicolon); 1525 JUnitTestCase.assertNotNull(declaration.semicolon);
1292 JUnitTestCase.assertNotNull(declaration.variables); 1526 JUnitTestCase.assertNotNull(declaration.variables);
1293 } 1527 }
1528
1294 void test_parseCompilationUnitMember_finalVariable() { 1529 void test_parseCompilationUnitMember_finalVariable() {
1295 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "final x = 0;"); 1530 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "final x = 0;");
1296 JUnitTestCase.assertNotNull(declaration.semicolon); 1531 JUnitTestCase.assertNotNull(declaration.semicolon);
1297 JUnitTestCase.assertNotNull(declaration.variables); 1532 JUnitTestCase.assertNotNull(declaration.variables);
1298 } 1533 }
1534
1299 void test_parseCompilationUnitMember_function_external_noType() { 1535 void test_parseCompilationUnitMember_function_external_noType() {
1300 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external f();"); 1536 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external f();");
1301 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1537 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1302 JUnitTestCase.assertNotNull(declaration.functionExpression); 1538 JUnitTestCase.assertNotNull(declaration.functionExpression);
1303 JUnitTestCase.assertNull(declaration.propertyKeyword); 1539 JUnitTestCase.assertNull(declaration.propertyKeyword);
1304 } 1540 }
1541
1305 void test_parseCompilationUnitMember_function_external_type() { 1542 void test_parseCompilationUnitMember_function_external_type() {
1306 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int f();"); 1543 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int f();");
1307 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1544 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1308 JUnitTestCase.assertNotNull(declaration.functionExpression); 1545 JUnitTestCase.assertNotNull(declaration.functionExpression);
1309 JUnitTestCase.assertNull(declaration.propertyKeyword); 1546 JUnitTestCase.assertNull(declaration.propertyKeyword);
1310 } 1547 }
1548
1311 void test_parseCompilationUnitMember_function_noType() { 1549 void test_parseCompilationUnitMember_function_noType() {
1312 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "f() {}"); 1550 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "f() {}");
1313 JUnitTestCase.assertNotNull(declaration.functionExpression); 1551 JUnitTestCase.assertNotNull(declaration.functionExpression);
1314 JUnitTestCase.assertNull(declaration.propertyKeyword); 1552 JUnitTestCase.assertNull(declaration.propertyKeyword);
1315 } 1553 }
1554
1316 void test_parseCompilationUnitMember_function_type() { 1555 void test_parseCompilationUnitMember_function_type() {
1317 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int f() {}"); 1556 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int f() {}");
1318 JUnitTestCase.assertNotNull(declaration.functionExpression); 1557 JUnitTestCase.assertNotNull(declaration.functionExpression);
1319 JUnitTestCase.assertNull(declaration.propertyKeyword); 1558 JUnitTestCase.assertNull(declaration.propertyKeyword);
1320 } 1559 }
1560
1321 void test_parseCompilationUnitMember_function_void() { 1561 void test_parseCompilationUnitMember_function_void() {
1322 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void f() {}"); 1562 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void f() {}");
1323 JUnitTestCase.assertNotNull(declaration.returnType); 1563 JUnitTestCase.assertNotNull(declaration.returnType);
1324 } 1564 }
1565
1325 void test_parseCompilationUnitMember_getter_external_noType() { 1566 void test_parseCompilationUnitMember_getter_external_noType() {
1326 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external get p;"); 1567 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external get p;");
1327 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1568 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1328 JUnitTestCase.assertNotNull(declaration.functionExpression); 1569 JUnitTestCase.assertNotNull(declaration.functionExpression);
1329 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1570 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1330 } 1571 }
1572
1331 void test_parseCompilationUnitMember_getter_external_type() { 1573 void test_parseCompilationUnitMember_getter_external_type() {
1332 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int get p;"); 1574 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external int get p;");
1333 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1575 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1334 JUnitTestCase.assertNotNull(declaration.functionExpression); 1576 JUnitTestCase.assertNotNull(declaration.functionExpression);
1335 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1577 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1336 } 1578 }
1579
1337 void test_parseCompilationUnitMember_getter_noType() { 1580 void test_parseCompilationUnitMember_getter_noType() {
1338 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "get p => 0;"); 1581 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "get p => 0;");
1339 JUnitTestCase.assertNotNull(declaration.functionExpression); 1582 JUnitTestCase.assertNotNull(declaration.functionExpression);
1340 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1583 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1341 } 1584 }
1585
1342 void test_parseCompilationUnitMember_getter_type() { 1586 void test_parseCompilationUnitMember_getter_type() {
1343 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int get p => 0;"); 1587 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "int get p => 0;");
1344 JUnitTestCase.assertNotNull(declaration.functionExpression); 1588 JUnitTestCase.assertNotNull(declaration.functionExpression);
1345 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1589 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1346 } 1590 }
1591
1347 void test_parseCompilationUnitMember_setter_external_noType() { 1592 void test_parseCompilationUnitMember_setter_external_noType() {
1348 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external set p(v);"); 1593 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external set p(v);");
1349 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1594 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1350 JUnitTestCase.assertNotNull(declaration.functionExpression); 1595 JUnitTestCase.assertNotNull(declaration.functionExpression);
1351 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1596 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1352 } 1597 }
1598
1353 void test_parseCompilationUnitMember_setter_external_type() { 1599 void test_parseCompilationUnitMember_setter_external_type() {
1354 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external void set p(int v);"); 1600 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "external void set p(int v);");
1355 JUnitTestCase.assertNotNull(declaration.externalKeyword); 1601 JUnitTestCase.assertNotNull(declaration.externalKeyword);
1356 JUnitTestCase.assertNotNull(declaration.functionExpression); 1602 JUnitTestCase.assertNotNull(declaration.functionExpression);
1357 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1603 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1358 } 1604 }
1605
1359 void test_parseCompilationUnitMember_setter_noType() { 1606 void test_parseCompilationUnitMember_setter_noType() {
1360 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "set p(v) {}"); 1607 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "set p(v) {}");
1361 JUnitTestCase.assertNotNull(declaration.functionExpression); 1608 JUnitTestCase.assertNotNull(declaration.functionExpression);
1362 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1609 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1363 } 1610 }
1611
1364 void test_parseCompilationUnitMember_setter_type() { 1612 void test_parseCompilationUnitMember_setter_type() {
1365 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void set p(int v) {}"); 1613 FunctionDeclaration declaration = ParserTestCase.parse("parseCompilationUnit Member", <Object> [emptyCommentAndMetadata()], "void set p(int v) {}");
1366 JUnitTestCase.assertNotNull(declaration.functionExpression); 1614 JUnitTestCase.assertNotNull(declaration.functionExpression);
1367 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 1615 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
1368 } 1616 }
1617
1369 void test_parseCompilationUnitMember_typeAlias_abstract() { 1618 void test_parseCompilationUnitMember_typeAlias_abstract() {
1370 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = abstract S with M;"); 1619 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = abstract S with M;");
1371 JUnitTestCase.assertNotNull(typeAlias.keyword); 1620 JUnitTestCase.assertNotNull(typeAlias.keyword);
1372 JUnitTestCase.assertEquals("C", typeAlias.name.name); 1621 JUnitTestCase.assertEquals("C", typeAlias.name.name);
1373 JUnitTestCase.assertNull(typeAlias.typeParameters); 1622 JUnitTestCase.assertNull(typeAlias.typeParameters);
1374 JUnitTestCase.assertNotNull(typeAlias.equals); 1623 JUnitTestCase.assertNotNull(typeAlias.equals);
1375 JUnitTestCase.assertNotNull(typeAlias.abstractKeyword); 1624 JUnitTestCase.assertNotNull(typeAlias.abstractKeyword);
1376 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 1625 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name);
1377 JUnitTestCase.assertNotNull(typeAlias.withClause); 1626 JUnitTestCase.assertNotNull(typeAlias.withClause);
1378 JUnitTestCase.assertNull(typeAlias.implementsClause); 1627 JUnitTestCase.assertNull(typeAlias.implementsClause);
1379 JUnitTestCase.assertNotNull(typeAlias.semicolon); 1628 JUnitTestCase.assertNotNull(typeAlias.semicolon);
1380 } 1629 }
1630
1381 void test_parseCompilationUnitMember_typeAlias_generic() { 1631 void test_parseCompilationUnitMember_typeAlias_generic() {
1382 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C<E> = S<E> with M<E> implements I<E>;"); 1632 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C<E> = S<E> with M<E> implements I<E>;");
1383 JUnitTestCase.assertNotNull(typeAlias.keyword); 1633 JUnitTestCase.assertNotNull(typeAlias.keyword);
1384 JUnitTestCase.assertEquals("C", typeAlias.name.name); 1634 JUnitTestCase.assertEquals("C", typeAlias.name.name);
1385 EngineTestCase.assertSize(1, typeAlias.typeParameters.typeParameters); 1635 EngineTestCase.assertSize(1, typeAlias.typeParameters.typeParameters);
1386 JUnitTestCase.assertNotNull(typeAlias.equals); 1636 JUnitTestCase.assertNotNull(typeAlias.equals);
1387 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 1637 JUnitTestCase.assertNull(typeAlias.abstractKeyword);
1388 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 1638 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name);
1389 JUnitTestCase.assertNotNull(typeAlias.withClause); 1639 JUnitTestCase.assertNotNull(typeAlias.withClause);
1390 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 1640 JUnitTestCase.assertNotNull(typeAlias.implementsClause);
1391 JUnitTestCase.assertNotNull(typeAlias.semicolon); 1641 JUnitTestCase.assertNotNull(typeAlias.semicolon);
1392 } 1642 }
1643
1393 void test_parseCompilationUnitMember_typeAlias_implements() { 1644 void test_parseCompilationUnitMember_typeAlias_implements() {
1394 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M implements I;"); 1645 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M implements I;");
1395 JUnitTestCase.assertNotNull(typeAlias.keyword); 1646 JUnitTestCase.assertNotNull(typeAlias.keyword);
1396 JUnitTestCase.assertEquals("C", typeAlias.name.name); 1647 JUnitTestCase.assertEquals("C", typeAlias.name.name);
1397 JUnitTestCase.assertNull(typeAlias.typeParameters); 1648 JUnitTestCase.assertNull(typeAlias.typeParameters);
1398 JUnitTestCase.assertNotNull(typeAlias.equals); 1649 JUnitTestCase.assertNotNull(typeAlias.equals);
1399 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 1650 JUnitTestCase.assertNull(typeAlias.abstractKeyword);
1400 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 1651 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name);
1401 JUnitTestCase.assertNotNull(typeAlias.withClause); 1652 JUnitTestCase.assertNotNull(typeAlias.withClause);
1402 JUnitTestCase.assertNotNull(typeAlias.implementsClause); 1653 JUnitTestCase.assertNotNull(typeAlias.implementsClause);
1403 JUnitTestCase.assertNotNull(typeAlias.semicolon); 1654 JUnitTestCase.assertNotNull(typeAlias.semicolon);
1404 } 1655 }
1656
1405 void test_parseCompilationUnitMember_typeAlias_noImplements() { 1657 void test_parseCompilationUnitMember_typeAlias_noImplements() {
1406 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M;"); 1658 ClassTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMember" , <Object> [emptyCommentAndMetadata()], "class C = S with M;");
1407 JUnitTestCase.assertNotNull(typeAlias.keyword); 1659 JUnitTestCase.assertNotNull(typeAlias.keyword);
1408 JUnitTestCase.assertEquals("C", typeAlias.name.name); 1660 JUnitTestCase.assertEquals("C", typeAlias.name.name);
1409 JUnitTestCase.assertNull(typeAlias.typeParameters); 1661 JUnitTestCase.assertNull(typeAlias.typeParameters);
1410 JUnitTestCase.assertNotNull(typeAlias.equals); 1662 JUnitTestCase.assertNotNull(typeAlias.equals);
1411 JUnitTestCase.assertNull(typeAlias.abstractKeyword); 1663 JUnitTestCase.assertNull(typeAlias.abstractKeyword);
1412 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name); 1664 JUnitTestCase.assertEquals("S", typeAlias.superclass.name.name);
1413 JUnitTestCase.assertNotNull(typeAlias.withClause); 1665 JUnitTestCase.assertNotNull(typeAlias.withClause);
1414 JUnitTestCase.assertNull(typeAlias.implementsClause); 1666 JUnitTestCase.assertNull(typeAlias.implementsClause);
1415 JUnitTestCase.assertNotNull(typeAlias.semicolon); 1667 JUnitTestCase.assertNotNull(typeAlias.semicolon);
1416 } 1668 }
1669
1417 void test_parseCompilationUnitMember_typedef() { 1670 void test_parseCompilationUnitMember_typedef() {
1418 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();"); 1671 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseCompilationUnitMemb er", <Object> [emptyCommentAndMetadata()], "typedef F();");
1419 JUnitTestCase.assertEquals("F", typeAlias.name.name); 1672 JUnitTestCase.assertEquals("F", typeAlias.name.name);
1420 EngineTestCase.assertSize(0, typeAlias.parameters.parameters); 1673 EngineTestCase.assertSize(0, typeAlias.parameters.parameters);
1421 } 1674 }
1675
1422 void test_parseCompilationUnitMember_variable() { 1676 void test_parseCompilationUnitMember_variable() {
1423 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;"); 1677 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "var x = 0;");
1424 JUnitTestCase.assertNotNull(declaration.semicolon); 1678 JUnitTestCase.assertNotNull(declaration.semicolon);
1425 JUnitTestCase.assertNotNull(declaration.variables); 1679 JUnitTestCase.assertNotNull(declaration.variables);
1426 } 1680 }
1681
1427 void test_parseCompilationUnitMember_variableGet() { 1682 void test_parseCompilationUnitMember_variableGet() {
1428 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;"); 1683 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String get = null;");
1429 JUnitTestCase.assertNotNull(declaration.semicolon); 1684 JUnitTestCase.assertNotNull(declaration.semicolon);
1430 JUnitTestCase.assertNotNull(declaration.variables); 1685 JUnitTestCase.assertNotNull(declaration.variables);
1431 } 1686 }
1687
1432 void test_parseCompilationUnitMember_variableSet() { 1688 void test_parseCompilationUnitMember_variableSet() {
1433 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String set = null;"); 1689 TopLevelVariableDeclaration declaration = ParserTestCase.parse("parseCompila tionUnitMember", <Object> [emptyCommentAndMetadata()], "String set = null;");
1434 JUnitTestCase.assertNotNull(declaration.semicolon); 1690 JUnitTestCase.assertNotNull(declaration.semicolon);
1435 JUnitTestCase.assertNotNull(declaration.variables); 1691 JUnitTestCase.assertNotNull(declaration.variables);
1436 } 1692 }
1693
1437 void test_parseConditionalExpression() { 1694 void test_parseConditionalExpression() {
1438 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y : z", []); 1695 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y : z", []);
1439 JUnitTestCase.assertNotNull(expression.condition); 1696 JUnitTestCase.assertNotNull(expression.condition);
1440 JUnitTestCase.assertNotNull(expression.question); 1697 JUnitTestCase.assertNotNull(expression.question);
1441 JUnitTestCase.assertNotNull(expression.thenExpression); 1698 JUnitTestCase.assertNotNull(expression.thenExpression);
1442 JUnitTestCase.assertNotNull(expression.colon); 1699 JUnitTestCase.assertNotNull(expression.colon);
1443 JUnitTestCase.assertNotNull(expression.elseExpression); 1700 JUnitTestCase.assertNotNull(expression.elseExpression);
1444 } 1701 }
1702
1445 void test_parseConstExpression_instanceCreation() { 1703 void test_parseConstExpression_instanceCreation() {
1446 InstanceCreationExpression expression = ParserTestCase.parse5("parseConstExp ression", "const A()", []); 1704 InstanceCreationExpression expression = ParserTestCase.parse5("parseConstExp ression", "const A()", []);
1447 JUnitTestCase.assertNotNull(expression.keyword); 1705 JUnitTestCase.assertNotNull(expression.keyword);
1448 ConstructorName name = expression.constructorName; 1706 ConstructorName name = expression.constructorName;
1449 JUnitTestCase.assertNotNull(name); 1707 JUnitTestCase.assertNotNull(name);
1450 JUnitTestCase.assertNotNull(name.type); 1708 JUnitTestCase.assertNotNull(name.type);
1451 JUnitTestCase.assertNull(name.period); 1709 JUnitTestCase.assertNull(name.period);
1452 JUnitTestCase.assertNull(name.name); 1710 JUnitTestCase.assertNull(name.name);
1453 JUnitTestCase.assertNotNull(expression.argumentList); 1711 JUnitTestCase.assertNotNull(expression.argumentList);
1454 } 1712 }
1713
1455 void test_parseConstExpression_listLiteral_typed() { 1714 void test_parseConstExpression_listLiteral_typed() {
1456 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const < A> []", []); 1715 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const < A> []", []);
1457 JUnitTestCase.assertNotNull(literal.constKeyword); 1716 JUnitTestCase.assertNotNull(literal.constKeyword);
1458 JUnitTestCase.assertNotNull(literal.typeArguments); 1717 JUnitTestCase.assertNotNull(literal.typeArguments);
1459 JUnitTestCase.assertNotNull(literal.leftBracket); 1718 JUnitTestCase.assertNotNull(literal.leftBracket);
1460 EngineTestCase.assertSize(0, literal.elements); 1719 EngineTestCase.assertSize(0, literal.elements);
1461 JUnitTestCase.assertNotNull(literal.rightBracket); 1720 JUnitTestCase.assertNotNull(literal.rightBracket);
1462 } 1721 }
1722
1463 void test_parseConstExpression_listLiteral_untyped() { 1723 void test_parseConstExpression_listLiteral_untyped() {
1464 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [ ]", []); 1724 ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const [ ]", []);
1465 JUnitTestCase.assertNotNull(literal.constKeyword); 1725 JUnitTestCase.assertNotNull(literal.constKeyword);
1466 JUnitTestCase.assertNull(literal.typeArguments); 1726 JUnitTestCase.assertNull(literal.typeArguments);
1467 JUnitTestCase.assertNotNull(literal.leftBracket); 1727 JUnitTestCase.assertNotNull(literal.leftBracket);
1468 EngineTestCase.assertSize(0, literal.elements); 1728 EngineTestCase.assertSize(0, literal.elements);
1469 JUnitTestCase.assertNotNull(literal.rightBracket); 1729 JUnitTestCase.assertNotNull(literal.rightBracket);
1470 } 1730 }
1731
1471 void test_parseConstExpression_mapLiteral_typed() { 1732 void test_parseConstExpression_mapLiteral_typed() {
1472 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A , B> {}", []); 1733 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A , B> {}", []);
1473 JUnitTestCase.assertNotNull(literal.leftBracket); 1734 JUnitTestCase.assertNotNull(literal.leftBracket);
1474 EngineTestCase.assertSize(0, literal.entries); 1735 EngineTestCase.assertSize(0, literal.entries);
1475 JUnitTestCase.assertNotNull(literal.rightBracket); 1736 JUnitTestCase.assertNotNull(literal.rightBracket);
1476 JUnitTestCase.assertNotNull(literal.typeArguments); 1737 JUnitTestCase.assertNotNull(literal.typeArguments);
1477 } 1738 }
1739
1478 void test_parseConstExpression_mapLiteral_untyped() { 1740 void test_parseConstExpression_mapLiteral_untyped() {
1479 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const {} ", []); 1741 MapLiteral literal = ParserTestCase.parse5("parseConstExpression", "const {} ", []);
1480 JUnitTestCase.assertNotNull(literal.leftBracket); 1742 JUnitTestCase.assertNotNull(literal.leftBracket);
1481 EngineTestCase.assertSize(0, literal.entries); 1743 EngineTestCase.assertSize(0, literal.entries);
1482 JUnitTestCase.assertNotNull(literal.rightBracket); 1744 JUnitTestCase.assertNotNull(literal.rightBracket);
1483 JUnitTestCase.assertNull(literal.typeArguments); 1745 JUnitTestCase.assertNull(literal.typeArguments);
1484 } 1746 }
1747
1485 void test_parseConstructor() { 1748 void test_parseConstructor() {
1486 } 1749 }
1750
1487 void test_parseConstructorFieldInitializer_qualified() { 1751 void test_parseConstructorFieldInitializer_qualified() {
1488 ConstructorFieldInitializer invocation = ParserTestCase.parse5("parseConstru ctorFieldInitializer", "this.a = b", []); 1752 ConstructorFieldInitializer invocation = ParserTestCase.parse5("parseConstru ctorFieldInitializer", "this.a = b", []);
1489 JUnitTestCase.assertNotNull(invocation.equals); 1753 JUnitTestCase.assertNotNull(invocation.equals);
1490 JUnitTestCase.assertNotNull(invocation.expression); 1754 JUnitTestCase.assertNotNull(invocation.expression);
1491 JUnitTestCase.assertNotNull(invocation.fieldName); 1755 JUnitTestCase.assertNotNull(invocation.fieldName);
1492 JUnitTestCase.assertNotNull(invocation.keyword); 1756 JUnitTestCase.assertNotNull(invocation.keyword);
1493 JUnitTestCase.assertNotNull(invocation.period); 1757 JUnitTestCase.assertNotNull(invocation.period);
1494 } 1758 }
1759
1495 void test_parseConstructorFieldInitializer_unqualified() { 1760 void test_parseConstructorFieldInitializer_unqualified() {
1496 ConstructorFieldInitializer invocation = ParserTestCase.parse5("parseConstru ctorFieldInitializer", "a = b", []); 1761 ConstructorFieldInitializer invocation = ParserTestCase.parse5("parseConstru ctorFieldInitializer", "a = b", []);
1497 JUnitTestCase.assertNotNull(invocation.equals); 1762 JUnitTestCase.assertNotNull(invocation.equals);
1498 JUnitTestCase.assertNotNull(invocation.expression); 1763 JUnitTestCase.assertNotNull(invocation.expression);
1499 JUnitTestCase.assertNotNull(invocation.fieldName); 1764 JUnitTestCase.assertNotNull(invocation.fieldName);
1500 JUnitTestCase.assertNull(invocation.keyword); 1765 JUnitTestCase.assertNull(invocation.keyword);
1501 JUnitTestCase.assertNull(invocation.period); 1766 JUnitTestCase.assertNull(invocation.period);
1502 } 1767 }
1768
1503 void test_parseConstructorName_named_noPrefix() { 1769 void test_parseConstructorName_named_noPrefix() {
1504 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "A.n;", []); 1770 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "A.n;", []);
1505 JUnitTestCase.assertNotNull(name.type); 1771 JUnitTestCase.assertNotNull(name.type);
1506 JUnitTestCase.assertNull(name.period); 1772 JUnitTestCase.assertNull(name.period);
1507 JUnitTestCase.assertNull(name.name); 1773 JUnitTestCase.assertNull(name.name);
1508 } 1774 }
1775
1509 void test_parseConstructorName_named_prefixed() { 1776 void test_parseConstructorName_named_prefixed() {
1510 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "p.A.n; ", []); 1777 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "p.A.n; ", []);
1511 JUnitTestCase.assertNotNull(name.type); 1778 JUnitTestCase.assertNotNull(name.type);
1512 JUnitTestCase.assertNotNull(name.period); 1779 JUnitTestCase.assertNotNull(name.period);
1513 JUnitTestCase.assertNotNull(name.name); 1780 JUnitTestCase.assertNotNull(name.name);
1514 } 1781 }
1782
1515 void test_parseConstructorName_unnamed_noPrefix() { 1783 void test_parseConstructorName_unnamed_noPrefix() {
1516 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "A;", [ ]); 1784 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "A;", [ ]);
1517 JUnitTestCase.assertNotNull(name.type); 1785 JUnitTestCase.assertNotNull(name.type);
1518 JUnitTestCase.assertNull(name.period); 1786 JUnitTestCase.assertNull(name.period);
1519 JUnitTestCase.assertNull(name.name); 1787 JUnitTestCase.assertNull(name.name);
1520 } 1788 }
1789
1521 void test_parseConstructorName_unnamed_prefixed() { 1790 void test_parseConstructorName_unnamed_prefixed() {
1522 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "p.A;", []); 1791 ConstructorName name = ParserTestCase.parse5("parseConstructorName", "p.A;", []);
1523 JUnitTestCase.assertNotNull(name.type); 1792 JUnitTestCase.assertNotNull(name.type);
1524 JUnitTestCase.assertNull(name.period); 1793 JUnitTestCase.assertNull(name.period);
1525 JUnitTestCase.assertNull(name.name); 1794 JUnitTestCase.assertNull(name.name);
1526 } 1795 }
1796
1527 void test_parseContinueStatement_label() { 1797 void test_parseContinueStatement_label() {
1528 ContinueStatement statement = ParserTestCase.parse5("parseContinueStatement" , "continue foo;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 1798 ContinueStatement statement = ParserTestCase.parse5("parseContinueStatement" , "continue foo;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
1529 JUnitTestCase.assertNotNull(statement.keyword); 1799 JUnitTestCase.assertNotNull(statement.keyword);
1530 JUnitTestCase.assertNotNull(statement.label); 1800 JUnitTestCase.assertNotNull(statement.label);
1531 JUnitTestCase.assertNotNull(statement.semicolon); 1801 JUnitTestCase.assertNotNull(statement.semicolon);
1532 } 1802 }
1803
1533 void test_parseContinueStatement_noLabel() { 1804 void test_parseContinueStatement_noLabel() {
1534 ContinueStatement statement = ParserTestCase.parse5("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]); 1805 ContinueStatement statement = ParserTestCase.parse5("parseContinueStatement" , "continue;", [ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP]);
1535 JUnitTestCase.assertNotNull(statement.keyword); 1806 JUnitTestCase.assertNotNull(statement.keyword);
1536 JUnitTestCase.assertNull(statement.label); 1807 JUnitTestCase.assertNull(statement.label);
1537 JUnitTestCase.assertNotNull(statement.semicolon); 1808 JUnitTestCase.assertNotNull(statement.semicolon);
1538 } 1809 }
1810
1539 void test_parseDirective_export() { 1811 void test_parseDirective_export() {
1540 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';"); 1812 ExportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
1541 JUnitTestCase.assertNotNull(directive.keyword); 1813 JUnitTestCase.assertNotNull(directive.keyword);
1542 JUnitTestCase.assertNotNull(directive.uri); 1814 JUnitTestCase.assertNotNull(directive.uri);
1543 EngineTestCase.assertSize(0, directive.combinators); 1815 EngineTestCase.assertSize(0, directive.combinators);
1544 JUnitTestCase.assertNotNull(directive.semicolon); 1816 JUnitTestCase.assertNotNull(directive.semicolon);
1545 } 1817 }
1818
1546 void test_parseDirective_import() { 1819 void test_parseDirective_import() {
1547 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';"); 1820 ImportDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
1548 JUnitTestCase.assertNotNull(directive.keyword); 1821 JUnitTestCase.assertNotNull(directive.keyword);
1549 JUnitTestCase.assertNotNull(directive.uri); 1822 JUnitTestCase.assertNotNull(directive.uri);
1550 JUnitTestCase.assertNull(directive.asToken); 1823 JUnitTestCase.assertNull(directive.asToken);
1551 JUnitTestCase.assertNull(directive.prefix); 1824 JUnitTestCase.assertNull(directive.prefix);
1552 EngineTestCase.assertSize(0, directive.combinators); 1825 EngineTestCase.assertSize(0, directive.combinators);
1553 JUnitTestCase.assertNotNull(directive.semicolon); 1826 JUnitTestCase.assertNotNull(directive.semicolon);
1554 } 1827 }
1828
1555 void test_parseDirective_library() { 1829 void test_parseDirective_library() {
1556 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;"); 1830 LibraryDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "library l;");
1557 JUnitTestCase.assertNotNull(directive.libraryToken); 1831 JUnitTestCase.assertNotNull(directive.libraryToken);
1558 JUnitTestCase.assertNotNull(directive.name); 1832 JUnitTestCase.assertNotNull(directive.name);
1559 JUnitTestCase.assertNotNull(directive.semicolon); 1833 JUnitTestCase.assertNotNull(directive.semicolon);
1560 } 1834 }
1835
1561 void test_parseDirective_part() { 1836 void test_parseDirective_part() {
1562 PartDirective directive = ParserTestCase.parse("parseDirective", <Object> [e mptyCommentAndMetadata()], "part 'lib/lib.dart';"); 1837 PartDirective directive = ParserTestCase.parse("parseDirective", <Object> [e mptyCommentAndMetadata()], "part 'lib/lib.dart';");
1563 JUnitTestCase.assertNotNull(directive.partToken); 1838 JUnitTestCase.assertNotNull(directive.partToken);
1564 JUnitTestCase.assertNotNull(directive.uri); 1839 JUnitTestCase.assertNotNull(directive.uri);
1565 JUnitTestCase.assertNotNull(directive.semicolon); 1840 JUnitTestCase.assertNotNull(directive.semicolon);
1566 } 1841 }
1842
1567 void test_parseDirective_partOf() { 1843 void test_parseDirective_partOf() {
1568 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;"); 1844 PartOfDirective directive = ParserTestCase.parse("parseDirective", <Object> [emptyCommentAndMetadata()], "part of l;");
1569 JUnitTestCase.assertNotNull(directive.partToken); 1845 JUnitTestCase.assertNotNull(directive.partToken);
1570 JUnitTestCase.assertNotNull(directive.ofToken); 1846 JUnitTestCase.assertNotNull(directive.ofToken);
1571 JUnitTestCase.assertNotNull(directive.libraryName); 1847 JUnitTestCase.assertNotNull(directive.libraryName);
1572 JUnitTestCase.assertNotNull(directive.semicolon); 1848 JUnitTestCase.assertNotNull(directive.semicolon);
1573 } 1849 }
1850
1574 void test_parseDocumentationComment_block() { 1851 void test_parseDocumentationComment_block() {
1575 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/** */ class", []); 1852 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/** */ class", []);
1576 JUnitTestCase.assertFalse(comment.isBlock); 1853 JUnitTestCase.assertFalse(comment.isBlock);
1577 JUnitTestCase.assertTrue(comment.isDocumentation); 1854 JUnitTestCase.assertTrue(comment.isDocumentation);
1578 JUnitTestCase.assertFalse(comment.isEndOfLine); 1855 JUnitTestCase.assertFalse(comment.isEndOfLine);
1579 } 1856 }
1857
1580 void test_parseDocumentationComment_block_withReference() { 1858 void test_parseDocumentationComment_block_withReference() {
1581 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/** [a ] */ class", []); 1859 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/** [a ] */ class", []);
1582 JUnitTestCase.assertFalse(comment.isBlock); 1860 JUnitTestCase.assertFalse(comment.isBlock);
1583 JUnitTestCase.assertTrue(comment.isDocumentation); 1861 JUnitTestCase.assertTrue(comment.isDocumentation);
1584 JUnitTestCase.assertFalse(comment.isEndOfLine); 1862 JUnitTestCase.assertFalse(comment.isEndOfLine);
1585 NodeList<CommentReference> references = comment.references; 1863 NodeList<CommentReference> references = comment.references;
1586 EngineTestCase.assertSize(1, references); 1864 EngineTestCase.assertSize(1, references);
1587 CommentReference reference = references[0]; 1865 CommentReference reference = references[0];
1588 JUnitTestCase.assertNotNull(reference); 1866 JUnitTestCase.assertNotNull(reference);
1589 JUnitTestCase.assertEquals(5, reference.offset); 1867 JUnitTestCase.assertEquals(5, reference.offset);
1590 } 1868 }
1869
1591 void test_parseDocumentationComment_endOfLine() { 1870 void test_parseDocumentationComment_endOfLine() {
1592 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/// \n /// \n class", []); 1871 Comment comment = ParserTestCase.parse5("parseDocumentationComment", "/// \n /// \n class", []);
1593 JUnitTestCase.assertFalse(comment.isBlock); 1872 JUnitTestCase.assertFalse(comment.isBlock);
1594 JUnitTestCase.assertTrue(comment.isDocumentation); 1873 JUnitTestCase.assertTrue(comment.isDocumentation);
1595 JUnitTestCase.assertFalse(comment.isEndOfLine); 1874 JUnitTestCase.assertFalse(comment.isEndOfLine);
1596 } 1875 }
1876
1597 void test_parseDoStatement() { 1877 void test_parseDoStatement() {
1598 DoStatement statement = ParserTestCase.parse5("parseDoStatement", "do {} whi le (x);", []); 1878 DoStatement statement = ParserTestCase.parse5("parseDoStatement", "do {} whi le (x);", []);
1599 JUnitTestCase.assertNotNull(statement.doKeyword); 1879 JUnitTestCase.assertNotNull(statement.doKeyword);
1600 JUnitTestCase.assertNotNull(statement.body); 1880 JUnitTestCase.assertNotNull(statement.body);
1601 JUnitTestCase.assertNotNull(statement.whileKeyword); 1881 JUnitTestCase.assertNotNull(statement.whileKeyword);
1602 JUnitTestCase.assertNotNull(statement.leftParenthesis); 1882 JUnitTestCase.assertNotNull(statement.leftParenthesis);
1603 JUnitTestCase.assertNotNull(statement.condition); 1883 JUnitTestCase.assertNotNull(statement.condition);
1604 JUnitTestCase.assertNotNull(statement.rightParenthesis); 1884 JUnitTestCase.assertNotNull(statement.rightParenthesis);
1605 JUnitTestCase.assertNotNull(statement.semicolon); 1885 JUnitTestCase.assertNotNull(statement.semicolon);
1606 } 1886 }
1887
1607 void test_parseEmptyStatement() { 1888 void test_parseEmptyStatement() {
1608 EmptyStatement statement = ParserTestCase.parse5("parseEmptyStatement", ";", []); 1889 EmptyStatement statement = ParserTestCase.parse5("parseEmptyStatement", ";", []);
1609 JUnitTestCase.assertNotNull(statement.semicolon); 1890 JUnitTestCase.assertNotNull(statement.semicolon);
1610 } 1891 }
1892
1611 void test_parseEqualityExpression_normal() { 1893 void test_parseEqualityExpression_normal() {
1612 BinaryExpression expression = ParserTestCase.parse5("parseEqualityExpression ", "x == y", []); 1894 BinaryExpression expression = ParserTestCase.parse5("parseEqualityExpression ", "x == y", []);
1613 JUnitTestCase.assertNotNull(expression.leftOperand); 1895 JUnitTestCase.assertNotNull(expression.leftOperand);
1614 JUnitTestCase.assertNotNull(expression.operator); 1896 JUnitTestCase.assertNotNull(expression.operator);
1615 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 1897 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type);
1616 JUnitTestCase.assertNotNull(expression.rightOperand); 1898 JUnitTestCase.assertNotNull(expression.rightOperand);
1617 } 1899 }
1900
1618 void test_parseEqualityExpression_super() { 1901 void test_parseEqualityExpression_super() {
1619 BinaryExpression expression = ParserTestCase.parse5("parseEqualityExpression ", "super == y", []); 1902 BinaryExpression expression = ParserTestCase.parse5("parseEqualityExpression ", "super == y", []);
1620 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 1903 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
1621 JUnitTestCase.assertNotNull(expression.operator); 1904 JUnitTestCase.assertNotNull(expression.operator);
1622 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 1905 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type);
1623 JUnitTestCase.assertNotNull(expression.rightOperand); 1906 JUnitTestCase.assertNotNull(expression.rightOperand);
1624 } 1907 }
1908
1625 void test_parseExportDirective_hide() { 1909 void test_parseExportDirective_hide() {
1626 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A, B;"); 1910 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A, B;");
1627 JUnitTestCase.assertNotNull(directive.keyword); 1911 JUnitTestCase.assertNotNull(directive.keyword);
1628 JUnitTestCase.assertNotNull(directive.uri); 1912 JUnitTestCase.assertNotNull(directive.uri);
1629 EngineTestCase.assertSize(1, directive.combinators); 1913 EngineTestCase.assertSize(1, directive.combinators);
1630 JUnitTestCase.assertNotNull(directive.semicolon); 1914 JUnitTestCase.assertNotNull(directive.semicolon);
1631 } 1915 }
1916
1632 void test_parseExportDirective_hide_show() { 1917 void test_parseExportDirective_hide_show() {
1633 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A show B;"); 1918 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' hide A show B;");
1634 JUnitTestCase.assertNotNull(directive.keyword); 1919 JUnitTestCase.assertNotNull(directive.keyword);
1635 JUnitTestCase.assertNotNull(directive.uri); 1920 JUnitTestCase.assertNotNull(directive.uri);
1636 EngineTestCase.assertSize(2, directive.combinators); 1921 EngineTestCase.assertSize(2, directive.combinators);
1637 JUnitTestCase.assertNotNull(directive.semicolon); 1922 JUnitTestCase.assertNotNull(directive.semicolon);
1638 } 1923 }
1924
1639 void test_parseExportDirective_noCombinator() { 1925 void test_parseExportDirective_noCombinator() {
1640 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart';"); 1926 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart';");
1641 JUnitTestCase.assertNotNull(directive.keyword); 1927 JUnitTestCase.assertNotNull(directive.keyword);
1642 JUnitTestCase.assertNotNull(directive.uri); 1928 JUnitTestCase.assertNotNull(directive.uri);
1643 EngineTestCase.assertSize(0, directive.combinators); 1929 EngineTestCase.assertSize(0, directive.combinators);
1644 JUnitTestCase.assertNotNull(directive.semicolon); 1930 JUnitTestCase.assertNotNull(directive.semicolon);
1645 } 1931 }
1932
1646 void test_parseExportDirective_show() { 1933 void test_parseExportDirective_show() {
1647 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show A, B;"); 1934 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show A, B;");
1648 JUnitTestCase.assertNotNull(directive.keyword); 1935 JUnitTestCase.assertNotNull(directive.keyword);
1649 JUnitTestCase.assertNotNull(directive.uri); 1936 JUnitTestCase.assertNotNull(directive.uri);
1650 EngineTestCase.assertSize(1, directive.combinators); 1937 EngineTestCase.assertSize(1, directive.combinators);
1651 JUnitTestCase.assertNotNull(directive.semicolon); 1938 JUnitTestCase.assertNotNull(directive.semicolon);
1652 } 1939 }
1940
1653 void test_parseExportDirective_show_hide() { 1941 void test_parseExportDirective_show_hide() {
1654 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show B hide A;"); 1942 ExportDirective directive = ParserTestCase.parse("parseExportDirective", <Ob ject> [emptyCommentAndMetadata()], "export 'lib/lib.dart' show B hide A;");
1655 JUnitTestCase.assertNotNull(directive.keyword); 1943 JUnitTestCase.assertNotNull(directive.keyword);
1656 JUnitTestCase.assertNotNull(directive.uri); 1944 JUnitTestCase.assertNotNull(directive.uri);
1657 EngineTestCase.assertSize(2, directive.combinators); 1945 EngineTestCase.assertSize(2, directive.combinators);
1658 JUnitTestCase.assertNotNull(directive.semicolon); 1946 JUnitTestCase.assertNotNull(directive.semicolon);
1659 } 1947 }
1948
1660 void test_parseExpression_assign() { 1949 void test_parseExpression_assign() {
1661 AssignmentExpression expression = ParserTestCase.parse5("parseExpression", " x = y", []); 1950 AssignmentExpression expression = ParserTestCase.parse5("parseExpression", " x = y", []);
1662 JUnitTestCase.assertNotNull(expression.leftHandSide); 1951 JUnitTestCase.assertNotNull(expression.leftHandSide);
1663 JUnitTestCase.assertNotNull(expression.operator); 1952 JUnitTestCase.assertNotNull(expression.operator);
1664 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type); 1953 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type);
1665 JUnitTestCase.assertNotNull(expression.rightHandSide); 1954 JUnitTestCase.assertNotNull(expression.rightHandSide);
1666 } 1955 }
1956
1667 void test_parseExpression_comparison() { 1957 void test_parseExpression_comparison() {
1668 BinaryExpression expression = ParserTestCase.parse5("parseExpression", "--a. b == c", []); 1958 BinaryExpression expression = ParserTestCase.parse5("parseExpression", "--a. b == c", []);
1669 JUnitTestCase.assertNotNull(expression.leftOperand); 1959 JUnitTestCase.assertNotNull(expression.leftOperand);
1670 JUnitTestCase.assertNotNull(expression.operator); 1960 JUnitTestCase.assertNotNull(expression.operator);
1671 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 1961 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type);
1672 JUnitTestCase.assertNotNull(expression.rightOperand); 1962 JUnitTestCase.assertNotNull(expression.rightOperand);
1673 } 1963 }
1964
1674 void test_parseExpression_invokeFunctionExpression() { 1965 void test_parseExpression_invokeFunctionExpression() {
1675 FunctionExpressionInvocation invocation = ParserTestCase.parse5("parseExpres sion", "(a) {return a + a;} (3)", []); 1966 FunctionExpressionInvocation invocation = ParserTestCase.parse5("parseExpres sion", "(a) {return a + a;} (3)", []);
1676 EngineTestCase.assertInstanceOf(FunctionExpression, invocation.function); 1967 EngineTestCase.assertInstanceOf(FunctionExpression, invocation.function);
1677 FunctionExpression expression = invocation.function as FunctionExpression; 1968 FunctionExpression expression = invocation.function as FunctionExpression;
1678 JUnitTestCase.assertNotNull(expression.parameters); 1969 JUnitTestCase.assertNotNull(expression.parameters);
1679 JUnitTestCase.assertNotNull(expression.body); 1970 JUnitTestCase.assertNotNull(expression.body);
1680 ArgumentList list = invocation.argumentList; 1971 ArgumentList list = invocation.argumentList;
1681 JUnitTestCase.assertNotNull(list); 1972 JUnitTestCase.assertNotNull(list);
1682 EngineTestCase.assertSize(1, list.arguments); 1973 EngineTestCase.assertSize(1, list.arguments);
1683 } 1974 }
1975
1684 void test_parseExpression_superMethodInvocation() { 1976 void test_parseExpression_superMethodInvocation() {
1685 MethodInvocation invocation = ParserTestCase.parse5("parseExpression", "supe r.m()", []); 1977 MethodInvocation invocation = ParserTestCase.parse5("parseExpression", "supe r.m()", []);
1686 JUnitTestCase.assertNotNull(invocation.target); 1978 JUnitTestCase.assertNotNull(invocation.target);
1687 JUnitTestCase.assertNotNull(invocation.methodName); 1979 JUnitTestCase.assertNotNull(invocation.methodName);
1688 JUnitTestCase.assertNotNull(invocation.argumentList); 1980 JUnitTestCase.assertNotNull(invocation.argumentList);
1689 } 1981 }
1982
1690 void test_parseExpressionList_multiple() { 1983 void test_parseExpressionList_multiple() {
1691 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3", []); 1984 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3", []);
1692 EngineTestCase.assertSize(3, result); 1985 EngineTestCase.assertSize(3, result);
1693 } 1986 }
1987
1694 void test_parseExpressionList_single() { 1988 void test_parseExpressionList_single() {
1695 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1", []); 1989 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1", []);
1696 EngineTestCase.assertSize(1, result); 1990 EngineTestCase.assertSize(1, result);
1697 } 1991 }
1992
1698 void test_parseExpressionWithoutCascade_assign() { 1993 void test_parseExpressionWithoutCascade_assign() {
1699 AssignmentExpression expression = ParserTestCase.parse5("parseExpressionWith outCascade", "x = y", []); 1994 AssignmentExpression expression = ParserTestCase.parse5("parseExpressionWith outCascade", "x = y", []);
1700 JUnitTestCase.assertNotNull(expression.leftHandSide); 1995 JUnitTestCase.assertNotNull(expression.leftHandSide);
1701 JUnitTestCase.assertNotNull(expression.operator); 1996 JUnitTestCase.assertNotNull(expression.operator);
1702 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type); 1997 JUnitTestCase.assertEquals(TokenType.EQ, expression.operator.type);
1703 JUnitTestCase.assertNotNull(expression.rightHandSide); 1998 JUnitTestCase.assertNotNull(expression.rightHandSide);
1704 } 1999 }
2000
1705 void test_parseExpressionWithoutCascade_comparison() { 2001 void test_parseExpressionWithoutCascade_comparison() {
1706 BinaryExpression expression = ParserTestCase.parse5("parseExpressionWithoutC ascade", "--a.b == c", []); 2002 BinaryExpression expression = ParserTestCase.parse5("parseExpressionWithoutC ascade", "--a.b == c", []);
1707 JUnitTestCase.assertNotNull(expression.leftOperand); 2003 JUnitTestCase.assertNotNull(expression.leftOperand);
1708 JUnitTestCase.assertNotNull(expression.operator); 2004 JUnitTestCase.assertNotNull(expression.operator);
1709 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type); 2005 JUnitTestCase.assertEquals(TokenType.EQ_EQ, expression.operator.type);
1710 JUnitTestCase.assertNotNull(expression.rightOperand); 2006 JUnitTestCase.assertNotNull(expression.rightOperand);
1711 } 2007 }
2008
1712 void test_parseExpressionWithoutCascade_superMethodInvocation() { 2009 void test_parseExpressionWithoutCascade_superMethodInvocation() {
1713 MethodInvocation invocation = ParserTestCase.parse5("parseExpressionWithoutC ascade", "super.m()", []); 2010 MethodInvocation invocation = ParserTestCase.parse5("parseExpressionWithoutC ascade", "super.m()", []);
1714 JUnitTestCase.assertNotNull(invocation.target); 2011 JUnitTestCase.assertNotNull(invocation.target);
1715 JUnitTestCase.assertNotNull(invocation.methodName); 2012 JUnitTestCase.assertNotNull(invocation.methodName);
1716 JUnitTestCase.assertNotNull(invocation.argumentList); 2013 JUnitTestCase.assertNotNull(invocation.argumentList);
1717 } 2014 }
2015
1718 void test_parseExtendsClause() { 2016 void test_parseExtendsClause() {
1719 ExtendsClause clause = ParserTestCase.parse5("parseExtendsClause", "extends B", []); 2017 ExtendsClause clause = ParserTestCase.parse5("parseExtendsClause", "extends B", []);
1720 JUnitTestCase.assertNotNull(clause.keyword); 2018 JUnitTestCase.assertNotNull(clause.keyword);
1721 JUnitTestCase.assertNotNull(clause.superclass); 2019 JUnitTestCase.assertNotNull(clause.superclass);
1722 EngineTestCase.assertInstanceOf(TypeName, clause.superclass); 2020 EngineTestCase.assertInstanceOf(TypeName, clause.superclass);
1723 } 2021 }
2022
1724 void test_parseFinalConstVarOrType_const_noType() { 2023 void test_parseFinalConstVarOrType_const_noType() {
1725 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const"); 2024 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const");
1726 Token keyword = result.keyword; 2025 Token keyword = result.keyword;
1727 JUnitTestCase.assertNotNull(keyword); 2026 JUnitTestCase.assertNotNull(keyword);
1728 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2027 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1729 JUnitTestCase.assertEquals(Keyword.CONST, ((keyword as KeywordToken)).keywor d); 2028 JUnitTestCase.assertEquals(Keyword.CONST, (keyword as KeywordToken).keyword) ;
1730 JUnitTestCase.assertNull(result.type); 2029 JUnitTestCase.assertNull(result.type);
1731 } 2030 }
2031
1732 void test_parseFinalConstVarOrType_const_type() { 2032 void test_parseFinalConstVarOrType_const_type() {
1733 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const A a"); 2033 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "const A a");
1734 Token keyword = result.keyword; 2034 Token keyword = result.keyword;
1735 JUnitTestCase.assertNotNull(keyword); 2035 JUnitTestCase.assertNotNull(keyword);
1736 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2036 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1737 JUnitTestCase.assertEquals(Keyword.CONST, ((keyword as KeywordToken)).keywor d); 2037 JUnitTestCase.assertEquals(Keyword.CONST, (keyword as KeywordToken).keyword) ;
1738 JUnitTestCase.assertNotNull(result.type); 2038 JUnitTestCase.assertNotNull(result.type);
1739 } 2039 }
2040
1740 void test_parseFinalConstVarOrType_final_noType() { 2041 void test_parseFinalConstVarOrType_final_noType() {
1741 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final"); 2042 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final");
1742 Token keyword = result.keyword; 2043 Token keyword = result.keyword;
1743 JUnitTestCase.assertNotNull(keyword); 2044 JUnitTestCase.assertNotNull(keyword);
1744 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2045 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1745 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword as KeywordToken)).keywor d); 2046 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ;
1746 JUnitTestCase.assertNull(result.type); 2047 JUnitTestCase.assertNull(result.type);
1747 } 2048 }
2049
1748 void test_parseFinalConstVarOrType_final_prefixedType() { 2050 void test_parseFinalConstVarOrType_final_prefixedType() {
1749 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final p.A a"); 2051 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final p.A a");
1750 Token keyword = result.keyword; 2052 Token keyword = result.keyword;
1751 JUnitTestCase.assertNotNull(keyword); 2053 JUnitTestCase.assertNotNull(keyword);
1752 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2054 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1753 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword as KeywordToken)).keywor d); 2055 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ;
1754 JUnitTestCase.assertNotNull(result.type); 2056 JUnitTestCase.assertNotNull(result.type);
1755 } 2057 }
2058
1756 void test_parseFinalConstVarOrType_final_type() { 2059 void test_parseFinalConstVarOrType_final_type() {
1757 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a"); 2060 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "final A a");
1758 Token keyword = result.keyword; 2061 Token keyword = result.keyword;
1759 JUnitTestCase.assertNotNull(keyword); 2062 JUnitTestCase.assertNotNull(keyword);
1760 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2063 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1761 JUnitTestCase.assertEquals(Keyword.FINAL, ((keyword as KeywordToken)).keywor d); 2064 JUnitTestCase.assertEquals(Keyword.FINAL, (keyword as KeywordToken).keyword) ;
1762 JUnitTestCase.assertNotNull(result.type); 2065 JUnitTestCase.assertNotNull(result.type);
1763 } 2066 }
2067
1764 void test_parseFinalConstVarOrType_type_parameterized() { 2068 void test_parseFinalConstVarOrType_type_parameterized() {
1765 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a"); 2069 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A<B> a");
1766 JUnitTestCase.assertNull(result.keyword); 2070 JUnitTestCase.assertNull(result.keyword);
1767 JUnitTestCase.assertNotNull(result.type); 2071 JUnitTestCase.assertNotNull(result.type);
1768 } 2072 }
2073
1769 void test_parseFinalConstVarOrType_type_prefixed() { 2074 void test_parseFinalConstVarOrType_type_prefixed() {
1770 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A a"); 2075 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A a");
1771 JUnitTestCase.assertNull(result.keyword); 2076 JUnitTestCase.assertNull(result.keyword);
1772 JUnitTestCase.assertNotNull(result.type); 2077 JUnitTestCase.assertNotNull(result.type);
1773 } 2078 }
2079
1774 void test_parseFinalConstVarOrType_type_prefixedAndParameterized() { 2080 void test_parseFinalConstVarOrType_type_prefixedAndParameterized() {
1775 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A<B> a"); 2081 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "p.A<B> a");
1776 JUnitTestCase.assertNull(result.keyword); 2082 JUnitTestCase.assertNull(result.keyword);
1777 JUnitTestCase.assertNotNull(result.type); 2083 JUnitTestCase.assertNotNull(result.type);
1778 } 2084 }
2085
1779 void test_parseFinalConstVarOrType_type_simple() { 2086 void test_parseFinalConstVarOrType_type_simple() {
1780 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A a"); 2087 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "A a");
1781 JUnitTestCase.assertNull(result.keyword); 2088 JUnitTestCase.assertNull(result.keyword);
1782 JUnitTestCase.assertNotNull(result.type); 2089 JUnitTestCase.assertNotNull(result.type);
1783 } 2090 }
2091
1784 void test_parseFinalConstVarOrType_var() { 2092 void test_parseFinalConstVarOrType_var() {
1785 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "var"); 2093 FinalConstVarOrType result = ParserTestCase.parse("parseFinalConstVarOrType" , <Object> [false], "var");
1786 Token keyword = result.keyword; 2094 Token keyword = result.keyword;
1787 JUnitTestCase.assertNotNull(keyword); 2095 JUnitTestCase.assertNotNull(keyword);
1788 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type); 2096 JUnitTestCase.assertEquals(TokenType.KEYWORD, keyword.type);
1789 JUnitTestCase.assertEquals(Keyword.VAR, ((keyword as KeywordToken)).keyword) ; 2097 JUnitTestCase.assertEquals(Keyword.VAR, (keyword as KeywordToken).keyword);
1790 JUnitTestCase.assertNull(result.type); 2098 JUnitTestCase.assertNull(result.type);
1791 } 2099 }
2100
1792 void test_parseFormalParameter_final_withType_named() { 2101 void test_parseFormalParameter_final_withType_named() {
1793 ParameterKind kind = ParameterKind.NAMED; 2102 ParameterKind kind = ParameterKind.NAMED;
1794 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a : null"); 2103 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a : null");
1795 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2104 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1796 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2105 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1797 JUnitTestCase.assertNotNull(simpleParameter.keyword); 2106 JUnitTestCase.assertNotNull(simpleParameter.keyword);
1798 JUnitTestCase.assertNotNull(simpleParameter.type); 2107 JUnitTestCase.assertNotNull(simpleParameter.type);
1799 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2108 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1800 JUnitTestCase.assertNotNull(parameter.separator); 2109 JUnitTestCase.assertNotNull(parameter.separator);
1801 JUnitTestCase.assertNotNull(parameter.defaultValue); 2110 JUnitTestCase.assertNotNull(parameter.defaultValue);
1802 JUnitTestCase.assertEquals(kind, parameter.kind); 2111 JUnitTestCase.assertEquals(kind, parameter.kind);
1803 } 2112 }
2113
1804 void test_parseFormalParameter_final_withType_normal() { 2114 void test_parseFormalParameter_final_withType_normal() {
1805 ParameterKind kind = ParameterKind.REQUIRED; 2115 ParameterKind kind = ParameterKind.REQUIRED;
1806 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "final A a"); 2116 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "final A a");
1807 JUnitTestCase.assertNotNull(parameter.identifier); 2117 JUnitTestCase.assertNotNull(parameter.identifier);
1808 JUnitTestCase.assertNotNull(parameter.keyword); 2118 JUnitTestCase.assertNotNull(parameter.keyword);
1809 JUnitTestCase.assertNotNull(parameter.type); 2119 JUnitTestCase.assertNotNull(parameter.type);
1810 JUnitTestCase.assertEquals(kind, parameter.kind); 2120 JUnitTestCase.assertEquals(kind, parameter.kind);
1811 } 2121 }
2122
1812 void test_parseFormalParameter_final_withType_positional() { 2123 void test_parseFormalParameter_final_withType_positional() {
1813 ParameterKind kind = ParameterKind.POSITIONAL; 2124 ParameterKind kind = ParameterKind.POSITIONAL;
1814 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a = null"); 2125 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "final A a = null");
1815 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2126 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1816 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2127 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1817 JUnitTestCase.assertNotNull(simpleParameter.keyword); 2128 JUnitTestCase.assertNotNull(simpleParameter.keyword);
1818 JUnitTestCase.assertNotNull(simpleParameter.type); 2129 JUnitTestCase.assertNotNull(simpleParameter.type);
1819 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2130 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1820 JUnitTestCase.assertNotNull(parameter.separator); 2131 JUnitTestCase.assertNotNull(parameter.separator);
1821 JUnitTestCase.assertNotNull(parameter.defaultValue); 2132 JUnitTestCase.assertNotNull(parameter.defaultValue);
1822 JUnitTestCase.assertEquals(kind, parameter.kind); 2133 JUnitTestCase.assertEquals(kind, parameter.kind);
1823 } 2134 }
2135
1824 void test_parseFormalParameter_nonFinal_withType_named() { 2136 void test_parseFormalParameter_nonFinal_withType_named() {
1825 ParameterKind kind = ParameterKind.NAMED; 2137 ParameterKind kind = ParameterKind.NAMED;
1826 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a : null"); 2138 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a : null");
1827 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2139 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1828 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2140 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1829 JUnitTestCase.assertNull(simpleParameter.keyword); 2141 JUnitTestCase.assertNull(simpleParameter.keyword);
1830 JUnitTestCase.assertNotNull(simpleParameter.type); 2142 JUnitTestCase.assertNotNull(simpleParameter.type);
1831 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2143 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1832 JUnitTestCase.assertNotNull(parameter.separator); 2144 JUnitTestCase.assertNotNull(parameter.separator);
1833 JUnitTestCase.assertNotNull(parameter.defaultValue); 2145 JUnitTestCase.assertNotNull(parameter.defaultValue);
1834 JUnitTestCase.assertEquals(kind, parameter.kind); 2146 JUnitTestCase.assertEquals(kind, parameter.kind);
1835 } 2147 }
2148
1836 void test_parseFormalParameter_nonFinal_withType_normal() { 2149 void test_parseFormalParameter_nonFinal_withType_normal() {
1837 ParameterKind kind = ParameterKind.REQUIRED; 2150 ParameterKind kind = ParameterKind.REQUIRED;
1838 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "A a"); 2151 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "A a");
1839 JUnitTestCase.assertNotNull(parameter.identifier); 2152 JUnitTestCase.assertNotNull(parameter.identifier);
1840 JUnitTestCase.assertNull(parameter.keyword); 2153 JUnitTestCase.assertNull(parameter.keyword);
1841 JUnitTestCase.assertNotNull(parameter.type); 2154 JUnitTestCase.assertNotNull(parameter.type);
1842 JUnitTestCase.assertEquals(kind, parameter.kind); 2155 JUnitTestCase.assertEquals(kind, parameter.kind);
1843 } 2156 }
2157
1844 void test_parseFormalParameter_nonFinal_withType_positional() { 2158 void test_parseFormalParameter_nonFinal_withType_positional() {
1845 ParameterKind kind = ParameterKind.POSITIONAL; 2159 ParameterKind kind = ParameterKind.POSITIONAL;
1846 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a = null"); 2160 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "A a = null");
1847 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2161 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1848 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2162 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1849 JUnitTestCase.assertNull(simpleParameter.keyword); 2163 JUnitTestCase.assertNull(simpleParameter.keyword);
1850 JUnitTestCase.assertNotNull(simpleParameter.type); 2164 JUnitTestCase.assertNotNull(simpleParameter.type);
1851 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2165 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1852 JUnitTestCase.assertNotNull(parameter.separator); 2166 JUnitTestCase.assertNotNull(parameter.separator);
1853 JUnitTestCase.assertNotNull(parameter.defaultValue); 2167 JUnitTestCase.assertNotNull(parameter.defaultValue);
1854 JUnitTestCase.assertEquals(kind, parameter.kind); 2168 JUnitTestCase.assertEquals(kind, parameter.kind);
1855 } 2169 }
2170
1856 void test_parseFormalParameter_var() { 2171 void test_parseFormalParameter_var() {
1857 ParameterKind kind = ParameterKind.REQUIRED; 2172 ParameterKind kind = ParameterKind.REQUIRED;
1858 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "var a"); 2173 SimpleFormalParameter parameter = ParserTestCase.parse("parseFormalParameter ", <Object> [kind], "var a");
1859 JUnitTestCase.assertNotNull(parameter.identifier); 2174 JUnitTestCase.assertNotNull(parameter.identifier);
1860 JUnitTestCase.assertNotNull(parameter.keyword); 2175 JUnitTestCase.assertNotNull(parameter.keyword);
1861 JUnitTestCase.assertNull(parameter.type); 2176 JUnitTestCase.assertNull(parameter.type);
1862 JUnitTestCase.assertEquals(kind, parameter.kind); 2177 JUnitTestCase.assertEquals(kind, parameter.kind);
1863 } 2178 }
2179
1864 void test_parseFormalParameter_var_named() { 2180 void test_parseFormalParameter_var_named() {
1865 ParameterKind kind = ParameterKind.NAMED; 2181 ParameterKind kind = ParameterKind.NAMED;
1866 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a : null"); 2182 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a : null");
1867 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2183 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1868 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2184 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1869 JUnitTestCase.assertNotNull(simpleParameter.keyword); 2185 JUnitTestCase.assertNotNull(simpleParameter.keyword);
1870 JUnitTestCase.assertNull(simpleParameter.type); 2186 JUnitTestCase.assertNull(simpleParameter.type);
1871 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2187 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1872 JUnitTestCase.assertNotNull(parameter.separator); 2188 JUnitTestCase.assertNotNull(parameter.separator);
1873 JUnitTestCase.assertNotNull(parameter.defaultValue); 2189 JUnitTestCase.assertNotNull(parameter.defaultValue);
1874 JUnitTestCase.assertEquals(kind, parameter.kind); 2190 JUnitTestCase.assertEquals(kind, parameter.kind);
1875 } 2191 }
2192
1876 void test_parseFormalParameter_var_positional() { 2193 void test_parseFormalParameter_var_positional() {
1877 ParameterKind kind = ParameterKind.POSITIONAL; 2194 ParameterKind kind = ParameterKind.POSITIONAL;
1878 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a = null"); 2195 DefaultFormalParameter parameter = ParserTestCase.parse("parseFormalParamete r", <Object> [kind], "var a = null");
1879 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter; 2196 SimpleFormalParameter simpleParameter = parameter.parameter as SimpleFormalP arameter;
1880 JUnitTestCase.assertNotNull(simpleParameter.identifier); 2197 JUnitTestCase.assertNotNull(simpleParameter.identifier);
1881 JUnitTestCase.assertNotNull(simpleParameter.keyword); 2198 JUnitTestCase.assertNotNull(simpleParameter.keyword);
1882 JUnitTestCase.assertNull(simpleParameter.type); 2199 JUnitTestCase.assertNull(simpleParameter.type);
1883 JUnitTestCase.assertEquals(kind, simpleParameter.kind); 2200 JUnitTestCase.assertEquals(kind, simpleParameter.kind);
1884 JUnitTestCase.assertNotNull(parameter.separator); 2201 JUnitTestCase.assertNotNull(parameter.separator);
1885 JUnitTestCase.assertNotNull(parameter.defaultValue); 2202 JUnitTestCase.assertNotNull(parameter.defaultValue);
1886 JUnitTestCase.assertEquals(kind, parameter.kind); 2203 JUnitTestCase.assertEquals(kind, parameter.kind);
1887 } 2204 }
2205
1888 void test_parseFormalParameterList_empty() { 2206 void test_parseFormalParameterList_empty() {
1889 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "()", []); 2207 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "()", []);
1890 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2208 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1891 JUnitTestCase.assertNull(parameterList.leftDelimiter); 2209 JUnitTestCase.assertNull(parameterList.leftDelimiter);
1892 EngineTestCase.assertSize(0, parameterList.parameters); 2210 EngineTestCase.assertSize(0, parameterList.parameters);
1893 JUnitTestCase.assertNull(parameterList.rightDelimiter); 2211 JUnitTestCase.assertNull(parameterList.rightDelimiter);
1894 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2212 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1895 } 2213 }
2214
1896 void test_parseFormalParameterList_named_multiple() { 2215 void test_parseFormalParameterList_named_multiple() {
1897 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "({A a : 1, B b, C c : 3})", []); 2216 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "({A a : 1, B b, C c : 3})", []);
1898 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2217 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1899 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2218 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1900 EngineTestCase.assertSize(3, parameterList.parameters); 2219 EngineTestCase.assertSize(3, parameterList.parameters);
1901 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2220 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1902 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2221 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1903 } 2222 }
2223
1904 void test_parseFormalParameterList_named_single() { 2224 void test_parseFormalParameterList_named_single() {
1905 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "({A a})", []); 2225 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "({A a})", []);
1906 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2226 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1907 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2227 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1908 EngineTestCase.assertSize(1, parameterList.parameters); 2228 EngineTestCase.assertSize(1, parameterList.parameters);
1909 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2229 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1910 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2230 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1911 } 2231 }
2232
1912 void test_parseFormalParameterList_normal_multiple() { 2233 void test_parseFormalParameterList_normal_multiple() {
1913 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, B b, C c)", []); 2234 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, B b, C c)", []);
1914 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2235 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1915 JUnitTestCase.assertNull(parameterList.leftDelimiter); 2236 JUnitTestCase.assertNull(parameterList.leftDelimiter);
1916 EngineTestCase.assertSize(3, parameterList.parameters); 2237 EngineTestCase.assertSize(3, parameterList.parameters);
1917 JUnitTestCase.assertNull(parameterList.rightDelimiter); 2238 JUnitTestCase.assertNull(parameterList.rightDelimiter);
1918 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2239 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1919 } 2240 }
2241
1920 void test_parseFormalParameterList_normal_named() { 2242 void test_parseFormalParameterList_normal_named() {
1921 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, {B b})", []); 2243 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, {B b})", []);
1922 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2244 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1923 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2245 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1924 EngineTestCase.assertSize(2, parameterList.parameters); 2246 EngineTestCase.assertSize(2, parameterList.parameters);
1925 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2247 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1926 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2248 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1927 } 2249 }
2250
1928 void test_parseFormalParameterList_normal_positional() { 2251 void test_parseFormalParameterList_normal_positional() {
1929 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, [B b])", []); 2252 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a, [B b])", []);
1930 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2253 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1931 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2254 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1932 EngineTestCase.assertSize(2, parameterList.parameters); 2255 EngineTestCase.assertSize(2, parameterList.parameters);
1933 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2256 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1934 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2257 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1935 } 2258 }
2259
1936 void test_parseFormalParameterList_normal_single() { 2260 void test_parseFormalParameterList_normal_single() {
1937 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a)", []); 2261 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "(A a)", []);
1938 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2262 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1939 JUnitTestCase.assertNull(parameterList.leftDelimiter); 2263 JUnitTestCase.assertNull(parameterList.leftDelimiter);
1940 EngineTestCase.assertSize(1, parameterList.parameters); 2264 EngineTestCase.assertSize(1, parameterList.parameters);
1941 JUnitTestCase.assertNull(parameterList.rightDelimiter); 2265 JUnitTestCase.assertNull(parameterList.rightDelimiter);
1942 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2266 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1943 } 2267 }
2268
1944 void test_parseFormalParameterList_positional_multiple() { 2269 void test_parseFormalParameterList_positional_multiple() {
1945 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "([A a = null, B b, C c = null])", []); 2270 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "([A a = null, B b, C c = null])", []);
1946 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2271 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1947 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2272 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1948 EngineTestCase.assertSize(3, parameterList.parameters); 2273 EngineTestCase.assertSize(3, parameterList.parameters);
1949 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2274 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1950 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2275 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1951 } 2276 }
2277
1952 void test_parseFormalParameterList_positional_single() { 2278 void test_parseFormalParameterList_positional_single() {
1953 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "([A a = null])", []); 2279 FormalParameterList parameterList = ParserTestCase.parse5("parseFormalParame terList", "([A a = null])", []);
1954 JUnitTestCase.assertNotNull(parameterList.leftParenthesis); 2280 JUnitTestCase.assertNotNull(parameterList.leftParenthesis);
1955 JUnitTestCase.assertNotNull(parameterList.leftDelimiter); 2281 JUnitTestCase.assertNotNull(parameterList.leftDelimiter);
1956 EngineTestCase.assertSize(1, parameterList.parameters); 2282 EngineTestCase.assertSize(1, parameterList.parameters);
1957 JUnitTestCase.assertNotNull(parameterList.rightDelimiter); 2283 JUnitTestCase.assertNotNull(parameterList.rightDelimiter);
1958 JUnitTestCase.assertNotNull(parameterList.rightParenthesis); 2284 JUnitTestCase.assertNotNull(parameterList.rightParenthesis);
1959 } 2285 }
2286
1960 void test_parseForStatement_each_identifier() { 2287 void test_parseForStatement_each_identifier() {
1961 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (element in list) {}", []); 2288 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (element in list) {}", []);
1962 JUnitTestCase.assertNotNull(statement.forKeyword); 2289 JUnitTestCase.assertNotNull(statement.forKeyword);
1963 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2290 JUnitTestCase.assertNotNull(statement.leftParenthesis);
1964 JUnitTestCase.assertNull(statement.loopVariable); 2291 JUnitTestCase.assertNull(statement.loopVariable);
1965 JUnitTestCase.assertNotNull(statement.identifier); 2292 JUnitTestCase.assertNotNull(statement.identifier);
1966 JUnitTestCase.assertNotNull(statement.inKeyword); 2293 JUnitTestCase.assertNotNull(statement.inKeyword);
1967 JUnitTestCase.assertNotNull(statement.iterator); 2294 JUnitTestCase.assertNotNull(statement.iterator);
1968 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2295 JUnitTestCase.assertNotNull(statement.rightParenthesis);
1969 JUnitTestCase.assertNotNull(statement.body); 2296 JUnitTestCase.assertNotNull(statement.body);
1970 } 2297 }
2298
1971 void test_parseForStatement_each_noType_metadata() { 2299 void test_parseForStatement_each_noType_metadata() {
1972 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (@A var element in list) {}", []); 2300 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (@A var element in list) {}", []);
1973 JUnitTestCase.assertNotNull(statement.forKeyword); 2301 JUnitTestCase.assertNotNull(statement.forKeyword);
1974 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2302 JUnitTestCase.assertNotNull(statement.leftParenthesis);
1975 JUnitTestCase.assertNotNull(statement.loopVariable); 2303 JUnitTestCase.assertNotNull(statement.loopVariable);
1976 EngineTestCase.assertSize(1, statement.loopVariable.metadata); 2304 EngineTestCase.assertSize(1, statement.loopVariable.metadata);
1977 JUnitTestCase.assertNull(statement.identifier); 2305 JUnitTestCase.assertNull(statement.identifier);
1978 JUnitTestCase.assertNotNull(statement.inKeyword); 2306 JUnitTestCase.assertNotNull(statement.inKeyword);
1979 JUnitTestCase.assertNotNull(statement.iterator); 2307 JUnitTestCase.assertNotNull(statement.iterator);
1980 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2308 JUnitTestCase.assertNotNull(statement.rightParenthesis);
1981 JUnitTestCase.assertNotNull(statement.body); 2309 JUnitTestCase.assertNotNull(statement.body);
1982 } 2310 }
2311
1983 void test_parseForStatement_each_type() { 2312 void test_parseForStatement_each_type() {
1984 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (A element in list) {}", []); 2313 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (A element in list) {}", []);
1985 JUnitTestCase.assertNotNull(statement.forKeyword); 2314 JUnitTestCase.assertNotNull(statement.forKeyword);
1986 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2315 JUnitTestCase.assertNotNull(statement.leftParenthesis);
1987 JUnitTestCase.assertNotNull(statement.loopVariable); 2316 JUnitTestCase.assertNotNull(statement.loopVariable);
1988 JUnitTestCase.assertNull(statement.identifier); 2317 JUnitTestCase.assertNull(statement.identifier);
1989 JUnitTestCase.assertNotNull(statement.inKeyword); 2318 JUnitTestCase.assertNotNull(statement.inKeyword);
1990 JUnitTestCase.assertNotNull(statement.iterator); 2319 JUnitTestCase.assertNotNull(statement.iterator);
1991 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2320 JUnitTestCase.assertNotNull(statement.rightParenthesis);
1992 JUnitTestCase.assertNotNull(statement.body); 2321 JUnitTestCase.assertNotNull(statement.body);
1993 } 2322 }
2323
1994 void test_parseForStatement_each_var() { 2324 void test_parseForStatement_each_var() {
1995 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (var element in list) {}", []); 2325 ForEachStatement statement = ParserTestCase.parse5("parseForStatement", "for (var element in list) {}", []);
1996 JUnitTestCase.assertNotNull(statement.forKeyword); 2326 JUnitTestCase.assertNotNull(statement.forKeyword);
1997 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2327 JUnitTestCase.assertNotNull(statement.leftParenthesis);
1998 JUnitTestCase.assertNotNull(statement.loopVariable); 2328 JUnitTestCase.assertNotNull(statement.loopVariable);
1999 JUnitTestCase.assertNull(statement.identifier); 2329 JUnitTestCase.assertNull(statement.identifier);
2000 JUnitTestCase.assertNotNull(statement.inKeyword); 2330 JUnitTestCase.assertNotNull(statement.inKeyword);
2001 JUnitTestCase.assertNotNull(statement.iterator); 2331 JUnitTestCase.assertNotNull(statement.iterator);
2002 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2332 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2003 JUnitTestCase.assertNotNull(statement.body); 2333 JUnitTestCase.assertNotNull(statement.body);
2004 } 2334 }
2335
2005 void test_parseForStatement_loop_c() { 2336 void test_parseForStatement_loop_c() {
2006 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (; i < count;) {}", []); 2337 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (; i < count;) {}", []);
2007 JUnitTestCase.assertNotNull(statement.forKeyword); 2338 JUnitTestCase.assertNotNull(statement.forKeyword);
2008 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2339 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2009 JUnitTestCase.assertNull(statement.variables); 2340 JUnitTestCase.assertNull(statement.variables);
2010 JUnitTestCase.assertNull(statement.initialization); 2341 JUnitTestCase.assertNull(statement.initialization);
2011 JUnitTestCase.assertNotNull(statement.leftSeparator); 2342 JUnitTestCase.assertNotNull(statement.leftSeparator);
2012 JUnitTestCase.assertNotNull(statement.condition); 2343 JUnitTestCase.assertNotNull(statement.condition);
2013 JUnitTestCase.assertNotNull(statement.rightSeparator); 2344 JUnitTestCase.assertNotNull(statement.rightSeparator);
2014 EngineTestCase.assertSize(0, statement.updaters); 2345 EngineTestCase.assertSize(0, statement.updaters);
2015 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2346 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2016 JUnitTestCase.assertNotNull(statement.body); 2347 JUnitTestCase.assertNotNull(statement.body);
2017 } 2348 }
2349
2018 void test_parseForStatement_loop_cu() { 2350 void test_parseForStatement_loop_cu() {
2019 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (; i < count; i++) {}", []); 2351 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (; i < count; i++) {}", []);
2020 JUnitTestCase.assertNotNull(statement.forKeyword); 2352 JUnitTestCase.assertNotNull(statement.forKeyword);
2021 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2353 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2022 JUnitTestCase.assertNull(statement.variables); 2354 JUnitTestCase.assertNull(statement.variables);
2023 JUnitTestCase.assertNull(statement.initialization); 2355 JUnitTestCase.assertNull(statement.initialization);
2024 JUnitTestCase.assertNotNull(statement.leftSeparator); 2356 JUnitTestCase.assertNotNull(statement.leftSeparator);
2025 JUnitTestCase.assertNotNull(statement.condition); 2357 JUnitTestCase.assertNotNull(statement.condition);
2026 JUnitTestCase.assertNotNull(statement.rightSeparator); 2358 JUnitTestCase.assertNotNull(statement.rightSeparator);
2027 EngineTestCase.assertSize(1, statement.updaters); 2359 EngineTestCase.assertSize(1, statement.updaters);
2028 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2360 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2029 JUnitTestCase.assertNotNull(statement.body); 2361 JUnitTestCase.assertNotNull(statement.body);
2030 } 2362 }
2363
2031 void test_parseForStatement_loop_ecu() { 2364 void test_parseForStatement_loop_ecu() {
2032 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (i- -; i < count; i++) {}", []); 2365 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (i- -; i < count; i++) {}", []);
2033 JUnitTestCase.assertNotNull(statement.forKeyword); 2366 JUnitTestCase.assertNotNull(statement.forKeyword);
2034 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2367 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2035 JUnitTestCase.assertNull(statement.variables); 2368 JUnitTestCase.assertNull(statement.variables);
2036 JUnitTestCase.assertNotNull(statement.initialization); 2369 JUnitTestCase.assertNotNull(statement.initialization);
2037 JUnitTestCase.assertNotNull(statement.leftSeparator); 2370 JUnitTestCase.assertNotNull(statement.leftSeparator);
2038 JUnitTestCase.assertNotNull(statement.condition); 2371 JUnitTestCase.assertNotNull(statement.condition);
2039 JUnitTestCase.assertNotNull(statement.rightSeparator); 2372 JUnitTestCase.assertNotNull(statement.rightSeparator);
2040 EngineTestCase.assertSize(1, statement.updaters); 2373 EngineTestCase.assertSize(1, statement.updaters);
2041 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2374 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2042 JUnitTestCase.assertNotNull(statement.body); 2375 JUnitTestCase.assertNotNull(statement.body);
2043 } 2376 }
2377
2044 void test_parseForStatement_loop_i() { 2378 void test_parseForStatement_loop_i() {
2045 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0;;) {}", []); 2379 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0;;) {}", []);
2046 JUnitTestCase.assertNotNull(statement.forKeyword); 2380 JUnitTestCase.assertNotNull(statement.forKeyword);
2047 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2381 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2048 VariableDeclarationList variables = statement.variables; 2382 VariableDeclarationList variables = statement.variables;
2049 JUnitTestCase.assertNotNull(variables); 2383 JUnitTestCase.assertNotNull(variables);
2050 EngineTestCase.assertSize(0, variables.metadata); 2384 EngineTestCase.assertSize(0, variables.metadata);
2051 EngineTestCase.assertSize(1, variables.variables); 2385 EngineTestCase.assertSize(1, variables.variables);
2052 JUnitTestCase.assertNull(statement.initialization); 2386 JUnitTestCase.assertNull(statement.initialization);
2053 JUnitTestCase.assertNotNull(statement.leftSeparator); 2387 JUnitTestCase.assertNotNull(statement.leftSeparator);
2054 JUnitTestCase.assertNull(statement.condition); 2388 JUnitTestCase.assertNull(statement.condition);
2055 JUnitTestCase.assertNotNull(statement.rightSeparator); 2389 JUnitTestCase.assertNotNull(statement.rightSeparator);
2056 EngineTestCase.assertSize(0, statement.updaters); 2390 EngineTestCase.assertSize(0, statement.updaters);
2057 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2391 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2058 JUnitTestCase.assertNotNull(statement.body); 2392 JUnitTestCase.assertNotNull(statement.body);
2059 } 2393 }
2394
2060 void test_parseForStatement_loop_i_withMetadata() { 2395 void test_parseForStatement_loop_i_withMetadata() {
2061 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (@A var i = 0;;) {}", []); 2396 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (@A var i = 0;;) {}", []);
2062 JUnitTestCase.assertNotNull(statement.forKeyword); 2397 JUnitTestCase.assertNotNull(statement.forKeyword);
2063 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2398 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2064 VariableDeclarationList variables = statement.variables; 2399 VariableDeclarationList variables = statement.variables;
2065 JUnitTestCase.assertNotNull(variables); 2400 JUnitTestCase.assertNotNull(variables);
2066 EngineTestCase.assertSize(1, variables.metadata); 2401 EngineTestCase.assertSize(1, variables.metadata);
2067 EngineTestCase.assertSize(1, variables.variables); 2402 EngineTestCase.assertSize(1, variables.variables);
2068 JUnitTestCase.assertNull(statement.initialization); 2403 JUnitTestCase.assertNull(statement.initialization);
2069 JUnitTestCase.assertNotNull(statement.leftSeparator); 2404 JUnitTestCase.assertNotNull(statement.leftSeparator);
2070 JUnitTestCase.assertNull(statement.condition); 2405 JUnitTestCase.assertNull(statement.condition);
2071 JUnitTestCase.assertNotNull(statement.rightSeparator); 2406 JUnitTestCase.assertNotNull(statement.rightSeparator);
2072 EngineTestCase.assertSize(0, statement.updaters); 2407 EngineTestCase.assertSize(0, statement.updaters);
2073 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2408 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2074 JUnitTestCase.assertNotNull(statement.body); 2409 JUnitTestCase.assertNotNull(statement.body);
2075 } 2410 }
2411
2076 void test_parseForStatement_loop_ic() { 2412 void test_parseForStatement_loop_ic() {
2077 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0; i < count;) {}", []); 2413 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0; i < count;) {}", []);
2078 JUnitTestCase.assertNotNull(statement.forKeyword); 2414 JUnitTestCase.assertNotNull(statement.forKeyword);
2079 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2415 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2080 VariableDeclarationList variables = statement.variables; 2416 VariableDeclarationList variables = statement.variables;
2081 JUnitTestCase.assertNotNull(variables); 2417 JUnitTestCase.assertNotNull(variables);
2082 EngineTestCase.assertSize(1, variables.variables); 2418 EngineTestCase.assertSize(1, variables.variables);
2083 JUnitTestCase.assertNull(statement.initialization); 2419 JUnitTestCase.assertNull(statement.initialization);
2084 JUnitTestCase.assertNotNull(statement.leftSeparator); 2420 JUnitTestCase.assertNotNull(statement.leftSeparator);
2085 JUnitTestCase.assertNotNull(statement.condition); 2421 JUnitTestCase.assertNotNull(statement.condition);
2086 JUnitTestCase.assertNotNull(statement.rightSeparator); 2422 JUnitTestCase.assertNotNull(statement.rightSeparator);
2087 EngineTestCase.assertSize(0, statement.updaters); 2423 EngineTestCase.assertSize(0, statement.updaters);
2088 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2424 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2089 JUnitTestCase.assertNotNull(statement.body); 2425 JUnitTestCase.assertNotNull(statement.body);
2090 } 2426 }
2427
2091 void test_parseForStatement_loop_icu() { 2428 void test_parseForStatement_loop_icu() {
2092 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0; i < count; i++) {}", []); 2429 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0; i < count; i++) {}", []);
2093 JUnitTestCase.assertNotNull(statement.forKeyword); 2430 JUnitTestCase.assertNotNull(statement.forKeyword);
2094 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2431 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2095 VariableDeclarationList variables = statement.variables; 2432 VariableDeclarationList variables = statement.variables;
2096 JUnitTestCase.assertNotNull(variables); 2433 JUnitTestCase.assertNotNull(variables);
2097 EngineTestCase.assertSize(1, variables.variables); 2434 EngineTestCase.assertSize(1, variables.variables);
2098 JUnitTestCase.assertNull(statement.initialization); 2435 JUnitTestCase.assertNull(statement.initialization);
2099 JUnitTestCase.assertNotNull(statement.leftSeparator); 2436 JUnitTestCase.assertNotNull(statement.leftSeparator);
2100 JUnitTestCase.assertNotNull(statement.condition); 2437 JUnitTestCase.assertNotNull(statement.condition);
2101 JUnitTestCase.assertNotNull(statement.rightSeparator); 2438 JUnitTestCase.assertNotNull(statement.rightSeparator);
2102 EngineTestCase.assertSize(1, statement.updaters); 2439 EngineTestCase.assertSize(1, statement.updaters);
2103 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2440 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2104 JUnitTestCase.assertNotNull(statement.body); 2441 JUnitTestCase.assertNotNull(statement.body);
2105 } 2442 }
2443
2106 void test_parseForStatement_loop_iicuu() { 2444 void test_parseForStatement_loop_iicuu() {
2107 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (in t i = 0, j = count; i < j; i++, j--) {}", []); 2445 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (in t i = 0, j = count; i < j; i++, j--) {}", []);
2108 JUnitTestCase.assertNotNull(statement.forKeyword); 2446 JUnitTestCase.assertNotNull(statement.forKeyword);
2109 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2447 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2110 VariableDeclarationList variables = statement.variables; 2448 VariableDeclarationList variables = statement.variables;
2111 JUnitTestCase.assertNotNull(variables); 2449 JUnitTestCase.assertNotNull(variables);
2112 EngineTestCase.assertSize(2, variables.variables); 2450 EngineTestCase.assertSize(2, variables.variables);
2113 JUnitTestCase.assertNull(statement.initialization); 2451 JUnitTestCase.assertNull(statement.initialization);
2114 JUnitTestCase.assertNotNull(statement.leftSeparator); 2452 JUnitTestCase.assertNotNull(statement.leftSeparator);
2115 JUnitTestCase.assertNotNull(statement.condition); 2453 JUnitTestCase.assertNotNull(statement.condition);
2116 JUnitTestCase.assertNotNull(statement.rightSeparator); 2454 JUnitTestCase.assertNotNull(statement.rightSeparator);
2117 EngineTestCase.assertSize(2, statement.updaters); 2455 EngineTestCase.assertSize(2, statement.updaters);
2118 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2456 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2119 JUnitTestCase.assertNotNull(statement.body); 2457 JUnitTestCase.assertNotNull(statement.body);
2120 } 2458 }
2459
2121 void test_parseForStatement_loop_iu() { 2460 void test_parseForStatement_loop_iu() {
2122 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0;; i++) {}", []); 2461 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (va r i = 0;; i++) {}", []);
2123 JUnitTestCase.assertNotNull(statement.forKeyword); 2462 JUnitTestCase.assertNotNull(statement.forKeyword);
2124 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2463 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2125 VariableDeclarationList variables = statement.variables; 2464 VariableDeclarationList variables = statement.variables;
2126 JUnitTestCase.assertNotNull(variables); 2465 JUnitTestCase.assertNotNull(variables);
2127 EngineTestCase.assertSize(1, variables.variables); 2466 EngineTestCase.assertSize(1, variables.variables);
2128 JUnitTestCase.assertNull(statement.initialization); 2467 JUnitTestCase.assertNull(statement.initialization);
2129 JUnitTestCase.assertNotNull(statement.leftSeparator); 2468 JUnitTestCase.assertNotNull(statement.leftSeparator);
2130 JUnitTestCase.assertNull(statement.condition); 2469 JUnitTestCase.assertNull(statement.condition);
2131 JUnitTestCase.assertNotNull(statement.rightSeparator); 2470 JUnitTestCase.assertNotNull(statement.rightSeparator);
2132 EngineTestCase.assertSize(1, statement.updaters); 2471 EngineTestCase.assertSize(1, statement.updaters);
2133 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2472 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2134 JUnitTestCase.assertNotNull(statement.body); 2473 JUnitTestCase.assertNotNull(statement.body);
2135 } 2474 }
2475
2136 void test_parseForStatement_loop_u() { 2476 void test_parseForStatement_loop_u() {
2137 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (;; i++) {}", []); 2477 ForStatement statement = ParserTestCase.parse5("parseForStatement", "for (;; i++) {}", []);
2138 JUnitTestCase.assertNotNull(statement.forKeyword); 2478 JUnitTestCase.assertNotNull(statement.forKeyword);
2139 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2479 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2140 JUnitTestCase.assertNull(statement.variables); 2480 JUnitTestCase.assertNull(statement.variables);
2141 JUnitTestCase.assertNull(statement.initialization); 2481 JUnitTestCase.assertNull(statement.initialization);
2142 JUnitTestCase.assertNotNull(statement.leftSeparator); 2482 JUnitTestCase.assertNotNull(statement.leftSeparator);
2143 JUnitTestCase.assertNull(statement.condition); 2483 JUnitTestCase.assertNull(statement.condition);
2144 JUnitTestCase.assertNotNull(statement.rightSeparator); 2484 JUnitTestCase.assertNotNull(statement.rightSeparator);
2145 EngineTestCase.assertSize(1, statement.updaters); 2485 EngineTestCase.assertSize(1, statement.updaters);
2146 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2486 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2147 JUnitTestCase.assertNotNull(statement.body); 2487 JUnitTestCase.assertNotNull(statement.body);
2148 } 2488 }
2489
2149 void test_parseFunctionBody_block() { 2490 void test_parseFunctionBody_block() {
2150 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}"); 2491 BlockFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [false, null, false], "{}");
2151 JUnitTestCase.assertNotNull(functionBody.block); 2492 JUnitTestCase.assertNotNull(functionBody.block);
2152 } 2493 }
2494
2153 void test_parseFunctionBody_empty() { 2495 void test_parseFunctionBody_empty() {
2154 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, null, false], ";"); 2496 EmptyFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", < Object> [true, null, false], ";");
2155 JUnitTestCase.assertNotNull(functionBody.semicolon); 2497 JUnitTestCase.assertNotNull(functionBody.semicolon);
2156 } 2498 }
2499
2157 void test_parseFunctionBody_expression() { 2500 void test_parseFunctionBody_expression() {
2158 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "=> y;"); 2501 ExpressionFunctionBody functionBody = ParserTestCase.parse("parseFunctionBod y", <Object> [false, null, false], "=> y;");
2159 JUnitTestCase.assertNotNull(functionBody.functionDefinition); 2502 JUnitTestCase.assertNotNull(functionBody.functionDefinition);
2160 JUnitTestCase.assertNotNull(functionBody.expression); 2503 JUnitTestCase.assertNotNull(functionBody.expression);
2161 JUnitTestCase.assertNotNull(functionBody.semicolon); 2504 JUnitTestCase.assertNotNull(functionBody.semicolon);
2162 } 2505 }
2506
2163 void test_parseFunctionBody_nativeFunctionBody() { 2507 void test_parseFunctionBody_nativeFunctionBody() {
2164 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';"); 2508 NativeFunctionBody functionBody = ParserTestCase.parse("parseFunctionBody", <Object> [false, null, false], "native 'str';");
2165 JUnitTestCase.assertNotNull(functionBody.nativeToken); 2509 JUnitTestCase.assertNotNull(functionBody.nativeToken);
2166 JUnitTestCase.assertNotNull(functionBody.stringLiteral); 2510 JUnitTestCase.assertNotNull(functionBody.stringLiteral);
2167 JUnitTestCase.assertNotNull(functionBody.semicolon); 2511 JUnitTestCase.assertNotNull(functionBody.semicolon);
2168 } 2512 }
2513
2169 void test_parseFunctionDeclaration_function() { 2514 void test_parseFunctionDeclaration_function() {
2170 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2515 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2171 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2516 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2172 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}"); 2517 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "f() {}");
2173 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2518 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2174 JUnitTestCase.assertEquals(returnType, declaration.returnType); 2519 JUnitTestCase.assertEquals(returnType, declaration.returnType);
2175 JUnitTestCase.assertNotNull(declaration.name); 2520 JUnitTestCase.assertNotNull(declaration.name);
2176 FunctionExpression expression = declaration.functionExpression; 2521 FunctionExpression expression = declaration.functionExpression;
2177 JUnitTestCase.assertNotNull(expression); 2522 JUnitTestCase.assertNotNull(expression);
2178 JUnitTestCase.assertNotNull(expression.body); 2523 JUnitTestCase.assertNotNull(expression.body);
2179 JUnitTestCase.assertNotNull(expression.parameters); 2524 JUnitTestCase.assertNotNull(expression.parameters);
2180 JUnitTestCase.assertNull(declaration.propertyKeyword); 2525 JUnitTestCase.assertNull(declaration.propertyKeyword);
2181 } 2526 }
2527
2182 void test_parseFunctionDeclaration_getter() { 2528 void test_parseFunctionDeclaration_getter() {
2183 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2529 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2184 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2530 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2185 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "get p => 0 ;"); 2531 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "get p => 0 ;");
2186 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2532 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2187 JUnitTestCase.assertEquals(returnType, declaration.returnType); 2533 JUnitTestCase.assertEquals(returnType, declaration.returnType);
2188 JUnitTestCase.assertNotNull(declaration.name); 2534 JUnitTestCase.assertNotNull(declaration.name);
2189 FunctionExpression expression = declaration.functionExpression; 2535 FunctionExpression expression = declaration.functionExpression;
2190 JUnitTestCase.assertNotNull(expression); 2536 JUnitTestCase.assertNotNull(expression);
2191 JUnitTestCase.assertNotNull(expression.body); 2537 JUnitTestCase.assertNotNull(expression.body);
2192 JUnitTestCase.assertNull(expression.parameters); 2538 JUnitTestCase.assertNull(expression.parameters);
2193 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 2539 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
2194 } 2540 }
2541
2195 void test_parseFunctionDeclaration_setter() { 2542 void test_parseFunctionDeclaration_setter() {
2196 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2543 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2197 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2544 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2198 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "set p(v) { }"); 2545 FunctionDeclaration declaration = ParserTestCase.parse("parseFunctionDeclara tion", <Object> [commentAndMetadata(comment, []), null, returnType], "set p(v) { }");
2199 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2546 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2200 JUnitTestCase.assertEquals(returnType, declaration.returnType); 2547 JUnitTestCase.assertEquals(returnType, declaration.returnType);
2201 JUnitTestCase.assertNotNull(declaration.name); 2548 JUnitTestCase.assertNotNull(declaration.name);
2202 FunctionExpression expression = declaration.functionExpression; 2549 FunctionExpression expression = declaration.functionExpression;
2203 JUnitTestCase.assertNotNull(expression); 2550 JUnitTestCase.assertNotNull(expression);
2204 JUnitTestCase.assertNotNull(expression.body); 2551 JUnitTestCase.assertNotNull(expression.body);
2205 JUnitTestCase.assertNotNull(expression.parameters); 2552 JUnitTestCase.assertNotNull(expression.parameters);
2206 JUnitTestCase.assertNotNull(declaration.propertyKeyword); 2553 JUnitTestCase.assertNotNull(declaration.propertyKeyword);
2207 } 2554 }
2555
2208 void test_parseFunctionDeclarationStatement() { 2556 void test_parseFunctionDeclarationStatement() {
2209 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseFunctio nDeclarationStatement", "void f(int p) => p * 2;", []); 2557 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseFunctio nDeclarationStatement", "void f(int p) => p * 2;", []);
2210 JUnitTestCase.assertNotNull(statement.functionDeclaration); 2558 JUnitTestCase.assertNotNull(statement.functionDeclaration);
2211 } 2559 }
2560
2212 void test_parseFunctionExpression_body_inExpression() { 2561 void test_parseFunctionExpression_body_inExpression() {
2213 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi on", "(int i) => i++", []); 2562 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi on", "(int i) => i++", []);
2214 JUnitTestCase.assertNotNull(expression.body); 2563 JUnitTestCase.assertNotNull(expression.body);
2215 JUnitTestCase.assertNotNull(expression.parameters); 2564 JUnitTestCase.assertNotNull(expression.parameters);
2216 JUnitTestCase.assertNull(((expression.body as ExpressionFunctionBody)).semic olon); 2565 JUnitTestCase.assertNull((expression.body as ExpressionFunctionBody).semicol on);
2217 } 2566 }
2567
2218 void test_parseFunctionExpression_minimal() { 2568 void test_parseFunctionExpression_minimal() {
2219 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi on", "() {}", []); 2569 FunctionExpression expression = ParserTestCase.parse5("parseFunctionExpressi on", "() {}", []);
2220 JUnitTestCase.assertNotNull(expression.body); 2570 JUnitTestCase.assertNotNull(expression.body);
2221 JUnitTestCase.assertNotNull(expression.parameters); 2571 JUnitTestCase.assertNotNull(expression.parameters);
2222 } 2572 }
2573
2223 void test_parseGetter_nonStatic() { 2574 void test_parseGetter_nonStatic() {
2224 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2575 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2225 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2576 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2226 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "get a;"); 2577 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "get a;");
2227 JUnitTestCase.assertNotNull(method.body); 2578 JUnitTestCase.assertNotNull(method.body);
2228 JUnitTestCase.assertEquals(comment, method.documentationComment); 2579 JUnitTestCase.assertEquals(comment, method.documentationComment);
2229 JUnitTestCase.assertNull(method.externalKeyword); 2580 JUnitTestCase.assertNull(method.externalKeyword);
2230 JUnitTestCase.assertNull(method.modifierKeyword); 2581 JUnitTestCase.assertNull(method.modifierKeyword);
2231 JUnitTestCase.assertNotNull(method.name); 2582 JUnitTestCase.assertNotNull(method.name);
2232 JUnitTestCase.assertNull(method.operatorKeyword); 2583 JUnitTestCase.assertNull(method.operatorKeyword);
2233 JUnitTestCase.assertNull(method.parameters); 2584 JUnitTestCase.assertNull(method.parameters);
2234 JUnitTestCase.assertNotNull(method.propertyKeyword); 2585 JUnitTestCase.assertNotNull(method.propertyKeyword);
2235 JUnitTestCase.assertEquals(returnType, method.returnType); 2586 JUnitTestCase.assertEquals(returnType, method.returnType);
2236 } 2587 }
2588
2237 void test_parseGetter_static() { 2589 void test_parseGetter_static() {
2238 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2590 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2239 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2591 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2240 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 2592 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2241 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [ 2593 MethodDeclaration method = ParserTestCase.parse("parseGetter", <Object> [
2242 commentAndMetadata(comment, []), 2594 commentAndMetadata(comment, []),
2243 null, 2595 null,
2244 staticKeyword, 2596 staticKeyword,
2245 returnType], "get a => 42;"); 2597 returnType], "get a => 42;");
2246 JUnitTestCase.assertNotNull(method.body); 2598 JUnitTestCase.assertNotNull(method.body);
2247 JUnitTestCase.assertEquals(comment, method.documentationComment); 2599 JUnitTestCase.assertEquals(comment, method.documentationComment);
2248 JUnitTestCase.assertNull(method.externalKeyword); 2600 JUnitTestCase.assertNull(method.externalKeyword);
2249 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 2601 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword);
2250 JUnitTestCase.assertNotNull(method.name); 2602 JUnitTestCase.assertNotNull(method.name);
2251 JUnitTestCase.assertNull(method.operatorKeyword); 2603 JUnitTestCase.assertNull(method.operatorKeyword);
2252 JUnitTestCase.assertNull(method.parameters); 2604 JUnitTestCase.assertNull(method.parameters);
2253 JUnitTestCase.assertNotNull(method.propertyKeyword); 2605 JUnitTestCase.assertNotNull(method.propertyKeyword);
2254 JUnitTestCase.assertEquals(returnType, method.returnType); 2606 JUnitTestCase.assertEquals(returnType, method.returnType);
2255 } 2607 }
2608
2256 void test_parseIdentifierList_multiple() { 2609 void test_parseIdentifierList_multiple() {
2257 List<SimpleIdentifier> list = ParserTestCase.parse5("parseIdentifierList", " a, b, c", []); 2610 List<SimpleIdentifier> list = ParserTestCase.parse5("parseIdentifierList", " a, b, c", []);
2258 EngineTestCase.assertSize(3, list); 2611 EngineTestCase.assertSize(3, list);
2259 } 2612 }
2613
2260 void test_parseIdentifierList_single() { 2614 void test_parseIdentifierList_single() {
2261 List<SimpleIdentifier> list = ParserTestCase.parse5("parseIdentifierList", " a", []); 2615 List<SimpleIdentifier> list = ParserTestCase.parse5("parseIdentifierList", " a", []);
2262 EngineTestCase.assertSize(1, list); 2616 EngineTestCase.assertSize(1, list);
2263 } 2617 }
2618
2264 void test_parseIfStatement_else_block() { 2619 void test_parseIfStatement_else_block() {
2265 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) {} else {}", []); 2620 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) {} else {}", []);
2266 JUnitTestCase.assertNotNull(statement.ifKeyword); 2621 JUnitTestCase.assertNotNull(statement.ifKeyword);
2267 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2622 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2268 JUnitTestCase.assertNotNull(statement.condition); 2623 JUnitTestCase.assertNotNull(statement.condition);
2269 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2624 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2270 JUnitTestCase.assertNotNull(statement.thenStatement); 2625 JUnitTestCase.assertNotNull(statement.thenStatement);
2271 JUnitTestCase.assertNotNull(statement.elseKeyword); 2626 JUnitTestCase.assertNotNull(statement.elseKeyword);
2272 JUnitTestCase.assertNotNull(statement.elseStatement); 2627 JUnitTestCase.assertNotNull(statement.elseStatement);
2273 } 2628 }
2629
2274 void test_parseIfStatement_else_statement() { 2630 void test_parseIfStatement_else_statement() {
2275 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) f( x); else f(y);", []); 2631 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) f( x); else f(y);", []);
2276 JUnitTestCase.assertNotNull(statement.ifKeyword); 2632 JUnitTestCase.assertNotNull(statement.ifKeyword);
2277 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2633 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2278 JUnitTestCase.assertNotNull(statement.condition); 2634 JUnitTestCase.assertNotNull(statement.condition);
2279 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2635 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2280 JUnitTestCase.assertNotNull(statement.thenStatement); 2636 JUnitTestCase.assertNotNull(statement.thenStatement);
2281 JUnitTestCase.assertNotNull(statement.elseKeyword); 2637 JUnitTestCase.assertNotNull(statement.elseKeyword);
2282 JUnitTestCase.assertNotNull(statement.elseStatement); 2638 JUnitTestCase.assertNotNull(statement.elseStatement);
2283 } 2639 }
2640
2284 void test_parseIfStatement_noElse_block() { 2641 void test_parseIfStatement_noElse_block() {
2285 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) {} ", []); 2642 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) {} ", []);
2286 JUnitTestCase.assertNotNull(statement.ifKeyword); 2643 JUnitTestCase.assertNotNull(statement.ifKeyword);
2287 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2644 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2288 JUnitTestCase.assertNotNull(statement.condition); 2645 JUnitTestCase.assertNotNull(statement.condition);
2289 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2646 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2290 JUnitTestCase.assertNotNull(statement.thenStatement); 2647 JUnitTestCase.assertNotNull(statement.thenStatement);
2291 JUnitTestCase.assertNull(statement.elseKeyword); 2648 JUnitTestCase.assertNull(statement.elseKeyword);
2292 JUnitTestCase.assertNull(statement.elseStatement); 2649 JUnitTestCase.assertNull(statement.elseStatement);
2293 } 2650 }
2651
2294 void test_parseIfStatement_noElse_statement() { 2652 void test_parseIfStatement_noElse_statement() {
2295 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) f( x);", []); 2653 IfStatement statement = ParserTestCase.parse5("parseIfStatement", "if (x) f( x);", []);
2296 JUnitTestCase.assertNotNull(statement.ifKeyword); 2654 JUnitTestCase.assertNotNull(statement.ifKeyword);
2297 JUnitTestCase.assertNotNull(statement.leftParenthesis); 2655 JUnitTestCase.assertNotNull(statement.leftParenthesis);
2298 JUnitTestCase.assertNotNull(statement.condition); 2656 JUnitTestCase.assertNotNull(statement.condition);
2299 JUnitTestCase.assertNotNull(statement.rightParenthesis); 2657 JUnitTestCase.assertNotNull(statement.rightParenthesis);
2300 JUnitTestCase.assertNotNull(statement.thenStatement); 2658 JUnitTestCase.assertNotNull(statement.thenStatement);
2301 JUnitTestCase.assertNull(statement.elseKeyword); 2659 JUnitTestCase.assertNull(statement.elseKeyword);
2302 JUnitTestCase.assertNull(statement.elseStatement); 2660 JUnitTestCase.assertNull(statement.elseStatement);
2303 } 2661 }
2662
2304 void test_parseImplementsClause_multiple() { 2663 void test_parseImplementsClause_multiple() {
2305 ImplementsClause clause = ParserTestCase.parse5("parseImplementsClause", "im plements A, B, C", []); 2664 ImplementsClause clause = ParserTestCase.parse5("parseImplementsClause", "im plements A, B, C", []);
2306 EngineTestCase.assertSize(3, clause.interfaces); 2665 EngineTestCase.assertSize(3, clause.interfaces);
2307 JUnitTestCase.assertNotNull(clause.keyword); 2666 JUnitTestCase.assertNotNull(clause.keyword);
2308 } 2667 }
2668
2309 void test_parseImplementsClause_single() { 2669 void test_parseImplementsClause_single() {
2310 ImplementsClause clause = ParserTestCase.parse5("parseImplementsClause", "im plements A", []); 2670 ImplementsClause clause = ParserTestCase.parse5("parseImplementsClause", "im plements A", []);
2311 EngineTestCase.assertSize(1, clause.interfaces); 2671 EngineTestCase.assertSize(1, clause.interfaces);
2312 JUnitTestCase.assertNotNull(clause.keyword); 2672 JUnitTestCase.assertNotNull(clause.keyword);
2313 } 2673 }
2674
2314 void test_parseImportDirective_hide() { 2675 void test_parseImportDirective_hide() {
2315 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' hide A, B;"); 2676 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' hide A, B;");
2316 JUnitTestCase.assertNotNull(directive.keyword); 2677 JUnitTestCase.assertNotNull(directive.keyword);
2317 JUnitTestCase.assertNotNull(directive.uri); 2678 JUnitTestCase.assertNotNull(directive.uri);
2318 JUnitTestCase.assertNull(directive.asToken); 2679 JUnitTestCase.assertNull(directive.asToken);
2319 JUnitTestCase.assertNull(directive.prefix); 2680 JUnitTestCase.assertNull(directive.prefix);
2320 EngineTestCase.assertSize(1, directive.combinators); 2681 EngineTestCase.assertSize(1, directive.combinators);
2321 JUnitTestCase.assertNotNull(directive.semicolon); 2682 JUnitTestCase.assertNotNull(directive.semicolon);
2322 } 2683 }
2684
2323 void test_parseImportDirective_noCombinator() { 2685 void test_parseImportDirective_noCombinator() {
2324 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart';"); 2686 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart';");
2325 JUnitTestCase.assertNotNull(directive.keyword); 2687 JUnitTestCase.assertNotNull(directive.keyword);
2326 JUnitTestCase.assertNotNull(directive.uri); 2688 JUnitTestCase.assertNotNull(directive.uri);
2327 JUnitTestCase.assertNull(directive.asToken); 2689 JUnitTestCase.assertNull(directive.asToken);
2328 JUnitTestCase.assertNull(directive.prefix); 2690 JUnitTestCase.assertNull(directive.prefix);
2329 EngineTestCase.assertSize(0, directive.combinators); 2691 EngineTestCase.assertSize(0, directive.combinators);
2330 JUnitTestCase.assertNotNull(directive.semicolon); 2692 JUnitTestCase.assertNotNull(directive.semicolon);
2331 } 2693 }
2694
2332 void test_parseImportDirective_prefix() { 2695 void test_parseImportDirective_prefix() {
2333 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;"); 2696 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a;");
2334 JUnitTestCase.assertNotNull(directive.keyword); 2697 JUnitTestCase.assertNotNull(directive.keyword);
2335 JUnitTestCase.assertNotNull(directive.uri); 2698 JUnitTestCase.assertNotNull(directive.uri);
2336 JUnitTestCase.assertNotNull(directive.asToken); 2699 JUnitTestCase.assertNotNull(directive.asToken);
2337 JUnitTestCase.assertNotNull(directive.prefix); 2700 JUnitTestCase.assertNotNull(directive.prefix);
2338 EngineTestCase.assertSize(0, directive.combinators); 2701 EngineTestCase.assertSize(0, directive.combinators);
2339 JUnitTestCase.assertNotNull(directive.semicolon); 2702 JUnitTestCase.assertNotNull(directive.semicolon);
2340 } 2703 }
2704
2341 void test_parseImportDirective_prefix_hide_show() { 2705 void test_parseImportDirective_prefix_hide_show() {
2342 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a hide A show B;"); 2706 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a hide A show B;");
2343 JUnitTestCase.assertNotNull(directive.keyword); 2707 JUnitTestCase.assertNotNull(directive.keyword);
2344 JUnitTestCase.assertNotNull(directive.uri); 2708 JUnitTestCase.assertNotNull(directive.uri);
2345 JUnitTestCase.assertNotNull(directive.asToken); 2709 JUnitTestCase.assertNotNull(directive.asToken);
2346 JUnitTestCase.assertNotNull(directive.prefix); 2710 JUnitTestCase.assertNotNull(directive.prefix);
2347 EngineTestCase.assertSize(2, directive.combinators); 2711 EngineTestCase.assertSize(2, directive.combinators);
2348 JUnitTestCase.assertNotNull(directive.semicolon); 2712 JUnitTestCase.assertNotNull(directive.semicolon);
2349 } 2713 }
2714
2350 void test_parseImportDirective_prefix_show_hide() { 2715 void test_parseImportDirective_prefix_show_hide() {
2351 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a show B hide A;"); 2716 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' as a show B hide A;");
2352 JUnitTestCase.assertNotNull(directive.keyword); 2717 JUnitTestCase.assertNotNull(directive.keyword);
2353 JUnitTestCase.assertNotNull(directive.uri); 2718 JUnitTestCase.assertNotNull(directive.uri);
2354 JUnitTestCase.assertNotNull(directive.asToken); 2719 JUnitTestCase.assertNotNull(directive.asToken);
2355 JUnitTestCase.assertNotNull(directive.prefix); 2720 JUnitTestCase.assertNotNull(directive.prefix);
2356 EngineTestCase.assertSize(2, directive.combinators); 2721 EngineTestCase.assertSize(2, directive.combinators);
2357 JUnitTestCase.assertNotNull(directive.semicolon); 2722 JUnitTestCase.assertNotNull(directive.semicolon);
2358 } 2723 }
2724
2359 void test_parseImportDirective_show() { 2725 void test_parseImportDirective_show() {
2360 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;"); 2726 ImportDirective directive = ParserTestCase.parse("parseImportDirective", <Ob ject> [emptyCommentAndMetadata()], "import 'lib/lib.dart' show A, B;");
2361 JUnitTestCase.assertNotNull(directive.keyword); 2727 JUnitTestCase.assertNotNull(directive.keyword);
2362 JUnitTestCase.assertNotNull(directive.uri); 2728 JUnitTestCase.assertNotNull(directive.uri);
2363 JUnitTestCase.assertNull(directive.asToken); 2729 JUnitTestCase.assertNull(directive.asToken);
2364 JUnitTestCase.assertNull(directive.prefix); 2730 JUnitTestCase.assertNull(directive.prefix);
2365 EngineTestCase.assertSize(1, directive.combinators); 2731 EngineTestCase.assertSize(1, directive.combinators);
2366 JUnitTestCase.assertNotNull(directive.semicolon); 2732 JUnitTestCase.assertNotNull(directive.semicolon);
2367 } 2733 }
2734
2368 void test_parseInitializedIdentifierList_type() { 2735 void test_parseInitializedIdentifierList_type() {
2369 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2736 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2370 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2737 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2371 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null); 2738 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null);
2372 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 2739 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
2373 commentAndMetadata(comment, []), 2740 commentAndMetadata(comment, []),
2374 staticKeyword, 2741 staticKeyword,
2375 null, 2742 null,
2376 type], "a = 1, b, c = 3;"); 2743 type], "a = 1, b, c = 3;");
2377 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2744 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2378 VariableDeclarationList fields = declaration.fields; 2745 VariableDeclarationList fields = declaration.fields;
2379 JUnitTestCase.assertNotNull(fields); 2746 JUnitTestCase.assertNotNull(fields);
2380 JUnitTestCase.assertNull(fields.keyword); 2747 JUnitTestCase.assertNull(fields.keyword);
2381 JUnitTestCase.assertEquals(type, fields.type); 2748 JUnitTestCase.assertEquals(type, fields.type);
2382 EngineTestCase.assertSize(3, fields.variables); 2749 EngineTestCase.assertSize(3, fields.variables);
2383 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); 2750 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword);
2384 JUnitTestCase.assertNotNull(declaration.semicolon); 2751 JUnitTestCase.assertNotNull(declaration.semicolon);
2385 } 2752 }
2753
2386 void test_parseInitializedIdentifierList_var() { 2754 void test_parseInitializedIdentifierList_var() {
2387 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 2755 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2388 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 2756 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
2389 Token varKeyword = TokenFactory.token(Keyword.VAR); 2757 Token varKeyword = TokenFactory.token(Keyword.VAR);
2390 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [ 2758 FieldDeclaration declaration = ParserTestCase.parse("parseInitializedIdentif ierList", <Object> [
2391 commentAndMetadata(comment, []), 2759 commentAndMetadata(comment, []),
2392 staticKeyword, 2760 staticKeyword,
2393 varKeyword, 2761 varKeyword,
2394 null], "a = 1, b, c = 3;"); 2762 null], "a = 1, b, c = 3;");
2395 JUnitTestCase.assertEquals(comment, declaration.documentationComment); 2763 JUnitTestCase.assertEquals(comment, declaration.documentationComment);
2396 VariableDeclarationList fields = declaration.fields; 2764 VariableDeclarationList fields = declaration.fields;
2397 JUnitTestCase.assertNotNull(fields); 2765 JUnitTestCase.assertNotNull(fields);
2398 JUnitTestCase.assertEquals(varKeyword, fields.keyword); 2766 JUnitTestCase.assertEquals(varKeyword, fields.keyword);
2399 JUnitTestCase.assertNull(fields.type); 2767 JUnitTestCase.assertNull(fields.type);
2400 EngineTestCase.assertSize(3, fields.variables); 2768 EngineTestCase.assertSize(3, fields.variables);
2401 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword); 2769 JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword);
2402 JUnitTestCase.assertNotNull(declaration.semicolon); 2770 JUnitTestCase.assertNotNull(declaration.semicolon);
2403 } 2771 }
2772
2404 void test_parseInstanceCreationExpression_qualifiedType() { 2773 void test_parseInstanceCreationExpression_qualifiedType() {
2405 Token token = TokenFactory.token(Keyword.NEW); 2774 Token token = TokenFactory.token(Keyword.NEW);
2406 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()"); 2775 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B()");
2407 JUnitTestCase.assertEquals(token, expression.keyword); 2776 JUnitTestCase.assertEquals(token, expression.keyword);
2408 ConstructorName name = expression.constructorName; 2777 ConstructorName name = expression.constructorName;
2409 JUnitTestCase.assertNotNull(name); 2778 JUnitTestCase.assertNotNull(name);
2410 JUnitTestCase.assertNotNull(name.type); 2779 JUnitTestCase.assertNotNull(name.type);
2411 JUnitTestCase.assertNull(name.period); 2780 JUnitTestCase.assertNull(name.period);
2412 JUnitTestCase.assertNull(name.name); 2781 JUnitTestCase.assertNull(name.name);
2413 JUnitTestCase.assertNotNull(expression.argumentList); 2782 JUnitTestCase.assertNotNull(expression.argumentList);
2414 } 2783 }
2784
2415 void test_parseInstanceCreationExpression_qualifiedType_named() { 2785 void test_parseInstanceCreationExpression_qualifiedType_named() {
2416 Token token = TokenFactory.token(Keyword.NEW); 2786 Token token = TokenFactory.token(Keyword.NEW);
2417 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B.c()"); 2787 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A.B.c()");
2418 JUnitTestCase.assertEquals(token, expression.keyword); 2788 JUnitTestCase.assertEquals(token, expression.keyword);
2419 ConstructorName name = expression.constructorName; 2789 ConstructorName name = expression.constructorName;
2420 JUnitTestCase.assertNotNull(name); 2790 JUnitTestCase.assertNotNull(name);
2421 JUnitTestCase.assertNotNull(name.type); 2791 JUnitTestCase.assertNotNull(name.type);
2422 JUnitTestCase.assertNotNull(name.period); 2792 JUnitTestCase.assertNotNull(name.period);
2423 JUnitTestCase.assertNotNull(name.name); 2793 JUnitTestCase.assertNotNull(name.name);
2424 JUnitTestCase.assertNotNull(expression.argumentList); 2794 JUnitTestCase.assertNotNull(expression.argumentList);
2425 } 2795 }
2796
2426 void test_parseInstanceCreationExpression_type() { 2797 void test_parseInstanceCreationExpression_type() {
2427 Token token = TokenFactory.token(Keyword.NEW); 2798 Token token = TokenFactory.token(Keyword.NEW);
2428 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A()"); 2799 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A()");
2429 JUnitTestCase.assertEquals(token, expression.keyword); 2800 JUnitTestCase.assertEquals(token, expression.keyword);
2430 ConstructorName name = expression.constructorName; 2801 ConstructorName name = expression.constructorName;
2431 JUnitTestCase.assertNotNull(name); 2802 JUnitTestCase.assertNotNull(name);
2432 JUnitTestCase.assertNotNull(name.type); 2803 JUnitTestCase.assertNotNull(name.type);
2433 JUnitTestCase.assertNull(name.period); 2804 JUnitTestCase.assertNull(name.period);
2434 JUnitTestCase.assertNull(name.name); 2805 JUnitTestCase.assertNull(name.name);
2435 JUnitTestCase.assertNotNull(expression.argumentList); 2806 JUnitTestCase.assertNotNull(expression.argumentList);
2436 } 2807 }
2808
2437 void test_parseInstanceCreationExpression_type_named() { 2809 void test_parseInstanceCreationExpression_type_named() {
2438 Token token = TokenFactory.token(Keyword.NEW); 2810 Token token = TokenFactory.token(Keyword.NEW);
2439 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A<B>.c()"); 2811 InstanceCreationExpression expression = ParserTestCase.parse("parseInstanceC reationExpression", <Object> [token], "A<B>.c()");
2440 JUnitTestCase.assertEquals(token, expression.keyword); 2812 JUnitTestCase.assertEquals(token, expression.keyword);
2441 ConstructorName name = expression.constructorName; 2813 ConstructorName name = expression.constructorName;
2442 JUnitTestCase.assertNotNull(name); 2814 JUnitTestCase.assertNotNull(name);
2443 JUnitTestCase.assertNotNull(name.type); 2815 JUnitTestCase.assertNotNull(name.type);
2444 JUnitTestCase.assertNotNull(name.period); 2816 JUnitTestCase.assertNotNull(name.period);
2445 JUnitTestCase.assertNotNull(name.name); 2817 JUnitTestCase.assertNotNull(name.name);
2446 JUnitTestCase.assertNotNull(expression.argumentList); 2818 JUnitTestCase.assertNotNull(expression.argumentList);
2447 } 2819 }
2820
2448 void test_parseLibraryDirective() { 2821 void test_parseLibraryDirective() {
2449 LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective", < Object> [emptyCommentAndMetadata()], "library l;"); 2822 LibraryDirective directive = ParserTestCase.parse("parseLibraryDirective", < Object> [emptyCommentAndMetadata()], "library l;");
2450 JUnitTestCase.assertNotNull(directive.libraryToken); 2823 JUnitTestCase.assertNotNull(directive.libraryToken);
2451 JUnitTestCase.assertNotNull(directive.name); 2824 JUnitTestCase.assertNotNull(directive.name);
2452 JUnitTestCase.assertNotNull(directive.semicolon); 2825 JUnitTestCase.assertNotNull(directive.semicolon);
2453 } 2826 }
2827
2454 void test_parseLibraryIdentifier_multiple() { 2828 void test_parseLibraryIdentifier_multiple() {
2455 String name = "a.b.c"; 2829 String name = "a.b.c";
2456 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier ", name, []); 2830 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier ", name, []);
2457 JUnitTestCase.assertEquals(name, identifier.name); 2831 JUnitTestCase.assertEquals(name, identifier.name);
2458 } 2832 }
2833
2459 void test_parseLibraryIdentifier_single() { 2834 void test_parseLibraryIdentifier_single() {
2460 String name = "a"; 2835 String name = "a";
2461 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier ", name, []); 2836 LibraryIdentifier identifier = ParserTestCase.parse5("parseLibraryIdentifier ", name, []);
2462 JUnitTestCase.assertEquals(name, identifier.name); 2837 JUnitTestCase.assertEquals(name, identifier.name);
2463 } 2838 }
2839
2464 void test_parseListLiteral_empty_oneToken() { 2840 void test_parseListLiteral_empty_oneToken() {
2465 Token token = TokenFactory.token(Keyword.CONST); 2841 Token token = TokenFactory.token(Keyword.CONST);
2466 TypeArgumentList typeArguments = null; 2842 TypeArgumentList typeArguments = null;
2467 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]"); 2843 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[]");
2468 JUnitTestCase.assertEquals(token, literal.constKeyword); 2844 JUnitTestCase.assertEquals(token, literal.constKeyword);
2469 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 2845 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
2470 JUnitTestCase.assertNotNull(literal.leftBracket); 2846 JUnitTestCase.assertNotNull(literal.leftBracket);
2471 EngineTestCase.assertSize(0, literal.elements); 2847 EngineTestCase.assertSize(0, literal.elements);
2472 JUnitTestCase.assertNotNull(literal.rightBracket); 2848 JUnitTestCase.assertNotNull(literal.rightBracket);
2473 } 2849 }
2850
2474 void test_parseListLiteral_empty_twoTokens() { 2851 void test_parseListLiteral_empty_twoTokens() {
2475 Token token = TokenFactory.token(Keyword.CONST); 2852 Token token = TokenFactory.token(Keyword.CONST);
2476 TypeArgumentList typeArguments = null; 2853 TypeArgumentList typeArguments = null;
2477 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]"); 2854 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [tok en, typeArguments], "[ ]");
2478 JUnitTestCase.assertEquals(token, literal.constKeyword); 2855 JUnitTestCase.assertEquals(token, literal.constKeyword);
2479 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 2856 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
2480 JUnitTestCase.assertNotNull(literal.leftBracket); 2857 JUnitTestCase.assertNotNull(literal.leftBracket);
2481 EngineTestCase.assertSize(0, literal.elements); 2858 EngineTestCase.assertSize(0, literal.elements);
2482 JUnitTestCase.assertNotNull(literal.rightBracket); 2859 JUnitTestCase.assertNotNull(literal.rightBracket);
2483 } 2860 }
2861
2484 void test_parseListLiteral_multiple() { 2862 void test_parseListLiteral_multiple() {
2485 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1, 2, 3]"); 2863 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1, 2, 3]");
2486 JUnitTestCase.assertNull(literal.constKeyword); 2864 JUnitTestCase.assertNull(literal.constKeyword);
2487 JUnitTestCase.assertNull(literal.typeArguments); 2865 JUnitTestCase.assertNull(literal.typeArguments);
2488 JUnitTestCase.assertNotNull(literal.leftBracket); 2866 JUnitTestCase.assertNotNull(literal.leftBracket);
2489 EngineTestCase.assertSize(3, literal.elements); 2867 EngineTestCase.assertSize(3, literal.elements);
2490 JUnitTestCase.assertNotNull(literal.rightBracket); 2868 JUnitTestCase.assertNotNull(literal.rightBracket);
2491 } 2869 }
2870
2492 void test_parseListLiteral_single() { 2871 void test_parseListLiteral_single() {
2493 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]"); 2872 ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [nul l, null], "[1]");
2494 JUnitTestCase.assertNull(literal.constKeyword); 2873 JUnitTestCase.assertNull(literal.constKeyword);
2495 JUnitTestCase.assertNull(literal.typeArguments); 2874 JUnitTestCase.assertNull(literal.typeArguments);
2496 JUnitTestCase.assertNotNull(literal.leftBracket); 2875 JUnitTestCase.assertNotNull(literal.leftBracket);
2497 EngineTestCase.assertSize(1, literal.elements); 2876 EngineTestCase.assertSize(1, literal.elements);
2498 JUnitTestCase.assertNotNull(literal.rightBracket); 2877 JUnitTestCase.assertNotNull(literal.rightBracket);
2499 } 2878 }
2879
2500 void test_parseListOrMapLiteral_list_noType() { 2880 void test_parseListOrMapLiteral_list_noType() {
2501 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]"); 2881 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]");
2502 JUnitTestCase.assertNull(literal.constKeyword); 2882 JUnitTestCase.assertNull(literal.constKeyword);
2503 JUnitTestCase.assertNull(literal.typeArguments); 2883 JUnitTestCase.assertNull(literal.typeArguments);
2504 JUnitTestCase.assertNotNull(literal.leftBracket); 2884 JUnitTestCase.assertNotNull(literal.leftBracket);
2505 EngineTestCase.assertSize(1, literal.elements); 2885 EngineTestCase.assertSize(1, literal.elements);
2506 JUnitTestCase.assertNotNull(literal.rightBracket); 2886 JUnitTestCase.assertNotNull(literal.rightBracket);
2507 } 2887 }
2888
2508 void test_parseListOrMapLiteral_list_type() { 2889 void test_parseListOrMapLiteral_list_type() {
2509 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]"); 2890 ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]");
2510 JUnitTestCase.assertNull(literal.constKeyword); 2891 JUnitTestCase.assertNull(literal.constKeyword);
2511 JUnitTestCase.assertNotNull(literal.typeArguments); 2892 JUnitTestCase.assertNotNull(literal.typeArguments);
2512 JUnitTestCase.assertNotNull(literal.leftBracket); 2893 JUnitTestCase.assertNotNull(literal.leftBracket);
2513 EngineTestCase.assertSize(1, literal.elements); 2894 EngineTestCase.assertSize(1, literal.elements);
2514 JUnitTestCase.assertNotNull(literal.rightBracket); 2895 JUnitTestCase.assertNotNull(literal.rightBracket);
2515 } 2896 }
2897
2516 void test_parseListOrMapLiteral_map_noType() { 2898 void test_parseListOrMapLiteral_map_noType() {
2517 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}"); 2899 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
2518 JUnitTestCase.assertNull(literal.constKeyword); 2900 JUnitTestCase.assertNull(literal.constKeyword);
2519 JUnitTestCase.assertNull(literal.typeArguments); 2901 JUnitTestCase.assertNull(literal.typeArguments);
2520 JUnitTestCase.assertNotNull(literal.leftBracket); 2902 JUnitTestCase.assertNotNull(literal.leftBracket);
2521 EngineTestCase.assertSize(1, literal.entries); 2903 EngineTestCase.assertSize(1, literal.entries);
2522 JUnitTestCase.assertNotNull(literal.rightBracket); 2904 JUnitTestCase.assertNotNull(literal.rightBracket);
2523 } 2905 }
2906
2524 void test_parseListOrMapLiteral_map_type() { 2907 void test_parseListOrMapLiteral_map_type() {
2525 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}"); 2908 MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
2526 JUnitTestCase.assertNull(literal.constKeyword); 2909 JUnitTestCase.assertNull(literal.constKeyword);
2527 JUnitTestCase.assertNotNull(literal.typeArguments); 2910 JUnitTestCase.assertNotNull(literal.typeArguments);
2528 JUnitTestCase.assertNotNull(literal.leftBracket); 2911 JUnitTestCase.assertNotNull(literal.leftBracket);
2529 EngineTestCase.assertSize(1, literal.entries); 2912 EngineTestCase.assertSize(1, literal.entries);
2530 JUnitTestCase.assertNotNull(literal.rightBracket); 2913 JUnitTestCase.assertNotNull(literal.rightBracket);
2531 } 2914 }
2915
2532 void test_parseLogicalAndExpression() { 2916 void test_parseLogicalAndExpression() {
2533 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi on", "x && y", []); 2917 BinaryExpression expression = ParserTestCase.parse5("parseLogicalAndExpressi on", "x && y", []);
2534 JUnitTestCase.assertNotNull(expression.leftOperand); 2918 JUnitTestCase.assertNotNull(expression.leftOperand);
2535 JUnitTestCase.assertNotNull(expression.operator); 2919 JUnitTestCase.assertNotNull(expression.operator);
2536 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato r.type); 2920 JUnitTestCase.assertEquals(TokenType.AMPERSAND_AMPERSAND, expression.operato r.type);
2537 JUnitTestCase.assertNotNull(expression.rightOperand); 2921 JUnitTestCase.assertNotNull(expression.rightOperand);
2538 } 2922 }
2923
2539 void test_parseLogicalOrExpression() { 2924 void test_parseLogicalOrExpression() {
2540 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []); 2925 BinaryExpression expression = ParserTestCase.parse5("parseLogicalOrExpressio n", "x || y", []);
2541 JUnitTestCase.assertNotNull(expression.leftOperand); 2926 JUnitTestCase.assertNotNull(expression.leftOperand);
2542 JUnitTestCase.assertNotNull(expression.operator); 2927 JUnitTestCase.assertNotNull(expression.operator);
2543 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type); 2928 JUnitTestCase.assertEquals(TokenType.BAR_BAR, expression.operator.type);
2544 JUnitTestCase.assertNotNull(expression.rightOperand); 2929 JUnitTestCase.assertNotNull(expression.rightOperand);
2545 } 2930 }
2931
2546 void test_parseMapLiteral_empty() { 2932 void test_parseMapLiteral_empty() {
2547 Token token = TokenFactory.token(Keyword.CONST); 2933 Token token = TokenFactory.token(Keyword.CONST);
2548 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([ 2934 TypeArgumentList typeArguments = ASTFactory.typeArgumentList([
2549 ASTFactory.typeName4("String", []), 2935 ASTFactory.typeName4("String", []),
2550 ASTFactory.typeName4("int", [])]); 2936 ASTFactory.typeName4("int", [])]);
2551 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}"); 2937 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token , typeArguments], "{}");
2552 JUnitTestCase.assertEquals(token, literal.constKeyword); 2938 JUnitTestCase.assertEquals(token, literal.constKeyword);
2553 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments); 2939 JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
2554 JUnitTestCase.assertNotNull(literal.leftBracket); 2940 JUnitTestCase.assertNotNull(literal.leftBracket);
2555 EngineTestCase.assertSize(0, literal.entries); 2941 EngineTestCase.assertSize(0, literal.entries);
2556 JUnitTestCase.assertNotNull(literal.rightBracket); 2942 JUnitTestCase.assertNotNull(literal.rightBracket);
2557 } 2943 }
2944
2558 void test_parseMapLiteral_multiple() { 2945 void test_parseMapLiteral_multiple() {
2559 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}"); 2946 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'a' : b, 'x' : y}");
2560 JUnitTestCase.assertNotNull(literal.leftBracket); 2947 JUnitTestCase.assertNotNull(literal.leftBracket);
2561 EngineTestCase.assertSize(2, literal.entries); 2948 EngineTestCase.assertSize(2, literal.entries);
2562 JUnitTestCase.assertNotNull(literal.rightBracket); 2949 JUnitTestCase.assertNotNull(literal.rightBracket);
2563 } 2950 }
2951
2564 void test_parseMapLiteral_single() { 2952 void test_parseMapLiteral_single() {
2565 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}"); 2953 MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [null, null], "{'x' : y}");
2566 JUnitTestCase.assertNotNull(literal.leftBracket); 2954 JUnitTestCase.assertNotNull(literal.leftBracket);
2567 EngineTestCase.assertSize(1, literal.entries); 2955 EngineTestCase.assertSize(1, literal.entries);
2568 JUnitTestCase.assertNotNull(literal.rightBracket); 2956 JUnitTestCase.assertNotNull(literal.rightBracket);
2569 } 2957 }
2958
2570 void test_parseMapLiteralEntry_complex() { 2959 void test_parseMapLiteralEntry_complex() {
2571 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "2 + 2 : y", []); 2960 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "2 + 2 : y", []);
2572 JUnitTestCase.assertNotNull(entry.key); 2961 JUnitTestCase.assertNotNull(entry.key);
2573 JUnitTestCase.assertNotNull(entry.separator); 2962 JUnitTestCase.assertNotNull(entry.separator);
2574 JUnitTestCase.assertNotNull(entry.value); 2963 JUnitTestCase.assertNotNull(entry.value);
2575 } 2964 }
2965
2576 void test_parseMapLiteralEntry_int() { 2966 void test_parseMapLiteralEntry_int() {
2577 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "0 : y ", []); 2967 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "0 : y ", []);
2578 JUnitTestCase.assertNotNull(entry.key); 2968 JUnitTestCase.assertNotNull(entry.key);
2579 JUnitTestCase.assertNotNull(entry.separator); 2969 JUnitTestCase.assertNotNull(entry.separator);
2580 JUnitTestCase.assertNotNull(entry.value); 2970 JUnitTestCase.assertNotNull(entry.value);
2581 } 2971 }
2972
2582 void test_parseMapLiteralEntry_string() { 2973 void test_parseMapLiteralEntry_string() {
2583 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "'x' : y", []); 2974 MapLiteralEntry entry = ParserTestCase.parse5("parseMapLiteralEntry", "'x' : y", []);
2584 JUnitTestCase.assertNotNull(entry.key); 2975 JUnitTestCase.assertNotNull(entry.key);
2585 JUnitTestCase.assertNotNull(entry.separator); 2976 JUnitTestCase.assertNotNull(entry.separator);
2586 JUnitTestCase.assertNotNull(entry.value); 2977 JUnitTestCase.assertNotNull(entry.value);
2587 } 2978 }
2979
2588 void test_parseModifiers_abstract() { 2980 void test_parseModifiers_abstract() {
2589 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "abstract A", []); 2981 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "abstract A", []);
2590 JUnitTestCase.assertNotNull(modifiers.abstractKeyword); 2982 JUnitTestCase.assertNotNull(modifiers.abstractKeyword);
2591 } 2983 }
2984
2592 void test_parseModifiers_const() { 2985 void test_parseModifiers_const() {
2593 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "const A", []) ; 2986 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "const A", []) ;
2594 JUnitTestCase.assertNotNull(modifiers.constKeyword); 2987 JUnitTestCase.assertNotNull(modifiers.constKeyword);
2595 } 2988 }
2989
2596 void test_parseModifiers_external() { 2990 void test_parseModifiers_external() {
2597 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "external A", []); 2991 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "external A", []);
2598 JUnitTestCase.assertNotNull(modifiers.externalKeyword); 2992 JUnitTestCase.assertNotNull(modifiers.externalKeyword);
2599 } 2993 }
2994
2600 void test_parseModifiers_factory() { 2995 void test_parseModifiers_factory() {
2601 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "factory A", [ ]); 2996 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "factory A", [ ]);
2602 JUnitTestCase.assertNotNull(modifiers.factoryKeyword); 2997 JUnitTestCase.assertNotNull(modifiers.factoryKeyword);
2603 } 2998 }
2999
2604 void test_parseModifiers_final() { 3000 void test_parseModifiers_final() {
2605 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "final A", []) ; 3001 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "final A", []) ;
2606 JUnitTestCase.assertNotNull(modifiers.finalKeyword); 3002 JUnitTestCase.assertNotNull(modifiers.finalKeyword);
2607 } 3003 }
3004
2608 void test_parseModifiers_static() { 3005 void test_parseModifiers_static() {
2609 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "static A", [] ); 3006 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "static A", [] );
2610 JUnitTestCase.assertNotNull(modifiers.staticKeyword); 3007 JUnitTestCase.assertNotNull(modifiers.staticKeyword);
2611 } 3008 }
3009
2612 void test_parseModifiers_var() { 3010 void test_parseModifiers_var() {
2613 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "var A", []); 3011 Modifiers modifiers = ParserTestCase.parse5("parseModifiers", "var A", []);
2614 JUnitTestCase.assertNotNull(modifiers.varKeyword); 3012 JUnitTestCase.assertNotNull(modifiers.varKeyword);
2615 } 3013 }
3014
2616 void test_parseMultiplicativeExpression_normal() { 3015 void test_parseMultiplicativeExpression_normal() {
2617 BinaryExpression expression = ParserTestCase.parse5("parseMultiplicativeExpr ession", "x * y", []); 3016 BinaryExpression expression = ParserTestCase.parse5("parseMultiplicativeExpr ession", "x * y", []);
2618 JUnitTestCase.assertNotNull(expression.leftOperand); 3017 JUnitTestCase.assertNotNull(expression.leftOperand);
2619 JUnitTestCase.assertNotNull(expression.operator); 3018 JUnitTestCase.assertNotNull(expression.operator);
2620 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type); 3019 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type);
2621 JUnitTestCase.assertNotNull(expression.rightOperand); 3020 JUnitTestCase.assertNotNull(expression.rightOperand);
2622 } 3021 }
3022
2623 void test_parseMultiplicativeExpression_super() { 3023 void test_parseMultiplicativeExpression_super() {
2624 BinaryExpression expression = ParserTestCase.parse5("parseMultiplicativeExpr ession", "super * y", []); 3024 BinaryExpression expression = ParserTestCase.parse5("parseMultiplicativeExpr ession", "super * y", []);
2625 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand); 3025 EngineTestCase.assertInstanceOf(SuperExpression, expression.leftOperand);
2626 JUnitTestCase.assertNotNull(expression.operator); 3026 JUnitTestCase.assertNotNull(expression.operator);
2627 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type); 3027 JUnitTestCase.assertEquals(TokenType.STAR, expression.operator.type);
2628 JUnitTestCase.assertNotNull(expression.rightOperand); 3028 JUnitTestCase.assertNotNull(expression.rightOperand);
2629 } 3029 }
3030
2630 void test_parseNewExpression() { 3031 void test_parseNewExpression() {
2631 InstanceCreationExpression expression = ParserTestCase.parse5("parseNewExpre ssion", "new A()", []); 3032 InstanceCreationExpression expression = ParserTestCase.parse5("parseNewExpre ssion", "new A()", []);
2632 JUnitTestCase.assertNotNull(expression.keyword); 3033 JUnitTestCase.assertNotNull(expression.keyword);
2633 ConstructorName name = expression.constructorName; 3034 ConstructorName name = expression.constructorName;
2634 JUnitTestCase.assertNotNull(name); 3035 JUnitTestCase.assertNotNull(name);
2635 JUnitTestCase.assertNotNull(name.type); 3036 JUnitTestCase.assertNotNull(name.type);
2636 JUnitTestCase.assertNull(name.period); 3037 JUnitTestCase.assertNull(name.period);
2637 JUnitTestCase.assertNull(name.name); 3038 JUnitTestCase.assertNull(name.name);
2638 JUnitTestCase.assertNotNull(expression.argumentList); 3039 JUnitTestCase.assertNotNull(expression.argumentList);
2639 } 3040 }
3041
2640 void test_parseNonLabeledStatement_const_list_empty() { 3042 void test_parseNonLabeledStatement_const_list_empty() {
2641 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const [];", []); 3043 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const [];", []);
2642 JUnitTestCase.assertNotNull(statement.expression); 3044 JUnitTestCase.assertNotNull(statement.expression);
2643 } 3045 }
3046
2644 void test_parseNonLabeledStatement_const_list_nonEmpty() { 3047 void test_parseNonLabeledStatement_const_list_nonEmpty() {
2645 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const [1, 2];", []); 3048 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const [1, 2];", []);
2646 JUnitTestCase.assertNotNull(statement.expression); 3049 JUnitTestCase.assertNotNull(statement.expression);
2647 } 3050 }
3051
2648 void test_parseNonLabeledStatement_const_map_empty() { 3052 void test_parseNonLabeledStatement_const_map_empty() {
2649 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const {};", []); 3053 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const {};", []);
2650 JUnitTestCase.assertNotNull(statement.expression); 3054 JUnitTestCase.assertNotNull(statement.expression);
2651 } 3055 }
3056
2652 void test_parseNonLabeledStatement_const_map_nonEmpty() { 3057 void test_parseNonLabeledStatement_const_map_nonEmpty() {
2653 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const {'a' : 1};", []); 3058 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const {'a' : 1};", []);
2654 JUnitTestCase.assertNotNull(statement.expression); 3059 JUnitTestCase.assertNotNull(statement.expression);
2655 } 3060 }
3061
2656 void test_parseNonLabeledStatement_const_object() { 3062 void test_parseNonLabeledStatement_const_object() {
2657 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const A();", []); 3063 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const A();", []);
2658 JUnitTestCase.assertNotNull(statement.expression); 3064 JUnitTestCase.assertNotNull(statement.expression);
2659 } 3065 }
3066
2660 void test_parseNonLabeledStatement_const_object_named_typeParameters() { 3067 void test_parseNonLabeledStatement_const_object_named_typeParameters() {
2661 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const A<B>.c();", []); 3068 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "const A<B>.c();", []);
2662 JUnitTestCase.assertNotNull(statement.expression); 3069 JUnitTestCase.assertNotNull(statement.expression);
2663 } 3070 }
3071
2664 void test_parseNonLabeledStatement_constructorInvocation() { 3072 void test_parseNonLabeledStatement_constructorInvocation() {
2665 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "new C().m();", []); 3073 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "new C().m();", []);
2666 JUnitTestCase.assertNotNull(statement.expression); 3074 JUnitTestCase.assertNotNull(statement.expression);
2667 } 3075 }
3076
2668 void test_parseNonLabeledStatement_false() { 3077 void test_parseNonLabeledStatement_false() {
2669 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "false;", []); 3078 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "false;", []);
2670 JUnitTestCase.assertNotNull(statement.expression); 3079 JUnitTestCase.assertNotNull(statement.expression);
2671 } 3080 }
3081
2672 void test_parseNonLabeledStatement_functionDeclaration() { 3082 void test_parseNonLabeledStatement_functionDeclaration() {
2673 ParserTestCase.parse5("parseNonLabeledStatement", "f() {};", []); 3083 ParserTestCase.parse5("parseNonLabeledStatement", "f() {};", []);
2674 } 3084 }
3085
2675 void test_parseNonLabeledStatement_functionDeclaration_arguments() { 3086 void test_parseNonLabeledStatement_functionDeclaration_arguments() {
2676 ParserTestCase.parse5("parseNonLabeledStatement", "f(void g()) {};", []); 3087 ParserTestCase.parse5("parseNonLabeledStatement", "f(void g()) {};", []);
2677 } 3088 }
3089
2678 void test_parseNonLabeledStatement_functionExpressionIndex() { 3090 void test_parseNonLabeledStatement_functionExpressionIndex() {
2679 ParserTestCase.parse5("parseNonLabeledStatement", "() {}[0] = null;", []); 3091 ParserTestCase.parse5("parseNonLabeledStatement", "() {}[0] = null;", []);
2680 } 3092 }
3093
2681 void test_parseNonLabeledStatement_functionInvocation() { 3094 void test_parseNonLabeledStatement_functionInvocation() {
2682 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "f();", []); 3095 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "f();", []);
2683 JUnitTestCase.assertNotNull(statement.expression); 3096 JUnitTestCase.assertNotNull(statement.expression);
2684 } 3097 }
3098
2685 void test_parseNonLabeledStatement_invokeFunctionExpression() { 3099 void test_parseNonLabeledStatement_invokeFunctionExpression() {
2686 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []); 3100 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "(a) {return a + a;} (3);", []);
2687 EngineTestCase.assertInstanceOf(FunctionExpressionInvocation, statement.expr ession); 3101 EngineTestCase.assertInstanceOf(FunctionExpressionInvocation, statement.expr ession);
2688 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation; 3102 FunctionExpressionInvocation invocation = statement.expression as FunctionEx pressionInvocation;
2689 EngineTestCase.assertInstanceOf(FunctionExpression, invocation.function); 3103 EngineTestCase.assertInstanceOf(FunctionExpression, invocation.function);
2690 FunctionExpression expression = invocation.function as FunctionExpression; 3104 FunctionExpression expression = invocation.function as FunctionExpression;
2691 JUnitTestCase.assertNotNull(expression.parameters); 3105 JUnitTestCase.assertNotNull(expression.parameters);
2692 JUnitTestCase.assertNotNull(expression.body); 3106 JUnitTestCase.assertNotNull(expression.body);
2693 ArgumentList list = invocation.argumentList; 3107 ArgumentList list = invocation.argumentList;
2694 JUnitTestCase.assertNotNull(list); 3108 JUnitTestCase.assertNotNull(list);
2695 EngineTestCase.assertSize(1, list.arguments); 3109 EngineTestCase.assertSize(1, list.arguments);
2696 } 3110 }
3111
2697 void test_parseNonLabeledStatement_null() { 3112 void test_parseNonLabeledStatement_null() {
2698 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "null;", []); 3113 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "null;", []);
2699 JUnitTestCase.assertNotNull(statement.expression); 3114 JUnitTestCase.assertNotNull(statement.expression);
2700 } 3115 }
3116
2701 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() { 3117 void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
2702 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "library.getName();", []); 3118 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "library.getName();", []);
2703 JUnitTestCase.assertNotNull(statement.expression); 3119 JUnitTestCase.assertNotNull(statement.expression);
2704 } 3120 }
3121
2705 void test_parseNonLabeledStatement_true() { 3122 void test_parseNonLabeledStatement_true() {
2706 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "true;", []); 3123 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "true;", []);
2707 JUnitTestCase.assertNotNull(statement.expression); 3124 JUnitTestCase.assertNotNull(statement.expression);
2708 } 3125 }
3126
2709 void test_parseNonLabeledStatement_typeCast() { 3127 void test_parseNonLabeledStatement_typeCast() {
2710 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "double.NAN as num;", []); 3128 ExpressionStatement statement = ParserTestCase.parse5("parseNonLabeledStatem ent", "double.NAN as num;", []);
2711 JUnitTestCase.assertNotNull(statement.expression); 3129 JUnitTestCase.assertNotNull(statement.expression);
2712 } 3130 }
3131
2713 void test_parseNormalFormalParameter_field_const_noType() { 3132 void test_parseNormalFormalParameter_field_const_noType() {
2714 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "const this.a)", []); 3133 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "const this.a)", []);
2715 JUnitTestCase.assertNotNull(parameter.keyword); 3134 JUnitTestCase.assertNotNull(parameter.keyword);
2716 JUnitTestCase.assertNull(parameter.type); 3135 JUnitTestCase.assertNull(parameter.type);
2717 JUnitTestCase.assertNotNull(parameter.identifier); 3136 JUnitTestCase.assertNotNull(parameter.identifier);
2718 JUnitTestCase.assertNull(parameter.parameters); 3137 JUnitTestCase.assertNull(parameter.parameters);
2719 } 3138 }
3139
2720 void test_parseNormalFormalParameter_field_const_type() { 3140 void test_parseNormalFormalParameter_field_const_type() {
2721 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "const A this.a)", []); 3141 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "const A this.a)", []);
2722 JUnitTestCase.assertNotNull(parameter.keyword); 3142 JUnitTestCase.assertNotNull(parameter.keyword);
2723 JUnitTestCase.assertNotNull(parameter.type); 3143 JUnitTestCase.assertNotNull(parameter.type);
2724 JUnitTestCase.assertNotNull(parameter.identifier); 3144 JUnitTestCase.assertNotNull(parameter.identifier);
2725 JUnitTestCase.assertNull(parameter.parameters); 3145 JUnitTestCase.assertNull(parameter.parameters);
2726 } 3146 }
3147
2727 void test_parseNormalFormalParameter_field_final_noType() { 3148 void test_parseNormalFormalParameter_field_final_noType() {
2728 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "final this.a)", []); 3149 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "final this.a)", []);
2729 JUnitTestCase.assertNotNull(parameter.keyword); 3150 JUnitTestCase.assertNotNull(parameter.keyword);
2730 JUnitTestCase.assertNull(parameter.type); 3151 JUnitTestCase.assertNull(parameter.type);
2731 JUnitTestCase.assertNotNull(parameter.identifier); 3152 JUnitTestCase.assertNotNull(parameter.identifier);
2732 JUnitTestCase.assertNull(parameter.parameters); 3153 JUnitTestCase.assertNull(parameter.parameters);
2733 } 3154 }
3155
2734 void test_parseNormalFormalParameter_field_final_type() { 3156 void test_parseNormalFormalParameter_field_final_type() {
2735 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "final A this.a)", []); 3157 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "final A this.a)", []);
2736 JUnitTestCase.assertNotNull(parameter.keyword); 3158 JUnitTestCase.assertNotNull(parameter.keyword);
2737 JUnitTestCase.assertNotNull(parameter.type); 3159 JUnitTestCase.assertNotNull(parameter.type);
2738 JUnitTestCase.assertNotNull(parameter.identifier); 3160 JUnitTestCase.assertNotNull(parameter.identifier);
2739 JUnitTestCase.assertNull(parameter.parameters); 3161 JUnitTestCase.assertNull(parameter.parameters);
2740 } 3162 }
3163
2741 void test_parseNormalFormalParameter_field_function_nested() { 3164 void test_parseNormalFormalParameter_field_function_nested() {
2742 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a(B b))", []); 3165 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a(B b))", []);
2743 JUnitTestCase.assertNull(parameter.keyword); 3166 JUnitTestCase.assertNull(parameter.keyword);
2744 JUnitTestCase.assertNull(parameter.type); 3167 JUnitTestCase.assertNull(parameter.type);
2745 JUnitTestCase.assertNotNull(parameter.identifier); 3168 JUnitTestCase.assertNotNull(parameter.identifier);
2746 FormalParameterList parameterList = parameter.parameters; 3169 FormalParameterList parameterList = parameter.parameters;
2747 JUnitTestCase.assertNotNull(parameterList); 3170 JUnitTestCase.assertNotNull(parameterList);
2748 EngineTestCase.assertSize(1, parameterList.parameters); 3171 EngineTestCase.assertSize(1, parameterList.parameters);
2749 } 3172 }
3173
2750 void test_parseNormalFormalParameter_field_function_noNested() { 3174 void test_parseNormalFormalParameter_field_function_noNested() {
2751 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a())", []); 3175 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a())", []);
2752 JUnitTestCase.assertNull(parameter.keyword); 3176 JUnitTestCase.assertNull(parameter.keyword);
2753 JUnitTestCase.assertNull(parameter.type); 3177 JUnitTestCase.assertNull(parameter.type);
2754 JUnitTestCase.assertNotNull(parameter.identifier); 3178 JUnitTestCase.assertNotNull(parameter.identifier);
2755 FormalParameterList parameterList = parameter.parameters; 3179 FormalParameterList parameterList = parameter.parameters;
2756 JUnitTestCase.assertNotNull(parameterList); 3180 JUnitTestCase.assertNotNull(parameterList);
2757 EngineTestCase.assertSize(0, parameterList.parameters); 3181 EngineTestCase.assertSize(0, parameterList.parameters);
2758 } 3182 }
3183
2759 void test_parseNormalFormalParameter_field_noType() { 3184 void test_parseNormalFormalParameter_field_noType() {
2760 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a)", []); 3185 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "this.a)", []);
2761 JUnitTestCase.assertNull(parameter.keyword); 3186 JUnitTestCase.assertNull(parameter.keyword);
2762 JUnitTestCase.assertNull(parameter.type); 3187 JUnitTestCase.assertNull(parameter.type);
2763 JUnitTestCase.assertNotNull(parameter.identifier); 3188 JUnitTestCase.assertNotNull(parameter.identifier);
2764 JUnitTestCase.assertNull(parameter.parameters); 3189 JUnitTestCase.assertNull(parameter.parameters);
2765 } 3190 }
3191
2766 void test_parseNormalFormalParameter_field_type() { 3192 void test_parseNormalFormalParameter_field_type() {
2767 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "A this.a)", []); 3193 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "A this.a)", []);
2768 JUnitTestCase.assertNull(parameter.keyword); 3194 JUnitTestCase.assertNull(parameter.keyword);
2769 JUnitTestCase.assertNotNull(parameter.type); 3195 JUnitTestCase.assertNotNull(parameter.type);
2770 JUnitTestCase.assertNotNull(parameter.identifier); 3196 JUnitTestCase.assertNotNull(parameter.identifier);
2771 JUnitTestCase.assertNull(parameter.parameters); 3197 JUnitTestCase.assertNull(parameter.parameters);
2772 } 3198 }
3199
2773 void test_parseNormalFormalParameter_field_var() { 3200 void test_parseNormalFormalParameter_field_var() {
2774 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "var this.a)", []); 3201 FieldFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPar ameter", "var this.a)", []);
2775 JUnitTestCase.assertNotNull(parameter.keyword); 3202 JUnitTestCase.assertNotNull(parameter.keyword);
2776 JUnitTestCase.assertNull(parameter.type); 3203 JUnitTestCase.assertNull(parameter.type);
2777 JUnitTestCase.assertNotNull(parameter.identifier); 3204 JUnitTestCase.assertNotNull(parameter.identifier);
2778 JUnitTestCase.assertNull(parameter.parameters); 3205 JUnitTestCase.assertNull(parameter.parameters);
2779 } 3206 }
3207
2780 void test_parseNormalFormalParameter_function_noType() { 3208 void test_parseNormalFormalParameter_function_noType() {
2781 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "a())", []); 3209 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "a())", []);
2782 JUnitTestCase.assertNull(parameter.returnType); 3210 JUnitTestCase.assertNull(parameter.returnType);
2783 JUnitTestCase.assertNotNull(parameter.identifier); 3211 JUnitTestCase.assertNotNull(parameter.identifier);
2784 JUnitTestCase.assertNotNull(parameter.parameters); 3212 JUnitTestCase.assertNotNull(parameter.parameters);
2785 } 3213 }
3214
2786 void test_parseNormalFormalParameter_function_type() { 3215 void test_parseNormalFormalParameter_function_type() {
2787 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "A a())", []); 3216 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "A a())", []);
2788 JUnitTestCase.assertNotNull(parameter.returnType); 3217 JUnitTestCase.assertNotNull(parameter.returnType);
2789 JUnitTestCase.assertNotNull(parameter.identifier); 3218 JUnitTestCase.assertNotNull(parameter.identifier);
2790 JUnitTestCase.assertNotNull(parameter.parameters); 3219 JUnitTestCase.assertNotNull(parameter.parameters);
2791 } 3220 }
3221
2792 void test_parseNormalFormalParameter_function_void() { 3222 void test_parseNormalFormalParameter_function_void() {
2793 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "void a())", []); 3223 FunctionTypedFormalParameter parameter = ParserTestCase.parse5("parseNormalF ormalParameter", "void a())", []);
2794 JUnitTestCase.assertNotNull(parameter.returnType); 3224 JUnitTestCase.assertNotNull(parameter.returnType);
2795 JUnitTestCase.assertNotNull(parameter.identifier); 3225 JUnitTestCase.assertNotNull(parameter.identifier);
2796 JUnitTestCase.assertNotNull(parameter.parameters); 3226 JUnitTestCase.assertNotNull(parameter.parameters);
2797 } 3227 }
3228
2798 void test_parseNormalFormalParameter_simple_const_noType() { 3229 void test_parseNormalFormalParameter_simple_const_noType() {
2799 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "const a)", []); 3230 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "const a)", []);
2800 JUnitTestCase.assertNotNull(parameter.keyword); 3231 JUnitTestCase.assertNotNull(parameter.keyword);
2801 JUnitTestCase.assertNull(parameter.type); 3232 JUnitTestCase.assertNull(parameter.type);
2802 JUnitTestCase.assertNotNull(parameter.identifier); 3233 JUnitTestCase.assertNotNull(parameter.identifier);
2803 } 3234 }
3235
2804 void test_parseNormalFormalParameter_simple_const_type() { 3236 void test_parseNormalFormalParameter_simple_const_type() {
2805 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "const A a)", []); 3237 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "const A a)", []);
2806 JUnitTestCase.assertNotNull(parameter.keyword); 3238 JUnitTestCase.assertNotNull(parameter.keyword);
2807 JUnitTestCase.assertNotNull(parameter.type); 3239 JUnitTestCase.assertNotNull(parameter.type);
2808 JUnitTestCase.assertNotNull(parameter.identifier); 3240 JUnitTestCase.assertNotNull(parameter.identifier);
2809 } 3241 }
3242
2810 void test_parseNormalFormalParameter_simple_final_noType() { 3243 void test_parseNormalFormalParameter_simple_final_noType() {
2811 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "final a)", []); 3244 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "final a)", []);
2812 JUnitTestCase.assertNotNull(parameter.keyword); 3245 JUnitTestCase.assertNotNull(parameter.keyword);
2813 JUnitTestCase.assertNull(parameter.type); 3246 JUnitTestCase.assertNull(parameter.type);
2814 JUnitTestCase.assertNotNull(parameter.identifier); 3247 JUnitTestCase.assertNotNull(parameter.identifier);
2815 } 3248 }
3249
2816 void test_parseNormalFormalParameter_simple_final_type() { 3250 void test_parseNormalFormalParameter_simple_final_type() {
2817 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "final A a)", []); 3251 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "final A a)", []);
2818 JUnitTestCase.assertNotNull(parameter.keyword); 3252 JUnitTestCase.assertNotNull(parameter.keyword);
2819 JUnitTestCase.assertNotNull(parameter.type); 3253 JUnitTestCase.assertNotNull(parameter.type);
2820 JUnitTestCase.assertNotNull(parameter.identifier); 3254 JUnitTestCase.assertNotNull(parameter.identifier);
2821 } 3255 }
3256
2822 void test_parseNormalFormalParameter_simple_noType() { 3257 void test_parseNormalFormalParameter_simple_noType() {
2823 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "a)", []); 3258 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "a)", []);
2824 JUnitTestCase.assertNull(parameter.keyword); 3259 JUnitTestCase.assertNull(parameter.keyword);
2825 JUnitTestCase.assertNull(parameter.type); 3260 JUnitTestCase.assertNull(parameter.type);
2826 JUnitTestCase.assertNotNull(parameter.identifier); 3261 JUnitTestCase.assertNotNull(parameter.identifier);
2827 } 3262 }
3263
2828 void test_parseNormalFormalParameter_simple_type() { 3264 void test_parseNormalFormalParameter_simple_type() {
2829 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "A a)", []); 3265 SimpleFormalParameter parameter = ParserTestCase.parse5("parseNormalFormalPa rameter", "A a)", []);
2830 JUnitTestCase.assertNull(parameter.keyword); 3266 JUnitTestCase.assertNull(parameter.keyword);
2831 JUnitTestCase.assertNotNull(parameter.type); 3267 JUnitTestCase.assertNotNull(parameter.type);
2832 JUnitTestCase.assertNotNull(parameter.identifier); 3268 JUnitTestCase.assertNotNull(parameter.identifier);
2833 } 3269 }
3270
2834 void test_parseOperator() { 3271 void test_parseOperator() {
2835 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 3272 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
2836 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 3273 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
2837 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c ommentAndMetadata(comment, []), null, returnType], "operator +(A a);"); 3274 MethodDeclaration method = ParserTestCase.parse("parseOperator", <Object> [c ommentAndMetadata(comment, []), null, returnType], "operator +(A a);");
2838 JUnitTestCase.assertNotNull(method.body); 3275 JUnitTestCase.assertNotNull(method.body);
2839 JUnitTestCase.assertEquals(comment, method.documentationComment); 3276 JUnitTestCase.assertEquals(comment, method.documentationComment);
2840 JUnitTestCase.assertNull(method.externalKeyword); 3277 JUnitTestCase.assertNull(method.externalKeyword);
2841 JUnitTestCase.assertNull(method.modifierKeyword); 3278 JUnitTestCase.assertNull(method.modifierKeyword);
2842 JUnitTestCase.assertNotNull(method.name); 3279 JUnitTestCase.assertNotNull(method.name);
2843 JUnitTestCase.assertNotNull(method.operatorKeyword); 3280 JUnitTestCase.assertNotNull(method.operatorKeyword);
2844 JUnitTestCase.assertNotNull(method.parameters); 3281 JUnitTestCase.assertNotNull(method.parameters);
2845 JUnitTestCase.assertNull(method.propertyKeyword); 3282 JUnitTestCase.assertNull(method.propertyKeyword);
2846 JUnitTestCase.assertEquals(returnType, method.returnType); 3283 JUnitTestCase.assertEquals(returnType, method.returnType);
2847 } 3284 }
3285
2848 void test_parseOptionalReturnType() { 3286 void test_parseOptionalReturnType() {
2849 } 3287 }
3288
2850 void test_parsePartDirective_part() { 3289 void test_parsePartDirective_part() {
2851 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object > [emptyCommentAndMetadata()], "part 'lib/lib.dart';"); 3290 PartDirective directive = ParserTestCase.parse("parsePartDirective", <Object > [emptyCommentAndMetadata()], "part 'lib/lib.dart';");
2852 JUnitTestCase.assertNotNull(directive.partToken); 3291 JUnitTestCase.assertNotNull(directive.partToken);
2853 JUnitTestCase.assertNotNull(directive.uri); 3292 JUnitTestCase.assertNotNull(directive.uri);
2854 JUnitTestCase.assertNotNull(directive.semicolon); 3293 JUnitTestCase.assertNotNull(directive.semicolon);
2855 } 3294 }
3295
2856 void test_parsePartDirective_partOf() { 3296 void test_parsePartDirective_partOf() {
2857 PartOfDirective directive = ParserTestCase.parse("parsePartDirective", <Obje ct> [emptyCommentAndMetadata()], "part of l;"); 3297 PartOfDirective directive = ParserTestCase.parse("parsePartDirective", <Obje ct> [emptyCommentAndMetadata()], "part of l;");
2858 JUnitTestCase.assertNotNull(directive.partToken); 3298 JUnitTestCase.assertNotNull(directive.partToken);
2859 JUnitTestCase.assertNotNull(directive.ofToken); 3299 JUnitTestCase.assertNotNull(directive.ofToken);
2860 JUnitTestCase.assertNotNull(directive.libraryName); 3300 JUnitTestCase.assertNotNull(directive.libraryName);
2861 JUnitTestCase.assertNotNull(directive.semicolon); 3301 JUnitTestCase.assertNotNull(directive.semicolon);
2862 } 3302 }
3303
2863 void test_parsePostfixExpression_decrement() { 3304 void test_parsePostfixExpression_decrement() {
2864 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i--", []); 3305 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i--", []);
2865 JUnitTestCase.assertNotNull(expression.operand); 3306 JUnitTestCase.assertNotNull(expression.operand);
2866 JUnitTestCase.assertNotNull(expression.operator); 3307 JUnitTestCase.assertNotNull(expression.operator);
2867 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 3308 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type);
2868 } 3309 }
3310
2869 void test_parsePostfixExpression_increment() { 3311 void test_parsePostfixExpression_increment() {
2870 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i++", []); 3312 PostfixExpression expression = ParserTestCase.parse5("parsePostfixExpression ", "i++", []);
2871 JUnitTestCase.assertNotNull(expression.operand); 3313 JUnitTestCase.assertNotNull(expression.operand);
2872 JUnitTestCase.assertNotNull(expression.operator); 3314 JUnitTestCase.assertNotNull(expression.operator);
2873 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 3315 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type);
2874 } 3316 }
3317
2875 void test_parsePostfixExpression_none_indexExpression() { 3318 void test_parsePostfixExpression_none_indexExpression() {
2876 IndexExpression expression = ParserTestCase.parse5("parsePostfixExpression", "a[0]", []); 3319 IndexExpression expression = ParserTestCase.parse5("parsePostfixExpression", "a[0]", []);
2877 JUnitTestCase.assertNotNull(expression.target); 3320 JUnitTestCase.assertNotNull(expression.target);
2878 JUnitTestCase.assertNotNull(expression.index); 3321 JUnitTestCase.assertNotNull(expression.index);
2879 } 3322 }
3323
2880 void test_parsePostfixExpression_none_methodInvocation() { 3324 void test_parsePostfixExpression_none_methodInvocation() {
2881 MethodInvocation expression = ParserTestCase.parse5("parsePostfixExpression" , "a.m()", []); 3325 MethodInvocation expression = ParserTestCase.parse5("parsePostfixExpression" , "a.m()", []);
2882 JUnitTestCase.assertNotNull(expression.target); 3326 JUnitTestCase.assertNotNull(expression.target);
2883 JUnitTestCase.assertNotNull(expression.methodName); 3327 JUnitTestCase.assertNotNull(expression.methodName);
2884 JUnitTestCase.assertNotNull(expression.argumentList); 3328 JUnitTestCase.assertNotNull(expression.argumentList);
2885 } 3329 }
3330
2886 void test_parsePostfixExpression_none_propertyAccess() { 3331 void test_parsePostfixExpression_none_propertyAccess() {
2887 PrefixedIdentifier expression = ParserTestCase.parse5("parsePostfixExpressio n", "a.b", []); 3332 PrefixedIdentifier expression = ParserTestCase.parse5("parsePostfixExpressio n", "a.b", []);
2888 JUnitTestCase.assertNotNull(expression.prefix); 3333 JUnitTestCase.assertNotNull(expression.prefix);
2889 JUnitTestCase.assertNotNull(expression.identifier); 3334 JUnitTestCase.assertNotNull(expression.identifier);
2890 } 3335 }
3336
2891 void test_parsePrefixedIdentifier_noPrefix() { 3337 void test_parsePrefixedIdentifier_noPrefix() {
2892 String lexeme = "bar"; 3338 String lexeme = "bar";
2893 SimpleIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifier ", lexeme, []); 3339 SimpleIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifier ", lexeme, []);
2894 JUnitTestCase.assertNotNull(identifier.token); 3340 JUnitTestCase.assertNotNull(identifier.token);
2895 JUnitTestCase.assertEquals(lexeme, identifier.name); 3341 JUnitTestCase.assertEquals(lexeme, identifier.name);
2896 } 3342 }
3343
2897 void test_parsePrefixedIdentifier_prefix() { 3344 void test_parsePrefixedIdentifier_prefix() {
2898 String lexeme = "foo.bar"; 3345 String lexeme = "foo.bar";
2899 PrefixedIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifi er", lexeme, []); 3346 PrefixedIdentifier identifier = ParserTestCase.parse5("parsePrefixedIdentifi er", lexeme, []);
2900 JUnitTestCase.assertEquals("foo", identifier.prefix.name); 3347 JUnitTestCase.assertEquals("foo", identifier.prefix.name);
2901 JUnitTestCase.assertNotNull(identifier.period); 3348 JUnitTestCase.assertNotNull(identifier.period);
2902 JUnitTestCase.assertEquals("bar", identifier.identifier.name); 3349 JUnitTestCase.assertEquals("bar", identifier.identifier.name);
2903 } 3350 }
3351
2904 void test_parsePrimaryExpression_const() { 3352 void test_parsePrimaryExpression_const() {
2905 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "const A()", []); 3353 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "const A()", []);
2906 JUnitTestCase.assertNotNull(expression); 3354 JUnitTestCase.assertNotNull(expression);
2907 } 3355 }
3356
2908 void test_parsePrimaryExpression_double() { 3357 void test_parsePrimaryExpression_double() {
2909 String doubleLiteral = "3.2e4"; 3358 String doubleLiteral = "3.2e4";
2910 DoubleLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", doub leLiteral, []); 3359 DoubleLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", doub leLiteral, []);
2911 JUnitTestCase.assertNotNull(literal.literal); 3360 JUnitTestCase.assertNotNull(literal.literal);
2912 JUnitTestCase.assertEquals(double.parse(doubleLiteral), literal.value); 3361 JUnitTestCase.assertEquals(double.parse(doubleLiteral), literal.value);
2913 } 3362 }
3363
2914 void test_parsePrimaryExpression_false() { 3364 void test_parsePrimaryExpression_false() {
2915 BooleanLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "fa lse", []); 3365 BooleanLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "fa lse", []);
2916 JUnitTestCase.assertNotNull(literal.literal); 3366 JUnitTestCase.assertNotNull(literal.literal);
2917 JUnitTestCase.assertFalse(literal.value); 3367 JUnitTestCase.assertFalse(literal.value);
2918 } 3368 }
3369
2919 void test_parsePrimaryExpression_function_arguments() { 3370 void test_parsePrimaryExpression_function_arguments() {
2920 FunctionExpression expression = ParserTestCase.parse5("parsePrimaryExpressio n", "(int i) => i + 1", []); 3371 FunctionExpression expression = ParserTestCase.parse5("parsePrimaryExpressio n", "(int i) => i + 1", []);
2921 JUnitTestCase.assertNotNull(expression.parameters); 3372 JUnitTestCase.assertNotNull(expression.parameters);
2922 JUnitTestCase.assertNotNull(expression.body); 3373 JUnitTestCase.assertNotNull(expression.body);
2923 } 3374 }
3375
2924 void test_parsePrimaryExpression_function_noArguments() { 3376 void test_parsePrimaryExpression_function_noArguments() {
2925 FunctionExpression expression = ParserTestCase.parse5("parsePrimaryExpressio n", "() => 42", []); 3377 FunctionExpression expression = ParserTestCase.parse5("parsePrimaryExpressio n", "() => 42", []);
2926 JUnitTestCase.assertNotNull(expression.parameters); 3378 JUnitTestCase.assertNotNull(expression.parameters);
2927 JUnitTestCase.assertNotNull(expression.body); 3379 JUnitTestCase.assertNotNull(expression.body);
2928 } 3380 }
3381
2929 void test_parsePrimaryExpression_hex() { 3382 void test_parsePrimaryExpression_hex() {
2930 String hexLiteral = "3F"; 3383 String hexLiteral = "3F";
2931 IntegerLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "0x ${hexLiteral}", []); 3384 IntegerLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "0x ${hexLiteral}", []);
2932 JUnitTestCase.assertNotNull(literal.literal); 3385 JUnitTestCase.assertNotNull(literal.literal);
2933 JUnitTestCase.assertEquals(int.parse(hexLiteral, radix: 16), literal.value); 3386 JUnitTestCase.assertEquals(int.parse(hexLiteral, radix: 16), literal.value);
2934 } 3387 }
3388
2935 void test_parsePrimaryExpression_identifier() { 3389 void test_parsePrimaryExpression_identifier() {
2936 SimpleIdentifier identifier = ParserTestCase.parse5("parsePrimaryExpression" , "a", []); 3390 SimpleIdentifier identifier = ParserTestCase.parse5("parsePrimaryExpression" , "a", []);
2937 JUnitTestCase.assertNotNull(identifier); 3391 JUnitTestCase.assertNotNull(identifier);
2938 } 3392 }
3393
2939 void test_parsePrimaryExpression_int() { 3394 void test_parsePrimaryExpression_int() {
2940 String intLiteral = "472"; 3395 String intLiteral = "472";
2941 IntegerLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", int Literal, []); 3396 IntegerLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", int Literal, []);
2942 JUnitTestCase.assertNotNull(literal.literal); 3397 JUnitTestCase.assertNotNull(literal.literal);
2943 JUnitTestCase.assertEquals(int.parse(intLiteral), literal.value); 3398 JUnitTestCase.assertEquals(int.parse(intLiteral), literal.value);
2944 } 3399 }
3400
2945 void test_parsePrimaryExpression_listLiteral() { 3401 void test_parsePrimaryExpression_listLiteral() {
2946 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "[ ]", []); 3402 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "[ ]", []);
2947 JUnitTestCase.assertNotNull(literal); 3403 JUnitTestCase.assertNotNull(literal);
2948 } 3404 }
3405
2949 void test_parsePrimaryExpression_listLiteral_index() { 3406 void test_parsePrimaryExpression_listLiteral_index() {
2950 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "[]", []); 3407 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "[]", []);
2951 JUnitTestCase.assertNotNull(literal); 3408 JUnitTestCase.assertNotNull(literal);
2952 } 3409 }
3410
2953 void test_parsePrimaryExpression_listLiteral_typed() { 3411 void test_parsePrimaryExpression_listLiteral_typed() {
2954 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A>[ ]", []); 3412 ListLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A>[ ]", []);
2955 JUnitTestCase.assertNotNull(literal.typeArguments); 3413 JUnitTestCase.assertNotNull(literal.typeArguments);
2956 EngineTestCase.assertSize(1, literal.typeArguments.arguments); 3414 EngineTestCase.assertSize(1, literal.typeArguments.arguments);
2957 } 3415 }
3416
2958 void test_parsePrimaryExpression_mapLiteral() { 3417 void test_parsePrimaryExpression_mapLiteral() {
2959 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "{}", [ ]); 3418 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "{}", [ ]);
2960 JUnitTestCase.assertNotNull(literal); 3419 JUnitTestCase.assertNotNull(literal);
2961 } 3420 }
3421
2962 void test_parsePrimaryExpression_mapLiteral_typed() { 3422 void test_parsePrimaryExpression_mapLiteral_typed() {
2963 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A, B> {}", []); 3423 MapLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "<A, B> {}", []);
2964 JUnitTestCase.assertNotNull(literal.typeArguments); 3424 JUnitTestCase.assertNotNull(literal.typeArguments);
2965 EngineTestCase.assertSize(2, literal.typeArguments.arguments); 3425 EngineTestCase.assertSize(2, literal.typeArguments.arguments);
2966 } 3426 }
3427
2967 void test_parsePrimaryExpression_new() { 3428 void test_parsePrimaryExpression_new() {
2968 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "new A()", []); 3429 InstanceCreationExpression expression = ParserTestCase.parse5("parsePrimaryE xpression", "new A()", []);
2969 JUnitTestCase.assertNotNull(expression); 3430 JUnitTestCase.assertNotNull(expression);
2970 } 3431 }
3432
2971 void test_parsePrimaryExpression_null() { 3433 void test_parsePrimaryExpression_null() {
2972 NullLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "null" , []); 3434 NullLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "null" , []);
2973 JUnitTestCase.assertNotNull(literal.literal); 3435 JUnitTestCase.assertNotNull(literal.literal);
2974 } 3436 }
3437
2975 void test_parsePrimaryExpression_parenthesized() { 3438 void test_parsePrimaryExpression_parenthesized() {
2976 ParenthesizedExpression expression = ParserTestCase.parse5("parsePrimaryExpr ession", "(x)", []); 3439 ParenthesizedExpression expression = ParserTestCase.parse5("parsePrimaryExpr ession", "(x)", []);
2977 JUnitTestCase.assertNotNull(expression); 3440 JUnitTestCase.assertNotNull(expression);
2978 } 3441 }
3442
2979 void test_parsePrimaryExpression_string() { 3443 void test_parsePrimaryExpression_string() {
2980 SimpleStringLiteral literal = ParserTestCase.parse5("parsePrimaryExpression" , "\"string\"", []); 3444 SimpleStringLiteral literal = ParserTestCase.parse5("parsePrimaryExpression" , "\"string\"", []);
2981 JUnitTestCase.assertFalse(literal.isMultiline); 3445 JUnitTestCase.assertFalse(literal.isMultiline);
2982 JUnitTestCase.assertEquals("string", literal.value); 3446 JUnitTestCase.assertEquals("string", literal.value);
2983 } 3447 }
3448
2984 void test_parsePrimaryExpression_super() { 3449 void test_parsePrimaryExpression_super() {
2985 PropertyAccess propertyAccess = ParserTestCase.parse5("parsePrimaryExpressio n", "super.x", []); 3450 PropertyAccess propertyAccess = ParserTestCase.parse5("parsePrimaryExpressio n", "super.x", []);
2986 JUnitTestCase.assertTrue(propertyAccess.target is SuperExpression); 3451 JUnitTestCase.assertTrue(propertyAccess.target is SuperExpression);
2987 JUnitTestCase.assertNotNull(propertyAccess.operator); 3452 JUnitTestCase.assertNotNull(propertyAccess.operator);
2988 JUnitTestCase.assertEquals(TokenType.PERIOD, propertyAccess.operator.type); 3453 JUnitTestCase.assertEquals(TokenType.PERIOD, propertyAccess.operator.type);
2989 JUnitTestCase.assertNotNull(propertyAccess.propertyName); 3454 JUnitTestCase.assertNotNull(propertyAccess.propertyName);
2990 } 3455 }
3456
2991 void test_parsePrimaryExpression_this() { 3457 void test_parsePrimaryExpression_this() {
2992 ThisExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "this", []); 3458 ThisExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "this", []);
2993 JUnitTestCase.assertNotNull(expression.keyword); 3459 JUnitTestCase.assertNotNull(expression.keyword);
2994 } 3460 }
3461
2995 void test_parsePrimaryExpression_true() { 3462 void test_parsePrimaryExpression_true() {
2996 BooleanLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "tr ue", []); 3463 BooleanLiteral literal = ParserTestCase.parse5("parsePrimaryExpression", "tr ue", []);
2997 JUnitTestCase.assertNotNull(literal.literal); 3464 JUnitTestCase.assertNotNull(literal.literal);
2998 JUnitTestCase.assertTrue(literal.value); 3465 JUnitTestCase.assertTrue(literal.value);
2999 } 3466 }
3467
3000 void test_Parser() { 3468 void test_Parser() {
3001 JUnitTestCase.assertNotNull(new Parser(null, null)); 3469 JUnitTestCase.assertNotNull(new Parser(null, null));
3002 } 3470 }
3471
3003 void test_parseRedirectingConstructorInvocation_named() { 3472 void test_parseRedirectingConstructorInvocation_named() {
3004 RedirectingConstructorInvocation invocation = ParserTestCase.parse5("parseRe directingConstructorInvocation", "this.a()", []); 3473 RedirectingConstructorInvocation invocation = ParserTestCase.parse5("parseRe directingConstructorInvocation", "this.a()", []);
3005 JUnitTestCase.assertNotNull(invocation.argumentList); 3474 JUnitTestCase.assertNotNull(invocation.argumentList);
3006 JUnitTestCase.assertNotNull(invocation.constructorName); 3475 JUnitTestCase.assertNotNull(invocation.constructorName);
3007 JUnitTestCase.assertNotNull(invocation.keyword); 3476 JUnitTestCase.assertNotNull(invocation.keyword);
3008 JUnitTestCase.assertNotNull(invocation.period); 3477 JUnitTestCase.assertNotNull(invocation.period);
3009 } 3478 }
3479
3010 void test_parseRedirectingConstructorInvocation_unnamed() { 3480 void test_parseRedirectingConstructorInvocation_unnamed() {
3011 RedirectingConstructorInvocation invocation = ParserTestCase.parse5("parseRe directingConstructorInvocation", "this()", []); 3481 RedirectingConstructorInvocation invocation = ParserTestCase.parse5("parseRe directingConstructorInvocation", "this()", []);
3012 JUnitTestCase.assertNotNull(invocation.argumentList); 3482 JUnitTestCase.assertNotNull(invocation.argumentList);
3013 JUnitTestCase.assertNull(invocation.constructorName); 3483 JUnitTestCase.assertNull(invocation.constructorName);
3014 JUnitTestCase.assertNotNull(invocation.keyword); 3484 JUnitTestCase.assertNotNull(invocation.keyword);
3015 JUnitTestCase.assertNull(invocation.period); 3485 JUnitTestCase.assertNull(invocation.period);
3016 } 3486 }
3487
3017 void test_parseRelationalExpression_as() { 3488 void test_parseRelationalExpression_as() {
3018 AsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x as Y", []); 3489 AsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x as Y", []);
3019 JUnitTestCase.assertNotNull(expression.expression); 3490 JUnitTestCase.assertNotNull(expression.expression);
3020 JUnitTestCase.assertNotNull(expression.asOperator); 3491 JUnitTestCase.assertNotNull(expression.asOperator);
3021 JUnitTestCase.assertNotNull(expression.type); 3492 JUnitTestCase.assertNotNull(expression.type);
3022 } 3493 }
3494
3023 void test_parseRelationalExpression_is() { 3495 void test_parseRelationalExpression_is() {
3024 IsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x is y", []); 3496 IsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x is y", []);
3025 JUnitTestCase.assertNotNull(expression.expression); 3497 JUnitTestCase.assertNotNull(expression.expression);
3026 JUnitTestCase.assertNotNull(expression.isOperator); 3498 JUnitTestCase.assertNotNull(expression.isOperator);
3027 JUnitTestCase.assertNull(expression.notOperator); 3499 JUnitTestCase.assertNull(expression.notOperator);
3028 JUnitTestCase.assertNotNull(expression.type); 3500 JUnitTestCase.assertNotNull(expression.type);
3029 } 3501 }
3502
3030 void test_parseRelationalExpression_isNot() { 3503 void test_parseRelationalExpression_isNot() {
3031 IsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x is! y", []); 3504 IsExpression expression = ParserTestCase.parse5("parseRelationalExpression", "x is! y", []);
3032 JUnitTestCase.assertNotNull(expression.expression); 3505 JUnitTestCase.assertNotNull(expression.expression);
3033 JUnitTestCase.assertNotNull(expression.isOperator); 3506 JUnitTestCase.assertNotNull(expression.isOperator);
3034 JUnitTestCase.assertNotNull(expression.notOperator); 3507 JUnitTestCase.assertNotNull(expression.notOperator);
3035 JUnitTestCase.assertNotNull(expression.type); 3508 JUnitTestCase.assertNotNull(expression.type);
3036 } 3509 }
3510
3037 void test_parseRelationalExpression_normal() { 3511 void test_parseRelationalExpression_normal() {
3038 BinaryExpression expression = ParserTestCase.parse5("parseRelationalExpressi on", "x < y", []); 3512 BinaryExpression expression = ParserTestCase.parse5("parseRelationalExpressi on", "x < y", []);
3039 JUnitTestCase.assertNotNull(expression.leftOperand); 3513 JUnitTestCase.assertNotNull(expression.leftOperand);
3040 JUnitTestCase.assertNotNull(expression.operator); 3514 JUnitTestCase.assertNotNull(expression.operator);
3041 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type); 3515 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type);
3042 JUnitTestCase.assertNotNull(expression.rightOperand); 3516 JUnitTestCase.assertNotNull(expression.rightOperand);
3043 } 3517 }
3518
3044 void test_parseRelationalExpression_super() { 3519 void test_parseRelationalExpression_super() {
3045 BinaryExpression expression = ParserTestCase.parse5("parseRelationalExpressi on", "super < y", []); 3520 BinaryExpression expression = ParserTestCase.parse5("parseRelationalExpressi on", "super < y", []);
3046 JUnitTestCase.assertNotNull(expression.leftOperand); 3521 JUnitTestCase.assertNotNull(expression.leftOperand);
3047 JUnitTestCase.assertNotNull(expression.operator); 3522 JUnitTestCase.assertNotNull(expression.operator);
3048 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type); 3523 JUnitTestCase.assertEquals(TokenType.LT, expression.operator.type);
3049 JUnitTestCase.assertNotNull(expression.rightOperand); 3524 JUnitTestCase.assertNotNull(expression.rightOperand);
3050 } 3525 }
3526
3051 void test_parseRethrowExpression() { 3527 void test_parseRethrowExpression() {
3052 RethrowExpression expression = ParserTestCase.parse5("parseRethrowExpression ", "rethrow;", []); 3528 RethrowExpression expression = ParserTestCase.parse5("parseRethrowExpression ", "rethrow;", []);
3053 JUnitTestCase.assertNotNull(expression.keyword); 3529 JUnitTestCase.assertNotNull(expression.keyword);
3054 } 3530 }
3531
3055 void test_parseReturnStatement_noValue() { 3532 void test_parseReturnStatement_noValue() {
3056 ReturnStatement statement = ParserTestCase.parse5("parseReturnStatement", "r eturn;", []); 3533 ReturnStatement statement = ParserTestCase.parse5("parseReturnStatement", "r eturn;", []);
3057 JUnitTestCase.assertNotNull(statement.keyword); 3534 JUnitTestCase.assertNotNull(statement.keyword);
3058 JUnitTestCase.assertNull(statement.expression); 3535 JUnitTestCase.assertNull(statement.expression);
3059 JUnitTestCase.assertNotNull(statement.semicolon); 3536 JUnitTestCase.assertNotNull(statement.semicolon);
3060 } 3537 }
3538
3061 void test_parseReturnStatement_value() { 3539 void test_parseReturnStatement_value() {
3062 ReturnStatement statement = ParserTestCase.parse5("parseReturnStatement", "r eturn x;", []); 3540 ReturnStatement statement = ParserTestCase.parse5("parseReturnStatement", "r eturn x;", []);
3063 JUnitTestCase.assertNotNull(statement.keyword); 3541 JUnitTestCase.assertNotNull(statement.keyword);
3064 JUnitTestCase.assertNotNull(statement.expression); 3542 JUnitTestCase.assertNotNull(statement.expression);
3065 JUnitTestCase.assertNotNull(statement.semicolon); 3543 JUnitTestCase.assertNotNull(statement.semicolon);
3066 } 3544 }
3545
3067 void test_parseReturnType_nonVoid() { 3546 void test_parseReturnType_nonVoid() {
3068 TypeName typeName = ParserTestCase.parse5("parseReturnType", "A<B>", []); 3547 TypeName typeName = ParserTestCase.parse5("parseReturnType", "A<B>", []);
3069 JUnitTestCase.assertNotNull(typeName.name); 3548 JUnitTestCase.assertNotNull(typeName.name);
3070 JUnitTestCase.assertNotNull(typeName.typeArguments); 3549 JUnitTestCase.assertNotNull(typeName.typeArguments);
3071 } 3550 }
3551
3072 void test_parseReturnType_void() { 3552 void test_parseReturnType_void() {
3073 TypeName typeName = ParserTestCase.parse5("parseReturnType", "void", []); 3553 TypeName typeName = ParserTestCase.parse5("parseReturnType", "void", []);
3074 JUnitTestCase.assertNotNull(typeName.name); 3554 JUnitTestCase.assertNotNull(typeName.name);
3075 JUnitTestCase.assertNull(typeName.typeArguments); 3555 JUnitTestCase.assertNull(typeName.typeArguments);
3076 } 3556 }
3557
3077 void test_parseSetter_nonStatic() { 3558 void test_parseSetter_nonStatic() {
3078 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 3559 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
3079 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 3560 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
3080 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "set a(var x);"); 3561 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [com mentAndMetadata(comment, []), null, null, returnType], "set a(var x);");
3081 JUnitTestCase.assertNotNull(method.body); 3562 JUnitTestCase.assertNotNull(method.body);
3082 JUnitTestCase.assertEquals(comment, method.documentationComment); 3563 JUnitTestCase.assertEquals(comment, method.documentationComment);
3083 JUnitTestCase.assertNull(method.externalKeyword); 3564 JUnitTestCase.assertNull(method.externalKeyword);
3084 JUnitTestCase.assertNull(method.modifierKeyword); 3565 JUnitTestCase.assertNull(method.modifierKeyword);
3085 JUnitTestCase.assertNotNull(method.name); 3566 JUnitTestCase.assertNotNull(method.name);
3086 JUnitTestCase.assertNull(method.operatorKeyword); 3567 JUnitTestCase.assertNull(method.operatorKeyword);
3087 JUnitTestCase.assertNotNull(method.parameters); 3568 JUnitTestCase.assertNotNull(method.parameters);
3088 JUnitTestCase.assertNotNull(method.propertyKeyword); 3569 JUnitTestCase.assertNotNull(method.propertyKeyword);
3089 JUnitTestCase.assertEquals(returnType, method.returnType); 3570 JUnitTestCase.assertEquals(returnType, method.returnType);
3090 } 3571 }
3572
3091 void test_parseSetter_static() { 3573 void test_parseSetter_static() {
3092 Comment comment = Comment.createDocumentationComment(new List<Token>(0)); 3574 Comment comment = Comment.createDocumentationComment(new List<Token>(0));
3093 Token staticKeyword = TokenFactory.token(Keyword.STATIC); 3575 Token staticKeyword = TokenFactory.token(Keyword.STATIC);
3094 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l); 3576 TypeName returnType = new TypeName.full(new SimpleIdentifier.full(null), nul l);
3095 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [ 3577 MethodDeclaration method = ParserTestCase.parse("parseSetter", <Object> [
3096 commentAndMetadata(comment, []), 3578 commentAndMetadata(comment, []),
3097 null, 3579 null,
3098 staticKeyword, 3580 staticKeyword,
3099 returnType], "set a(var x) {}"); 3581 returnType], "set a(var x) {}");
3100 JUnitTestCase.assertNotNull(method.body); 3582 JUnitTestCase.assertNotNull(method.body);
3101 JUnitTestCase.assertEquals(comment, method.documentationComment); 3583 JUnitTestCase.assertEquals(comment, method.documentationComment);
3102 JUnitTestCase.assertNull(method.externalKeyword); 3584 JUnitTestCase.assertNull(method.externalKeyword);
3103 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword); 3585 JUnitTestCase.assertEquals(staticKeyword, method.modifierKeyword);
3104 JUnitTestCase.assertNotNull(method.name); 3586 JUnitTestCase.assertNotNull(method.name);
3105 JUnitTestCase.assertNull(method.operatorKeyword); 3587 JUnitTestCase.assertNull(method.operatorKeyword);
3106 JUnitTestCase.assertNotNull(method.parameters); 3588 JUnitTestCase.assertNotNull(method.parameters);
3107 JUnitTestCase.assertNotNull(method.propertyKeyword); 3589 JUnitTestCase.assertNotNull(method.propertyKeyword);
3108 JUnitTestCase.assertEquals(returnType, method.returnType); 3590 JUnitTestCase.assertEquals(returnType, method.returnType);
3109 } 3591 }
3592
3110 void test_parseShiftExpression_normal() { 3593 void test_parseShiftExpression_normal() {
3111 BinaryExpression expression = ParserTestCase.parse5("parseShiftExpression", "x << y", []); 3594 BinaryExpression expression = ParserTestCase.parse5("parseShiftExpression", "x << y", []);
3112 JUnitTestCase.assertNotNull(expression.leftOperand); 3595 JUnitTestCase.assertNotNull(expression.leftOperand);
3113 JUnitTestCase.assertNotNull(expression.operator); 3596 JUnitTestCase.assertNotNull(expression.operator);
3114 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type); 3597 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type);
3115 JUnitTestCase.assertNotNull(expression.rightOperand); 3598 JUnitTestCase.assertNotNull(expression.rightOperand);
3116 } 3599 }
3600
3117 void test_parseShiftExpression_super() { 3601 void test_parseShiftExpression_super() {
3118 BinaryExpression expression = ParserTestCase.parse5("parseShiftExpression", "super << y", []); 3602 BinaryExpression expression = ParserTestCase.parse5("parseShiftExpression", "super << y", []);
3119 JUnitTestCase.assertNotNull(expression.leftOperand); 3603 JUnitTestCase.assertNotNull(expression.leftOperand);
3120 JUnitTestCase.assertNotNull(expression.operator); 3604 JUnitTestCase.assertNotNull(expression.operator);
3121 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type); 3605 JUnitTestCase.assertEquals(TokenType.LT_LT, expression.operator.type);
3122 JUnitTestCase.assertNotNull(expression.rightOperand); 3606 JUnitTestCase.assertNotNull(expression.rightOperand);
3123 } 3607 }
3608
3124 void test_parseSimpleIdentifier_builtInIdentifier() { 3609 void test_parseSimpleIdentifier_builtInIdentifier() {
3125 String lexeme = "as"; 3610 String lexeme = "as";
3126 SimpleIdentifier identifier = ParserTestCase.parse5("parseSimpleIdentifier", lexeme, []); 3611 SimpleIdentifier identifier = ParserTestCase.parse5("parseSimpleIdentifier", lexeme, []);
3127 JUnitTestCase.assertNotNull(identifier.token); 3612 JUnitTestCase.assertNotNull(identifier.token);
3128 JUnitTestCase.assertEquals(lexeme, identifier.name); 3613 JUnitTestCase.assertEquals(lexeme, identifier.name);
3129 } 3614 }
3615
3130 void test_parseSimpleIdentifier_normalIdentifier() { 3616 void test_parseSimpleIdentifier_normalIdentifier() {
3131 String lexeme = "foo"; 3617 String lexeme = "foo";
3132 SimpleIdentifier identifier = ParserTestCase.parse5("parseSimpleIdentifier", lexeme, []); 3618 SimpleIdentifier identifier = ParserTestCase.parse5("parseSimpleIdentifier", lexeme, []);
3133 JUnitTestCase.assertNotNull(identifier.token); 3619 JUnitTestCase.assertNotNull(identifier.token);
3134 JUnitTestCase.assertEquals(lexeme, identifier.name); 3620 JUnitTestCase.assertEquals(lexeme, identifier.name);
3135 } 3621 }
3622
3136 void test_parseSimpleIdentifier1_normalIdentifier() { 3623 void test_parseSimpleIdentifier1_normalIdentifier() {
3137 } 3624 }
3625
3138 void test_parseStatement_functionDeclaration() { 3626 void test_parseStatement_functionDeclaration() {
3139 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseStateme nt", "int f(a, b) {};", []); 3627 FunctionDeclarationStatement statement = ParserTestCase.parse5("parseStateme nt", "int f(a, b) {};", []);
3140 JUnitTestCase.assertNotNull(statement.functionDeclaration); 3628 JUnitTestCase.assertNotNull(statement.functionDeclaration);
3141 } 3629 }
3630
3142 void test_parseStatement_mulipleLabels() { 3631 void test_parseStatement_mulipleLabels() {
3143 LabeledStatement statement = ParserTestCase.parse5("parseStatement", "l: m: return x;", []); 3632 LabeledStatement statement = ParserTestCase.parse5("parseStatement", "l: m: return x;", []);
3144 EngineTestCase.assertSize(2, statement.labels); 3633 EngineTestCase.assertSize(2, statement.labels);
3145 JUnitTestCase.assertNotNull(statement.statement); 3634 JUnitTestCase.assertNotNull(statement.statement);
3146 } 3635 }
3636
3147 void test_parseStatement_noLabels() { 3637 void test_parseStatement_noLabels() {
3148 ParserTestCase.parse5("parseStatement", "return x;", []); 3638 ParserTestCase.parse5("parseStatement", "return x;", []);
3149 } 3639 }
3640
3150 void test_parseStatement_singleLabel() { 3641 void test_parseStatement_singleLabel() {
3151 LabeledStatement statement = ParserTestCase.parse5("parseStatement", "l: ret urn x;", []); 3642 LabeledStatement statement = ParserTestCase.parse5("parseStatement", "l: ret urn x;", []);
3152 EngineTestCase.assertSize(1, statement.labels); 3643 EngineTestCase.assertSize(1, statement.labels);
3153 JUnitTestCase.assertNotNull(statement.statement); 3644 JUnitTestCase.assertNotNull(statement.statement);
3154 } 3645 }
3646
3155 void test_parseStatements_multiple() { 3647 void test_parseStatements_multiple() {
3156 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []); 3648 List<Statement> statements = ParserTestCase.parseStatements("return; return; ", 2, []);
3157 EngineTestCase.assertSize(2, statements); 3649 EngineTestCase.assertSize(2, statements);
3158 } 3650 }
3651
3159 void test_parseStatements_single() { 3652 void test_parseStatements_single() {
3160 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] ); 3653 List<Statement> statements = ParserTestCase.parseStatements("return;", 1, [] );
3161 EngineTestCase.assertSize(1, statements); 3654 EngineTestCase.assertSize(1, statements);
3162 } 3655 }
3656
3163 void test_parseStringLiteral_adjacent() { 3657 void test_parseStringLiteral_adjacent() {
3164 AdjacentStrings literal = ParserTestCase.parse5("parseStringLiteral", "'a' ' b'", []); 3658 AdjacentStrings literal = ParserTestCase.parse5("parseStringLiteral", "'a' ' b'", []);
3165 NodeList<StringLiteral> strings = literal.strings; 3659 NodeList<StringLiteral> strings = literal.strings;
3166 EngineTestCase.assertSize(2, strings); 3660 EngineTestCase.assertSize(2, strings);
3167 StringLiteral firstString = strings[0]; 3661 StringLiteral firstString = strings[0];
3168 StringLiteral secondString = strings[1]; 3662 StringLiteral secondString = strings[1];
3169 JUnitTestCase.assertEquals("a", ((firstString as SimpleStringLiteral)).value ); 3663 JUnitTestCase.assertEquals("a", (firstString as SimpleStringLiteral).value);
3170 JUnitTestCase.assertEquals("b", ((secondString as SimpleStringLiteral)).valu e); 3664 JUnitTestCase.assertEquals("b", (secondString as SimpleStringLiteral).value) ;
3171 } 3665 }
3666
3172 void test_parseStringLiteral_interpolated() { 3667 void test_parseStringLiteral_interpolated() {
3173 StringInterpolation literal = ParserTestCase.parse5("parseStringLiteral", "' a \${b} c \$this d'", []); 3668 StringInterpolation literal = ParserTestCase.parse5("parseStringLiteral", "' a \${b} c \$this d'", []);
3174 NodeList<InterpolationElement> elements = literal.elements; 3669 NodeList<InterpolationElement> elements = literal.elements;
3175 EngineTestCase.assertSize(5, elements); 3670 EngineTestCase.assertSize(5, elements);
3176 JUnitTestCase.assertTrue(elements[0] is InterpolationString); 3671 JUnitTestCase.assertTrue(elements[0] is InterpolationString);
3177 JUnitTestCase.assertTrue(elements[1] is InterpolationExpression); 3672 JUnitTestCase.assertTrue(elements[1] is InterpolationExpression);
3178 JUnitTestCase.assertTrue(elements[2] is InterpolationString); 3673 JUnitTestCase.assertTrue(elements[2] is InterpolationString);
3179 JUnitTestCase.assertTrue(elements[3] is InterpolationExpression); 3674 JUnitTestCase.assertTrue(elements[3] is InterpolationExpression);
3180 JUnitTestCase.assertTrue(elements[4] is InterpolationString); 3675 JUnitTestCase.assertTrue(elements[4] is InterpolationString);
3181 } 3676 }
3677
3182 void test_parseStringLiteral_single() { 3678 void test_parseStringLiteral_single() {
3183 SimpleStringLiteral literal = ParserTestCase.parse5("parseStringLiteral", "' a'", []); 3679 SimpleStringLiteral literal = ParserTestCase.parse5("parseStringLiteral", "' a'", []);
3184 JUnitTestCase.assertNotNull(literal.literal); 3680 JUnitTestCase.assertNotNull(literal.literal);
3185 JUnitTestCase.assertEquals("a", literal.value); 3681 JUnitTestCase.assertEquals("a", literal.value);
3186 } 3682 }
3683
3187 void test_parseSuperConstructorInvocation_named() { 3684 void test_parseSuperConstructorInvocation_named() {
3188 SuperConstructorInvocation invocation = ParserTestCase.parse5("parseSuperCon structorInvocation", "super.a()", []); 3685 SuperConstructorInvocation invocation = ParserTestCase.parse5("parseSuperCon structorInvocation", "super.a()", []);
3189 JUnitTestCase.assertNotNull(invocation.argumentList); 3686 JUnitTestCase.assertNotNull(invocation.argumentList);
3190 JUnitTestCase.assertNotNull(invocation.constructorName); 3687 JUnitTestCase.assertNotNull(invocation.constructorName);
3191 JUnitTestCase.assertNotNull(invocation.keyword); 3688 JUnitTestCase.assertNotNull(invocation.keyword);
3192 JUnitTestCase.assertNotNull(invocation.period); 3689 JUnitTestCase.assertNotNull(invocation.period);
3193 } 3690 }
3691
3194 void test_parseSuperConstructorInvocation_unnamed() { 3692 void test_parseSuperConstructorInvocation_unnamed() {
3195 SuperConstructorInvocation invocation = ParserTestCase.parse5("parseSuperCon structorInvocation", "super()", []); 3693 SuperConstructorInvocation invocation = ParserTestCase.parse5("parseSuperCon structorInvocation", "super()", []);
3196 JUnitTestCase.assertNotNull(invocation.argumentList); 3694 JUnitTestCase.assertNotNull(invocation.argumentList);
3197 JUnitTestCase.assertNull(invocation.constructorName); 3695 JUnitTestCase.assertNull(invocation.constructorName);
3198 JUnitTestCase.assertNotNull(invocation.keyword); 3696 JUnitTestCase.assertNotNull(invocation.keyword);
3199 JUnitTestCase.assertNull(invocation.period); 3697 JUnitTestCase.assertNull(invocation.period);
3200 } 3698 }
3699
3201 void test_parseSwitchStatement_case() { 3700 void test_parseSwitchStatement_case() {
3202 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {case 1: return 'I';}", []); 3701 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {case 1: return 'I';}", []);
3203 JUnitTestCase.assertNotNull(statement.keyword); 3702 JUnitTestCase.assertNotNull(statement.keyword);
3204 JUnitTestCase.assertNotNull(statement.leftParenthesis); 3703 JUnitTestCase.assertNotNull(statement.leftParenthesis);
3205 JUnitTestCase.assertNotNull(statement.expression); 3704 JUnitTestCase.assertNotNull(statement.expression);
3206 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3705 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3207 JUnitTestCase.assertNotNull(statement.leftBracket); 3706 JUnitTestCase.assertNotNull(statement.leftBracket);
3208 EngineTestCase.assertSize(1, statement.members); 3707 EngineTestCase.assertSize(1, statement.members);
3209 JUnitTestCase.assertNotNull(statement.rightBracket); 3708 JUnitTestCase.assertNotNull(statement.rightBracket);
3210 } 3709 }
3710
3211 void test_parseSwitchStatement_empty() { 3711 void test_parseSwitchStatement_empty() {
3212 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {}", []); 3712 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {}", []);
3213 JUnitTestCase.assertNotNull(statement.keyword); 3713 JUnitTestCase.assertNotNull(statement.keyword);
3214 JUnitTestCase.assertNotNull(statement.leftParenthesis); 3714 JUnitTestCase.assertNotNull(statement.leftParenthesis);
3215 JUnitTestCase.assertNotNull(statement.expression); 3715 JUnitTestCase.assertNotNull(statement.expression);
3216 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3716 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3217 JUnitTestCase.assertNotNull(statement.leftBracket); 3717 JUnitTestCase.assertNotNull(statement.leftBracket);
3218 EngineTestCase.assertSize(0, statement.members); 3718 EngineTestCase.assertSize(0, statement.members);
3219 JUnitTestCase.assertNotNull(statement.rightBracket); 3719 JUnitTestCase.assertNotNull(statement.rightBracket);
3220 } 3720 }
3721
3221 void test_parseSwitchStatement_labeledCase() { 3722 void test_parseSwitchStatement_labeledCase() {
3222 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {l1: l2: l3: case(1):}", []); 3723 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {l1: l2: l3: case(1):}", []);
3223 JUnitTestCase.assertNotNull(statement.keyword); 3724 JUnitTestCase.assertNotNull(statement.keyword);
3224 JUnitTestCase.assertNotNull(statement.leftParenthesis); 3725 JUnitTestCase.assertNotNull(statement.leftParenthesis);
3225 JUnitTestCase.assertNotNull(statement.expression); 3726 JUnitTestCase.assertNotNull(statement.expression);
3226 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3727 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3227 JUnitTestCase.assertNotNull(statement.leftBracket); 3728 JUnitTestCase.assertNotNull(statement.leftBracket);
3228 EngineTestCase.assertSize(1, statement.members); 3729 EngineTestCase.assertSize(1, statement.members);
3229 EngineTestCase.assertSize(3, statement.members[0].labels); 3730 EngineTestCase.assertSize(3, statement.members[0].labels);
3230 JUnitTestCase.assertNotNull(statement.rightBracket); 3731 JUnitTestCase.assertNotNull(statement.rightBracket);
3231 } 3732 }
3733
3232 void test_parseSwitchStatement_labeledStatementInCase() { 3734 void test_parseSwitchStatement_labeledStatementInCase() {
3233 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {case 0: f(); l1: g(); break;}", []); 3735 SwitchStatement statement = ParserTestCase.parse5("parseSwitchStatement", "s witch (a) {case 0: f(); l1: g(); break;}", []);
3234 JUnitTestCase.assertNotNull(statement.keyword); 3736 JUnitTestCase.assertNotNull(statement.keyword);
3235 JUnitTestCase.assertNotNull(statement.leftParenthesis); 3737 JUnitTestCase.assertNotNull(statement.leftParenthesis);
3236 JUnitTestCase.assertNotNull(statement.expression); 3738 JUnitTestCase.assertNotNull(statement.expression);
3237 JUnitTestCase.assertNotNull(statement.rightParenthesis); 3739 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3238 JUnitTestCase.assertNotNull(statement.leftBracket); 3740 JUnitTestCase.assertNotNull(statement.leftBracket);
3239 EngineTestCase.assertSize(1, statement.members); 3741 EngineTestCase.assertSize(1, statement.members);
3240 EngineTestCase.assertSize(3, statement.members[0].statements); 3742 EngineTestCase.assertSize(3, statement.members[0].statements);
3241 JUnitTestCase.assertNotNull(statement.rightBracket); 3743 JUnitTestCase.assertNotNull(statement.rightBracket);
3242 } 3744 }
3745
3243 void test_parseSymbolLiteral_builtInIdentifier() { 3746 void test_parseSymbolLiteral_builtInIdentifier() {
3244 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#dynami c.static.abstract", []); 3747 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#dynami c.static.abstract", []);
3245 JUnitTestCase.assertNotNull(literal.poundSign); 3748 JUnitTestCase.assertNotNull(literal.poundSign);
3246 List<Token> components = literal.components; 3749 List<Token> components = literal.components;
3247 EngineTestCase.assertLength(3, components); 3750 EngineTestCase.assertLength(3, components);
3248 JUnitTestCase.assertEquals("dynamic", components[0].lexeme); 3751 JUnitTestCase.assertEquals("dynamic", components[0].lexeme);
3249 JUnitTestCase.assertEquals("static", components[1].lexeme); 3752 JUnitTestCase.assertEquals("static", components[1].lexeme);
3250 JUnitTestCase.assertEquals("abstract", components[2].lexeme); 3753 JUnitTestCase.assertEquals("abstract", components[2].lexeme);
3251 } 3754 }
3755
3252 void test_parseSymbolLiteral_multiple() { 3756 void test_parseSymbolLiteral_multiple() {
3253 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a.b.c" , []); 3757 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a.b.c" , []);
3254 JUnitTestCase.assertNotNull(literal.poundSign); 3758 JUnitTestCase.assertNotNull(literal.poundSign);
3255 List<Token> components = literal.components; 3759 List<Token> components = literal.components;
3256 EngineTestCase.assertLength(3, components); 3760 EngineTestCase.assertLength(3, components);
3257 JUnitTestCase.assertEquals("a", components[0].lexeme); 3761 JUnitTestCase.assertEquals("a", components[0].lexeme);
3258 JUnitTestCase.assertEquals("b", components[1].lexeme); 3762 JUnitTestCase.assertEquals("b", components[1].lexeme);
3259 JUnitTestCase.assertEquals("c", components[2].lexeme); 3763 JUnitTestCase.assertEquals("c", components[2].lexeme);
3260 } 3764 }
3765
3261 void test_parseSymbolLiteral_operator() { 3766 void test_parseSymbolLiteral_operator() {
3262 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#==", [ ]); 3767 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#==", [ ]);
3263 JUnitTestCase.assertNotNull(literal.poundSign); 3768 JUnitTestCase.assertNotNull(literal.poundSign);
3264 List<Token> components = literal.components; 3769 List<Token> components = literal.components;
3265 EngineTestCase.assertLength(1, components); 3770 EngineTestCase.assertLength(1, components);
3266 JUnitTestCase.assertEquals("==", components[0].lexeme); 3771 JUnitTestCase.assertEquals("==", components[0].lexeme);
3267 } 3772 }
3773
3268 void test_parseSymbolLiteral_single() { 3774 void test_parseSymbolLiteral_single() {
3269 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a", [] ); 3775 SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a", [] );
3270 JUnitTestCase.assertNotNull(literal.poundSign); 3776 JUnitTestCase.assertNotNull(literal.poundSign);
3271 List<Token> components = literal.components; 3777 List<Token> components = literal.components;
3272 EngineTestCase.assertLength(1, components); 3778 EngineTestCase.assertLength(1, components);
3273 JUnitTestCase.assertEquals("a", components[0].lexeme); 3779 JUnitTestCase.assertEquals("a", components[0].lexeme);
3274 } 3780 }
3781
3275 void test_parseThrowExpression() { 3782 void test_parseThrowExpression() {
3276 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpression", " throw x;", []); 3783 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpression", " throw x;", []);
3277 JUnitTestCase.assertNotNull(expression.keyword); 3784 JUnitTestCase.assertNotNull(expression.keyword);
3278 JUnitTestCase.assertNotNull(expression.expression); 3785 JUnitTestCase.assertNotNull(expression.expression);
3279 } 3786 }
3787
3280 void test_parseThrowExpressionWithoutCascade() { 3788 void test_parseThrowExpressionWithoutCascade() {
3281 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpressionWith outCascade", "throw x;", []); 3789 ThrowExpression expression = ParserTestCase.parse5("parseThrowExpressionWith outCascade", "throw x;", []);
3282 JUnitTestCase.assertNotNull(expression.keyword); 3790 JUnitTestCase.assertNotNull(expression.keyword);
3283 JUnitTestCase.assertNotNull(expression.expression); 3791 JUnitTestCase.assertNotNull(expression.expression);
3284 } 3792 }
3793
3285 void test_parseTryStatement_catch() { 3794 void test_parseTryStatement_catch() {
3286 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} catch (e) {}", []); 3795 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} catch (e) {}", []);
3287 JUnitTestCase.assertNotNull(statement.tryKeyword); 3796 JUnitTestCase.assertNotNull(statement.tryKeyword);
3288 JUnitTestCase.assertNotNull(statement.body); 3797 JUnitTestCase.assertNotNull(statement.body);
3289 NodeList<CatchClause> catchClauses = statement.catchClauses; 3798 NodeList<CatchClause> catchClauses = statement.catchClauses;
3290 EngineTestCase.assertSize(1, catchClauses); 3799 EngineTestCase.assertSize(1, catchClauses);
3291 CatchClause clause = catchClauses[0]; 3800 CatchClause clause = catchClauses[0];
3292 JUnitTestCase.assertNull(clause.onKeyword); 3801 JUnitTestCase.assertNull(clause.onKeyword);
3293 JUnitTestCase.assertNull(clause.exceptionType); 3802 JUnitTestCase.assertNull(clause.exceptionType);
3294 JUnitTestCase.assertNotNull(clause.catchKeyword); 3803 JUnitTestCase.assertNotNull(clause.catchKeyword);
3295 JUnitTestCase.assertNotNull(clause.exceptionParameter); 3804 JUnitTestCase.assertNotNull(clause.exceptionParameter);
3296 JUnitTestCase.assertNull(clause.comma); 3805 JUnitTestCase.assertNull(clause.comma);
3297 JUnitTestCase.assertNull(clause.stackTraceParameter); 3806 JUnitTestCase.assertNull(clause.stackTraceParameter);
3298 JUnitTestCase.assertNotNull(clause.body); 3807 JUnitTestCase.assertNotNull(clause.body);
3299 JUnitTestCase.assertNull(statement.finallyKeyword); 3808 JUnitTestCase.assertNull(statement.finallyKeyword);
3300 JUnitTestCase.assertNull(statement.finallyBlock); 3809 JUnitTestCase.assertNull(statement.finallyBlock);
3301 } 3810 }
3811
3302 void test_parseTryStatement_catch_finally() { 3812 void test_parseTryStatement_catch_finally() {
3303 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} catch (e, s) {} finally {}", []); 3813 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} catch (e, s) {} finally {}", []);
3304 JUnitTestCase.assertNotNull(statement.tryKeyword); 3814 JUnitTestCase.assertNotNull(statement.tryKeyword);
3305 JUnitTestCase.assertNotNull(statement.body); 3815 JUnitTestCase.assertNotNull(statement.body);
3306 NodeList<CatchClause> catchClauses = statement.catchClauses; 3816 NodeList<CatchClause> catchClauses = statement.catchClauses;
3307 EngineTestCase.assertSize(1, catchClauses); 3817 EngineTestCase.assertSize(1, catchClauses);
3308 CatchClause clause = catchClauses[0]; 3818 CatchClause clause = catchClauses[0];
3309 JUnitTestCase.assertNull(clause.onKeyword); 3819 JUnitTestCase.assertNull(clause.onKeyword);
3310 JUnitTestCase.assertNull(clause.exceptionType); 3820 JUnitTestCase.assertNull(clause.exceptionType);
3311 JUnitTestCase.assertNotNull(clause.catchKeyword); 3821 JUnitTestCase.assertNotNull(clause.catchKeyword);
3312 JUnitTestCase.assertNotNull(clause.exceptionParameter); 3822 JUnitTestCase.assertNotNull(clause.exceptionParameter);
3313 JUnitTestCase.assertNotNull(clause.comma); 3823 JUnitTestCase.assertNotNull(clause.comma);
3314 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 3824 JUnitTestCase.assertNotNull(clause.stackTraceParameter);
3315 JUnitTestCase.assertNotNull(clause.body); 3825 JUnitTestCase.assertNotNull(clause.body);
3316 JUnitTestCase.assertNotNull(statement.finallyKeyword); 3826 JUnitTestCase.assertNotNull(statement.finallyKeyword);
3317 JUnitTestCase.assertNotNull(statement.finallyBlock); 3827 JUnitTestCase.assertNotNull(statement.finallyBlock);
3318 } 3828 }
3829
3319 void test_parseTryStatement_finally() { 3830 void test_parseTryStatement_finally() {
3320 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} finally {}", []); 3831 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} finally {}", []);
3321 JUnitTestCase.assertNotNull(statement.tryKeyword); 3832 JUnitTestCase.assertNotNull(statement.tryKeyword);
3322 JUnitTestCase.assertNotNull(statement.body); 3833 JUnitTestCase.assertNotNull(statement.body);
3323 EngineTestCase.assertSize(0, statement.catchClauses); 3834 EngineTestCase.assertSize(0, statement.catchClauses);
3324 JUnitTestCase.assertNotNull(statement.finallyKeyword); 3835 JUnitTestCase.assertNotNull(statement.finallyKeyword);
3325 JUnitTestCase.assertNotNull(statement.finallyBlock); 3836 JUnitTestCase.assertNotNull(statement.finallyBlock);
3326 } 3837 }
3838
3327 void test_parseTryStatement_multiple() { 3839 void test_parseTryStatement_multiple() {
3328 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}", []); 3840 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}", []);
3329 JUnitTestCase.assertNotNull(statement.tryKeyword); 3841 JUnitTestCase.assertNotNull(statement.tryKeyword);
3330 JUnitTestCase.assertNotNull(statement.body); 3842 JUnitTestCase.assertNotNull(statement.body);
3331 EngineTestCase.assertSize(3, statement.catchClauses); 3843 EngineTestCase.assertSize(3, statement.catchClauses);
3332 JUnitTestCase.assertNull(statement.finallyKeyword); 3844 JUnitTestCase.assertNull(statement.finallyKeyword);
3333 JUnitTestCase.assertNull(statement.finallyBlock); 3845 JUnitTestCase.assertNull(statement.finallyBlock);
3334 } 3846 }
3847
3335 void test_parseTryStatement_on() { 3848 void test_parseTryStatement_on() {
3336 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error {}", []); 3849 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error {}", []);
3337 JUnitTestCase.assertNotNull(statement.tryKeyword); 3850 JUnitTestCase.assertNotNull(statement.tryKeyword);
3338 JUnitTestCase.assertNotNull(statement.body); 3851 JUnitTestCase.assertNotNull(statement.body);
3339 NodeList<CatchClause> catchClauses = statement.catchClauses; 3852 NodeList<CatchClause> catchClauses = statement.catchClauses;
3340 EngineTestCase.assertSize(1, catchClauses); 3853 EngineTestCase.assertSize(1, catchClauses);
3341 CatchClause clause = catchClauses[0]; 3854 CatchClause clause = catchClauses[0];
3342 JUnitTestCase.assertNotNull(clause.onKeyword); 3855 JUnitTestCase.assertNotNull(clause.onKeyword);
3343 JUnitTestCase.assertNotNull(clause.exceptionType); 3856 JUnitTestCase.assertNotNull(clause.exceptionType);
3344 JUnitTestCase.assertNull(clause.catchKeyword); 3857 JUnitTestCase.assertNull(clause.catchKeyword);
3345 JUnitTestCase.assertNull(clause.exceptionParameter); 3858 JUnitTestCase.assertNull(clause.exceptionParameter);
3346 JUnitTestCase.assertNull(clause.comma); 3859 JUnitTestCase.assertNull(clause.comma);
3347 JUnitTestCase.assertNull(clause.stackTraceParameter); 3860 JUnitTestCase.assertNull(clause.stackTraceParameter);
3348 JUnitTestCase.assertNotNull(clause.body); 3861 JUnitTestCase.assertNotNull(clause.body);
3349 JUnitTestCase.assertNull(statement.finallyKeyword); 3862 JUnitTestCase.assertNull(statement.finallyKeyword);
3350 JUnitTestCase.assertNull(statement.finallyBlock); 3863 JUnitTestCase.assertNull(statement.finallyBlock);
3351 } 3864 }
3865
3352 void test_parseTryStatement_on_catch() { 3866 void test_parseTryStatement_on_catch() {
3353 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {}", []); 3867 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {}", []);
3354 JUnitTestCase.assertNotNull(statement.tryKeyword); 3868 JUnitTestCase.assertNotNull(statement.tryKeyword);
3355 JUnitTestCase.assertNotNull(statement.body); 3869 JUnitTestCase.assertNotNull(statement.body);
3356 NodeList<CatchClause> catchClauses = statement.catchClauses; 3870 NodeList<CatchClause> catchClauses = statement.catchClauses;
3357 EngineTestCase.assertSize(1, catchClauses); 3871 EngineTestCase.assertSize(1, catchClauses);
3358 CatchClause clause = catchClauses[0]; 3872 CatchClause clause = catchClauses[0];
3359 JUnitTestCase.assertNotNull(clause.onKeyword); 3873 JUnitTestCase.assertNotNull(clause.onKeyword);
3360 JUnitTestCase.assertNotNull(clause.exceptionType); 3874 JUnitTestCase.assertNotNull(clause.exceptionType);
3361 JUnitTestCase.assertNotNull(clause.catchKeyword); 3875 JUnitTestCase.assertNotNull(clause.catchKeyword);
3362 JUnitTestCase.assertNotNull(clause.exceptionParameter); 3876 JUnitTestCase.assertNotNull(clause.exceptionParameter);
3363 JUnitTestCase.assertNotNull(clause.comma); 3877 JUnitTestCase.assertNotNull(clause.comma);
3364 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 3878 JUnitTestCase.assertNotNull(clause.stackTraceParameter);
3365 JUnitTestCase.assertNotNull(clause.body); 3879 JUnitTestCase.assertNotNull(clause.body);
3366 JUnitTestCase.assertNull(statement.finallyKeyword); 3880 JUnitTestCase.assertNull(statement.finallyKeyword);
3367 JUnitTestCase.assertNull(statement.finallyBlock); 3881 JUnitTestCase.assertNull(statement.finallyBlock);
3368 } 3882 }
3883
3369 void test_parseTryStatement_on_catch_finally() { 3884 void test_parseTryStatement_on_catch_finally() {
3370 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {} finally {}", []); 3885 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {} finally {}", []);
3371 JUnitTestCase.assertNotNull(statement.tryKeyword); 3886 JUnitTestCase.assertNotNull(statement.tryKeyword);
3372 JUnitTestCase.assertNotNull(statement.body); 3887 JUnitTestCase.assertNotNull(statement.body);
3373 NodeList<CatchClause> catchClauses = statement.catchClauses; 3888 NodeList<CatchClause> catchClauses = statement.catchClauses;
3374 EngineTestCase.assertSize(1, catchClauses); 3889 EngineTestCase.assertSize(1, catchClauses);
3375 CatchClause clause = catchClauses[0]; 3890 CatchClause clause = catchClauses[0];
3376 JUnitTestCase.assertNotNull(clause.onKeyword); 3891 JUnitTestCase.assertNotNull(clause.onKeyword);
3377 JUnitTestCase.assertNotNull(clause.exceptionType); 3892 JUnitTestCase.assertNotNull(clause.exceptionType);
3378 JUnitTestCase.assertNotNull(clause.catchKeyword); 3893 JUnitTestCase.assertNotNull(clause.catchKeyword);
3379 JUnitTestCase.assertNotNull(clause.exceptionParameter); 3894 JUnitTestCase.assertNotNull(clause.exceptionParameter);
3380 JUnitTestCase.assertNotNull(clause.comma); 3895 JUnitTestCase.assertNotNull(clause.comma);
3381 JUnitTestCase.assertNotNull(clause.stackTraceParameter); 3896 JUnitTestCase.assertNotNull(clause.stackTraceParameter);
3382 JUnitTestCase.assertNotNull(clause.body); 3897 JUnitTestCase.assertNotNull(clause.body);
3383 JUnitTestCase.assertNotNull(statement.finallyKeyword); 3898 JUnitTestCase.assertNotNull(statement.finallyKeyword);
3384 JUnitTestCase.assertNotNull(statement.finallyBlock); 3899 JUnitTestCase.assertNotNull(statement.finallyBlock);
3385 } 3900 }
3901
3386 void test_parseTypeAlias_function_noParameters() { 3902 void test_parseTypeAlias_function_noParameters() {
3387 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F();"); 3903 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F();");
3388 JUnitTestCase.assertNotNull(typeAlias.keyword); 3904 JUnitTestCase.assertNotNull(typeAlias.keyword);
3389 JUnitTestCase.assertNotNull(typeAlias.name); 3905 JUnitTestCase.assertNotNull(typeAlias.name);
3390 JUnitTestCase.assertNotNull(typeAlias.parameters); 3906 JUnitTestCase.assertNotNull(typeAlias.parameters);
3391 JUnitTestCase.assertNotNull(typeAlias.returnType); 3907 JUnitTestCase.assertNotNull(typeAlias.returnType);
3392 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3908 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3393 JUnitTestCase.assertNull(typeAlias.typeParameters); 3909 JUnitTestCase.assertNull(typeAlias.typeParameters);
3394 } 3910 }
3911
3395 void test_parseTypeAlias_function_noReturnType() { 3912 void test_parseTypeAlias_function_noReturnType() {
3396 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef F();"); 3913 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef F();");
3397 JUnitTestCase.assertNotNull(typeAlias.keyword); 3914 JUnitTestCase.assertNotNull(typeAlias.keyword);
3398 JUnitTestCase.assertNotNull(typeAlias.name); 3915 JUnitTestCase.assertNotNull(typeAlias.name);
3399 JUnitTestCase.assertNotNull(typeAlias.parameters); 3916 JUnitTestCase.assertNotNull(typeAlias.parameters);
3400 JUnitTestCase.assertNull(typeAlias.returnType); 3917 JUnitTestCase.assertNull(typeAlias.returnType);
3401 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3918 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3402 JUnitTestCase.assertNull(typeAlias.typeParameters); 3919 JUnitTestCase.assertNull(typeAlias.typeParameters);
3403 } 3920 }
3921
3404 void test_parseTypeAlias_function_parameterizedReturnType() { 3922 void test_parseTypeAlias_function_parameterizedReturnType() {
3405 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef A<B> F();"); 3923 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef A<B> F();");
3406 JUnitTestCase.assertNotNull(typeAlias.keyword); 3924 JUnitTestCase.assertNotNull(typeAlias.keyword);
3407 JUnitTestCase.assertNotNull(typeAlias.name); 3925 JUnitTestCase.assertNotNull(typeAlias.name);
3408 JUnitTestCase.assertNotNull(typeAlias.parameters); 3926 JUnitTestCase.assertNotNull(typeAlias.parameters);
3409 JUnitTestCase.assertNotNull(typeAlias.returnType); 3927 JUnitTestCase.assertNotNull(typeAlias.returnType);
3410 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3928 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3411 JUnitTestCase.assertNull(typeAlias.typeParameters); 3929 JUnitTestCase.assertNull(typeAlias.typeParameters);
3412 } 3930 }
3931
3413 void test_parseTypeAlias_function_parameters() { 3932 void test_parseTypeAlias_function_parameters() {
3414 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F(Object value);"); 3933 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F(Object value);");
3415 JUnitTestCase.assertNotNull(typeAlias.keyword); 3934 JUnitTestCase.assertNotNull(typeAlias.keyword);
3416 JUnitTestCase.assertNotNull(typeAlias.name); 3935 JUnitTestCase.assertNotNull(typeAlias.name);
3417 JUnitTestCase.assertNotNull(typeAlias.parameters); 3936 JUnitTestCase.assertNotNull(typeAlias.parameters);
3418 JUnitTestCase.assertNotNull(typeAlias.returnType); 3937 JUnitTestCase.assertNotNull(typeAlias.returnType);
3419 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3938 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3420 JUnitTestCase.assertNull(typeAlias.typeParameters); 3939 JUnitTestCase.assertNull(typeAlias.typeParameters);
3421 } 3940 }
3941
3422 void test_parseTypeAlias_function_typeParameters() { 3942 void test_parseTypeAlias_function_typeParameters() {
3423 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F<E>();"); 3943 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef bool F<E>();");
3424 JUnitTestCase.assertNotNull(typeAlias.keyword); 3944 JUnitTestCase.assertNotNull(typeAlias.keyword);
3425 JUnitTestCase.assertNotNull(typeAlias.name); 3945 JUnitTestCase.assertNotNull(typeAlias.name);
3426 JUnitTestCase.assertNotNull(typeAlias.parameters); 3946 JUnitTestCase.assertNotNull(typeAlias.parameters);
3427 JUnitTestCase.assertNotNull(typeAlias.returnType); 3947 JUnitTestCase.assertNotNull(typeAlias.returnType);
3428 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3948 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3429 JUnitTestCase.assertNotNull(typeAlias.typeParameters); 3949 JUnitTestCase.assertNotNull(typeAlias.typeParameters);
3430 } 3950 }
3951
3431 void test_parseTypeAlias_function_voidReturnType() { 3952 void test_parseTypeAlias_function_voidReturnType() {
3432 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef void F();"); 3953 FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object > [emptyCommentAndMetadata()], "typedef void F();");
3433 JUnitTestCase.assertNotNull(typeAlias.keyword); 3954 JUnitTestCase.assertNotNull(typeAlias.keyword);
3434 JUnitTestCase.assertNotNull(typeAlias.name); 3955 JUnitTestCase.assertNotNull(typeAlias.name);
3435 JUnitTestCase.assertNotNull(typeAlias.parameters); 3956 JUnitTestCase.assertNotNull(typeAlias.parameters);
3436 JUnitTestCase.assertNotNull(typeAlias.returnType); 3957 JUnitTestCase.assertNotNull(typeAlias.returnType);
3437 JUnitTestCase.assertNotNull(typeAlias.semicolon); 3958 JUnitTestCase.assertNotNull(typeAlias.semicolon);
3438 JUnitTestCase.assertNull(typeAlias.typeParameters); 3959 JUnitTestCase.assertNull(typeAlias.typeParameters);
3439 } 3960 }
3961
3440 void test_parseTypeArgumentList_multiple() { 3962 void test_parseTypeArgumentList_multiple() {
3441 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<int, int, int>", []); 3963 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<int, int, int>", []);
3442 JUnitTestCase.assertNotNull(argumentList.leftBracket); 3964 JUnitTestCase.assertNotNull(argumentList.leftBracket);
3443 EngineTestCase.assertSize(3, argumentList.arguments); 3965 EngineTestCase.assertSize(3, argumentList.arguments);
3444 JUnitTestCase.assertNotNull(argumentList.rightBracket); 3966 JUnitTestCase.assertNotNull(argumentList.rightBracket);
3445 } 3967 }
3968
3446 void test_parseTypeArgumentList_nested() { 3969 void test_parseTypeArgumentList_nested() {
3447 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<A<B>>", []); 3970 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<A<B>>", []);
3448 JUnitTestCase.assertNotNull(argumentList.leftBracket); 3971 JUnitTestCase.assertNotNull(argumentList.leftBracket);
3449 EngineTestCase.assertSize(1, argumentList.arguments); 3972 EngineTestCase.assertSize(1, argumentList.arguments);
3450 TypeName argument = argumentList.arguments[0]; 3973 TypeName argument = argumentList.arguments[0];
3451 JUnitTestCase.assertNotNull(argument); 3974 JUnitTestCase.assertNotNull(argument);
3452 TypeArgumentList innerList = argument.typeArguments; 3975 TypeArgumentList innerList = argument.typeArguments;
3453 JUnitTestCase.assertNotNull(innerList); 3976 JUnitTestCase.assertNotNull(innerList);
3454 EngineTestCase.assertSize(1, innerList.arguments); 3977 EngineTestCase.assertSize(1, innerList.arguments);
3455 JUnitTestCase.assertNotNull(argumentList.rightBracket); 3978 JUnitTestCase.assertNotNull(argumentList.rightBracket);
3456 } 3979 }
3980
3457 void test_parseTypeArgumentList_single() { 3981 void test_parseTypeArgumentList_single() {
3458 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<int>", []); 3982 TypeArgumentList argumentList = ParserTestCase.parse5("parseTypeArgumentList ", "<int>", []);
3459 JUnitTestCase.assertNotNull(argumentList.leftBracket); 3983 JUnitTestCase.assertNotNull(argumentList.leftBracket);
3460 EngineTestCase.assertSize(1, argumentList.arguments); 3984 EngineTestCase.assertSize(1, argumentList.arguments);
3461 JUnitTestCase.assertNotNull(argumentList.rightBracket); 3985 JUnitTestCase.assertNotNull(argumentList.rightBracket);
3462 } 3986 }
3987
3463 void test_parseTypeName_parameterized() { 3988 void test_parseTypeName_parameterized() {
3464 TypeName typeName = ParserTestCase.parse5("parseTypeName", "List<int>", []); 3989 TypeName typeName = ParserTestCase.parse5("parseTypeName", "List<int>", []);
3465 JUnitTestCase.assertNotNull(typeName.name); 3990 JUnitTestCase.assertNotNull(typeName.name);
3466 JUnitTestCase.assertNotNull(typeName.typeArguments); 3991 JUnitTestCase.assertNotNull(typeName.typeArguments);
3467 } 3992 }
3993
3468 void test_parseTypeName_simple() { 3994 void test_parseTypeName_simple() {
3469 TypeName typeName = ParserTestCase.parse5("parseTypeName", "int", []); 3995 TypeName typeName = ParserTestCase.parse5("parseTypeName", "int", []);
3470 JUnitTestCase.assertNotNull(typeName.name); 3996 JUnitTestCase.assertNotNull(typeName.name);
3471 JUnitTestCase.assertNull(typeName.typeArguments); 3997 JUnitTestCase.assertNull(typeName.typeArguments);
3472 } 3998 }
3999
3473 void test_parseTypeParameter_bounded() { 4000 void test_parseTypeParameter_bounded() {
3474 TypeParameter parameter = ParserTestCase.parse5("parseTypeParameter", "A ext ends B", []); 4001 TypeParameter parameter = ParserTestCase.parse5("parseTypeParameter", "A ext ends B", []);
3475 JUnitTestCase.assertNotNull(parameter.bound); 4002 JUnitTestCase.assertNotNull(parameter.bound);
3476 JUnitTestCase.assertNotNull(parameter.keyword); 4003 JUnitTestCase.assertNotNull(parameter.keyword);
3477 JUnitTestCase.assertNotNull(parameter.name); 4004 JUnitTestCase.assertNotNull(parameter.name);
3478 } 4005 }
4006
3479 void test_parseTypeParameter_simple() { 4007 void test_parseTypeParameter_simple() {
3480 TypeParameter parameter = ParserTestCase.parse5("parseTypeParameter", "A", [ ]); 4008 TypeParameter parameter = ParserTestCase.parse5("parseTypeParameter", "A", [ ]);
3481 JUnitTestCase.assertNull(parameter.bound); 4009 JUnitTestCase.assertNull(parameter.bound);
3482 JUnitTestCase.assertNull(parameter.keyword); 4010 JUnitTestCase.assertNull(parameter.keyword);
3483 JUnitTestCase.assertNotNull(parameter.name); 4011 JUnitTestCase.assertNotNull(parameter.name);
3484 } 4012 }
4013
3485 void test_parseTypeParameterList_multiple() { 4014 void test_parseTypeParameterList_multiple() {
3486 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A, B extends C, D>", []); 4015 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A, B extends C, D>", []);
3487 JUnitTestCase.assertNotNull(parameterList.leftBracket); 4016 JUnitTestCase.assertNotNull(parameterList.leftBracket);
3488 JUnitTestCase.assertNotNull(parameterList.rightBracket); 4017 JUnitTestCase.assertNotNull(parameterList.rightBracket);
3489 EngineTestCase.assertSize(3, parameterList.typeParameters); 4018 EngineTestCase.assertSize(3, parameterList.typeParameters);
3490 } 4019 }
4020
3491 void test_parseTypeParameterList_parameterizedWithTrailingEquals() { 4021 void test_parseTypeParameterList_parameterizedWithTrailingEquals() {
3492 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A extends B<E>>=", []); 4022 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A extends B<E>>=", []);
3493 JUnitTestCase.assertNotNull(parameterList.leftBracket); 4023 JUnitTestCase.assertNotNull(parameterList.leftBracket);
3494 JUnitTestCase.assertNotNull(parameterList.rightBracket); 4024 JUnitTestCase.assertNotNull(parameterList.rightBracket);
3495 EngineTestCase.assertSize(1, parameterList.typeParameters); 4025 EngineTestCase.assertSize(1, parameterList.typeParameters);
3496 } 4026 }
4027
3497 void test_parseTypeParameterList_single() { 4028 void test_parseTypeParameterList_single() {
3498 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A>", []); 4029 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A>", []);
3499 JUnitTestCase.assertNotNull(parameterList.leftBracket); 4030 JUnitTestCase.assertNotNull(parameterList.leftBracket);
3500 JUnitTestCase.assertNotNull(parameterList.rightBracket); 4031 JUnitTestCase.assertNotNull(parameterList.rightBracket);
3501 EngineTestCase.assertSize(1, parameterList.typeParameters); 4032 EngineTestCase.assertSize(1, parameterList.typeParameters);
3502 } 4033 }
4034
3503 void test_parseTypeParameterList_withTrailingEquals() { 4035 void test_parseTypeParameterList_withTrailingEquals() {
3504 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A>=", []); 4036 TypeParameterList parameterList = ParserTestCase.parse5("parseTypeParameterL ist", "<A>=", []);
3505 JUnitTestCase.assertNotNull(parameterList.leftBracket); 4037 JUnitTestCase.assertNotNull(parameterList.leftBracket);
3506 JUnitTestCase.assertNotNull(parameterList.rightBracket); 4038 JUnitTestCase.assertNotNull(parameterList.rightBracket);
3507 EngineTestCase.assertSize(1, parameterList.typeParameters); 4039 EngineTestCase.assertSize(1, parameterList.typeParameters);
3508 } 4040 }
4041
3509 void test_parseUnaryExpression_decrement_normal() { 4042 void test_parseUnaryExpression_decrement_normal() {
3510 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--x", []); 4043 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--x", []);
3511 JUnitTestCase.assertNotNull(expression.operator); 4044 JUnitTestCase.assertNotNull(expression.operator);
3512 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 4045 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type);
3513 JUnitTestCase.assertNotNull(expression.operand); 4046 JUnitTestCase.assertNotNull(expression.operand);
3514 } 4047 }
4048
3515 void test_parseUnaryExpression_decrement_super() { 4049 void test_parseUnaryExpression_decrement_super() {
3516 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--super", []); 4050 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--super", []);
3517 JUnitTestCase.assertNotNull(expression.operator); 4051 JUnitTestCase.assertNotNull(expression.operator);
3518 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 4052 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
3519 Expression innerExpression = expression.operand; 4053 Expression innerExpression = expression.operand;
3520 JUnitTestCase.assertNotNull(innerExpression); 4054 JUnitTestCase.assertNotNull(innerExpression);
3521 JUnitTestCase.assertTrue(innerExpression is PrefixExpression); 4055 JUnitTestCase.assertTrue(innerExpression is PrefixExpression);
3522 PrefixExpression operand = innerExpression as PrefixExpression; 4056 PrefixExpression operand = innerExpression as PrefixExpression;
3523 JUnitTestCase.assertNotNull(operand.operator); 4057 JUnitTestCase.assertNotNull(operand.operator);
3524 JUnitTestCase.assertEquals(TokenType.MINUS, operand.operator.type); 4058 JUnitTestCase.assertEquals(TokenType.MINUS, operand.operator.type);
3525 JUnitTestCase.assertNotNull(operand.operand); 4059 JUnitTestCase.assertNotNull(operand.operand);
3526 } 4060 }
4061
3527 void test_parseUnaryExpression_decrement_super_propertyAccess() { 4062 void test_parseUnaryExpression_decrement_super_propertyAccess() {
3528 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--super.x", []); 4063 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "--super.x", []);
3529 JUnitTestCase.assertNotNull(expression.operator); 4064 JUnitTestCase.assertNotNull(expression.operator);
3530 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type); 4065 JUnitTestCase.assertEquals(TokenType.MINUS_MINUS, expression.operator.type);
3531 JUnitTestCase.assertNotNull(expression.operand); 4066 JUnitTestCase.assertNotNull(expression.operand);
3532 PropertyAccess operand = expression.operand as PropertyAccess; 4067 PropertyAccess operand = expression.operand as PropertyAccess;
3533 JUnitTestCase.assertTrue(operand.target is SuperExpression); 4068 JUnitTestCase.assertTrue(operand.target is SuperExpression);
3534 JUnitTestCase.assertEquals("x", operand.propertyName.name); 4069 JUnitTestCase.assertEquals("x", operand.propertyName.name);
3535 } 4070 }
4071
3536 void test_parseUnaryExpression_increment_normal() { 4072 void test_parseUnaryExpression_increment_normal() {
3537 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++x", []); 4073 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++x", []);
3538 JUnitTestCase.assertNotNull(expression.operator); 4074 JUnitTestCase.assertNotNull(expression.operator);
3539 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 4075 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type);
3540 JUnitTestCase.assertNotNull(expression.operand); 4076 JUnitTestCase.assertNotNull(expression.operand);
3541 } 4077 }
4078
3542 void test_parseUnaryExpression_increment_super_index() { 4079 void test_parseUnaryExpression_increment_super_index() {
3543 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++super[0]", []); 4080 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++super[0]", []);
3544 JUnitTestCase.assertNotNull(expression.operator); 4081 JUnitTestCase.assertNotNull(expression.operator);
3545 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 4082 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type);
3546 JUnitTestCase.assertNotNull(expression.operand); 4083 JUnitTestCase.assertNotNull(expression.operand);
3547 IndexExpression operand = expression.operand as IndexExpression; 4084 IndexExpression operand = expression.operand as IndexExpression;
3548 JUnitTestCase.assertTrue(operand.realTarget is SuperExpression); 4085 JUnitTestCase.assertTrue(operand.realTarget is SuperExpression);
3549 JUnitTestCase.assertTrue(operand.index is IntegerLiteral); 4086 JUnitTestCase.assertTrue(operand.index is IntegerLiteral);
3550 } 4087 }
4088
3551 void test_parseUnaryExpression_increment_super_propertyAccess() { 4089 void test_parseUnaryExpression_increment_super_propertyAccess() {
3552 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++super.x", []); 4090 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "++super.x", []);
3553 JUnitTestCase.assertNotNull(expression.operator); 4091 JUnitTestCase.assertNotNull(expression.operator);
3554 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type); 4092 JUnitTestCase.assertEquals(TokenType.PLUS_PLUS, expression.operator.type);
3555 JUnitTestCase.assertNotNull(expression.operand); 4093 JUnitTestCase.assertNotNull(expression.operand);
3556 PropertyAccess operand = expression.operand as PropertyAccess; 4094 PropertyAccess operand = expression.operand as PropertyAccess;
3557 JUnitTestCase.assertTrue(operand.target is SuperExpression); 4095 JUnitTestCase.assertTrue(operand.target is SuperExpression);
3558 JUnitTestCase.assertEquals("x", operand.propertyName.name); 4096 JUnitTestCase.assertEquals("x", operand.propertyName.name);
3559 } 4097 }
4098
3560 void test_parseUnaryExpression_minus_normal() { 4099 void test_parseUnaryExpression_minus_normal() {
3561 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "-x", []); 4100 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "-x", []);
3562 JUnitTestCase.assertNotNull(expression.operator); 4101 JUnitTestCase.assertNotNull(expression.operator);
3563 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 4102 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
3564 JUnitTestCase.assertNotNull(expression.operand); 4103 JUnitTestCase.assertNotNull(expression.operand);
3565 } 4104 }
4105
3566 void test_parseUnaryExpression_minus_super() { 4106 void test_parseUnaryExpression_minus_super() {
3567 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "-super", []); 4107 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "-super", []);
3568 JUnitTestCase.assertNotNull(expression.operator); 4108 JUnitTestCase.assertNotNull(expression.operator);
3569 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 4109 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
3570 JUnitTestCase.assertNotNull(expression.operand); 4110 JUnitTestCase.assertNotNull(expression.operand);
3571 } 4111 }
4112
3572 void test_parseUnaryExpression_not_normal() { 4113 void test_parseUnaryExpression_not_normal() {
3573 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "!x", []); 4114 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "!x", []);
3574 JUnitTestCase.assertNotNull(expression.operator); 4115 JUnitTestCase.assertNotNull(expression.operator);
3575 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type); 4116 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type);
3576 JUnitTestCase.assertNotNull(expression.operand); 4117 JUnitTestCase.assertNotNull(expression.operand);
3577 } 4118 }
4119
3578 void test_parseUnaryExpression_not_super() { 4120 void test_parseUnaryExpression_not_super() {
3579 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "!super", []); 4121 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "!super", []);
3580 JUnitTestCase.assertNotNull(expression.operator); 4122 JUnitTestCase.assertNotNull(expression.operator);
3581 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type); 4123 JUnitTestCase.assertEquals(TokenType.BANG, expression.operator.type);
3582 JUnitTestCase.assertNotNull(expression.operand); 4124 JUnitTestCase.assertNotNull(expression.operand);
3583 } 4125 }
4126
3584 void test_parseUnaryExpression_tilda_normal() { 4127 void test_parseUnaryExpression_tilda_normal() {
3585 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "~x", []); 4128 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "~x", []);
3586 JUnitTestCase.assertNotNull(expression.operator); 4129 JUnitTestCase.assertNotNull(expression.operator);
3587 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type); 4130 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type);
3588 JUnitTestCase.assertNotNull(expression.operand); 4131 JUnitTestCase.assertNotNull(expression.operand);
3589 } 4132 }
4133
3590 void test_parseUnaryExpression_tilda_super() { 4134 void test_parseUnaryExpression_tilda_super() {
3591 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "~super", []); 4135 PrefixExpression expression = ParserTestCase.parse5("parseUnaryExpression", "~super", []);
3592 JUnitTestCase.assertNotNull(expression.operator); 4136 JUnitTestCase.assertNotNull(expression.operator);
3593 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type); 4137 JUnitTestCase.assertEquals(TokenType.TILDE, expression.operator.type);
3594 JUnitTestCase.assertNotNull(expression.operand); 4138 JUnitTestCase.assertNotNull(expression.operand);
3595 } 4139 }
4140
3596 void test_parseVariableDeclaration_equals() { 4141 void test_parseVariableDeclaration_equals() {
3597 VariableDeclaration declaration = ParserTestCase.parse5("parseVariableDeclar ation", "a = b", []); 4142 VariableDeclaration declaration = ParserTestCase.parse5("parseVariableDeclar ation", "a = b", []);
3598 JUnitTestCase.assertNotNull(declaration.name); 4143 JUnitTestCase.assertNotNull(declaration.name);
3599 JUnitTestCase.assertNotNull(declaration.equals); 4144 JUnitTestCase.assertNotNull(declaration.equals);
3600 JUnitTestCase.assertNotNull(declaration.initializer); 4145 JUnitTestCase.assertNotNull(declaration.initializer);
3601 } 4146 }
4147
3602 void test_parseVariableDeclaration_noEquals() { 4148 void test_parseVariableDeclaration_noEquals() {
3603 VariableDeclaration declaration = ParserTestCase.parse5("parseVariableDeclar ation", "a", []); 4149 VariableDeclaration declaration = ParserTestCase.parse5("parseVariableDeclar ation", "a", []);
3604 JUnitTestCase.assertNotNull(declaration.name); 4150 JUnitTestCase.assertNotNull(declaration.name);
3605 JUnitTestCase.assertNull(declaration.equals); 4151 JUnitTestCase.assertNull(declaration.equals);
3606 JUnitTestCase.assertNull(declaration.initializer); 4152 JUnitTestCase.assertNull(declaration.initializer);
3607 } 4153 }
4154
3608 void test_parseVariableDeclarationList_const_noType() { 4155 void test_parseVariableDeclarationList_const_noType() {
3609 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "const a"); 4156 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "const a");
3610 JUnitTestCase.assertNotNull(declarationList.keyword); 4157 JUnitTestCase.assertNotNull(declarationList.keyword);
3611 JUnitTestCase.assertNull(declarationList.type); 4158 JUnitTestCase.assertNull(declarationList.type);
3612 EngineTestCase.assertSize(1, declarationList.variables); 4159 EngineTestCase.assertSize(1, declarationList.variables);
3613 } 4160 }
4161
3614 void test_parseVariableDeclarationList_const_type() { 4162 void test_parseVariableDeclarationList_const_type() {
3615 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "const A a"); 4163 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "const A a");
3616 JUnitTestCase.assertNotNull(declarationList.keyword); 4164 JUnitTestCase.assertNotNull(declarationList.keyword);
3617 JUnitTestCase.assertNotNull(declarationList.type); 4165 JUnitTestCase.assertNotNull(declarationList.type);
3618 EngineTestCase.assertSize(1, declarationList.variables); 4166 EngineTestCase.assertSize(1, declarationList.variables);
3619 } 4167 }
4168
3620 void test_parseVariableDeclarationList_final_noType() { 4169 void test_parseVariableDeclarationList_final_noType() {
3621 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "final a"); 4170 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "final a");
3622 JUnitTestCase.assertNotNull(declarationList.keyword); 4171 JUnitTestCase.assertNotNull(declarationList.keyword);
3623 JUnitTestCase.assertNull(declarationList.type); 4172 JUnitTestCase.assertNull(declarationList.type);
3624 EngineTestCase.assertSize(1, declarationList.variables); 4173 EngineTestCase.assertSize(1, declarationList.variables);
3625 } 4174 }
4175
3626 void test_parseVariableDeclarationList_final_type() { 4176 void test_parseVariableDeclarationList_final_type() {
3627 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "final A a"); 4177 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "final A a");
3628 JUnitTestCase.assertNotNull(declarationList.keyword); 4178 JUnitTestCase.assertNotNull(declarationList.keyword);
3629 JUnitTestCase.assertNotNull(declarationList.type); 4179 JUnitTestCase.assertNotNull(declarationList.type);
3630 EngineTestCase.assertSize(1, declarationList.variables); 4180 EngineTestCase.assertSize(1, declarationList.variables);
3631 } 4181 }
4182
3632 void test_parseVariableDeclarationList_type_multiple() { 4183 void test_parseVariableDeclarationList_type_multiple() {
3633 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "A a, b, c"); 4184 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "A a, b, c");
3634 JUnitTestCase.assertNull(declarationList.keyword); 4185 JUnitTestCase.assertNull(declarationList.keyword);
3635 JUnitTestCase.assertNotNull(declarationList.type); 4186 JUnitTestCase.assertNotNull(declarationList.type);
3636 EngineTestCase.assertSize(3, declarationList.variables); 4187 EngineTestCase.assertSize(3, declarationList.variables);
3637 } 4188 }
4189
3638 void test_parseVariableDeclarationList_type_single() { 4190 void test_parseVariableDeclarationList_type_single() {
3639 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "A a"); 4191 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "A a");
3640 JUnitTestCase.assertNull(declarationList.keyword); 4192 JUnitTestCase.assertNull(declarationList.keyword);
3641 JUnitTestCase.assertNotNull(declarationList.type); 4193 JUnitTestCase.assertNotNull(declarationList.type);
3642 EngineTestCase.assertSize(1, declarationList.variables); 4194 EngineTestCase.assertSize(1, declarationList.variables);
3643 } 4195 }
4196
3644 void test_parseVariableDeclarationList_var_multiple() { 4197 void test_parseVariableDeclarationList_var_multiple() {
3645 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "var a, b, c"); 4198 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "var a, b, c");
3646 JUnitTestCase.assertNotNull(declarationList.keyword); 4199 JUnitTestCase.assertNotNull(declarationList.keyword);
3647 JUnitTestCase.assertNull(declarationList.type); 4200 JUnitTestCase.assertNull(declarationList.type);
3648 EngineTestCase.assertSize(3, declarationList.variables); 4201 EngineTestCase.assertSize(3, declarationList.variables);
3649 } 4202 }
4203
3650 void test_parseVariableDeclarationList_var_single() { 4204 void test_parseVariableDeclarationList_var_single() {
3651 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "var a"); 4205 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata()], "var a");
3652 JUnitTestCase.assertNotNull(declarationList.keyword); 4206 JUnitTestCase.assertNotNull(declarationList.keyword);
3653 JUnitTestCase.assertNull(declarationList.type); 4207 JUnitTestCase.assertNull(declarationList.type);
3654 EngineTestCase.assertSize(1, declarationList.variables); 4208 EngineTestCase.assertSize(1, declarationList.variables);
3655 } 4209 }
4210
3656 void test_parseVariableDeclarationList2_type() { 4211 void test_parseVariableDeclarationList2_type() {
3657 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null); 4212 TypeName type = new TypeName.full(new SimpleIdentifier.full(null), null);
3658 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata(), null, type], "a"); 4213 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata(), null, type], "a");
3659 JUnitTestCase.assertNull(declarationList.keyword); 4214 JUnitTestCase.assertNull(declarationList.keyword);
3660 JUnitTestCase.assertEquals(type, declarationList.type); 4215 JUnitTestCase.assertEquals(type, declarationList.type);
3661 EngineTestCase.assertSize(1, declarationList.variables); 4216 EngineTestCase.assertSize(1, declarationList.variables);
3662 } 4217 }
4218
3663 void test_parseVariableDeclarationList2_var() { 4219 void test_parseVariableDeclarationList2_var() {
3664 Token keyword = TokenFactory.token(Keyword.VAR); 4220 Token keyword = TokenFactory.token(Keyword.VAR);
3665 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata(), keyword, null], "a, b, c "); 4221 VariableDeclarationList declarationList = ParserTestCase.parse("parseVariabl eDeclarationList", <Object> [emptyCommentAndMetadata(), keyword, null], "a, b, c ");
3666 JUnitTestCase.assertEquals(keyword, declarationList.keyword); 4222 JUnitTestCase.assertEquals(keyword, declarationList.keyword);
3667 JUnitTestCase.assertNull(declarationList.type); 4223 JUnitTestCase.assertNull(declarationList.type);
3668 EngineTestCase.assertSize(3, declarationList.variables); 4224 EngineTestCase.assertSize(3, declarationList.variables);
3669 } 4225 }
4226
3670 void test_parseVariableDeclarationStatement_multiple() { 4227 void test_parseVariableDeclarationStatement_multiple() {
3671 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatement", <Object> [emptyCommentAndMetadata()], "var x, y, z;"); 4228 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatement", <Object> [emptyCommentAndMetadata()], "var x, y, z;");
3672 JUnitTestCase.assertNotNull(statement.semicolon); 4229 JUnitTestCase.assertNotNull(statement.semicolon);
3673 VariableDeclarationList variableList = statement.variables; 4230 VariableDeclarationList variableList = statement.variables;
3674 JUnitTestCase.assertNotNull(variableList); 4231 JUnitTestCase.assertNotNull(variableList);
3675 EngineTestCase.assertSize(3, variableList.variables); 4232 EngineTestCase.assertSize(3, variableList.variables);
3676 } 4233 }
4234
3677 void test_parseVariableDeclarationStatement_single() { 4235 void test_parseVariableDeclarationStatement_single() {
3678 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatement", <Object> [emptyCommentAndMetadata()], "var x;"); 4236 VariableDeclarationStatement statement = ParserTestCase.parse("parseVariable DeclarationStatement", <Object> [emptyCommentAndMetadata()], "var x;");
3679 JUnitTestCase.assertNotNull(statement.semicolon); 4237 JUnitTestCase.assertNotNull(statement.semicolon);
3680 VariableDeclarationList variableList = statement.variables; 4238 VariableDeclarationList variableList = statement.variables;
3681 JUnitTestCase.assertNotNull(variableList); 4239 JUnitTestCase.assertNotNull(variableList);
3682 EngineTestCase.assertSize(1, variableList.variables); 4240 EngineTestCase.assertSize(1, variableList.variables);
3683 } 4241 }
4242
3684 void test_parseWhileStatement() { 4243 void test_parseWhileStatement() {
3685 WhileStatement statement = ParserTestCase.parse5("parseWhileStatement", "whi le (x) {}", []); 4244 WhileStatement statement = ParserTestCase.parse5("parseWhileStatement", "whi le (x) {}", []);
3686 JUnitTestCase.assertNotNull(statement.keyword); 4245 JUnitTestCase.assertNotNull(statement.keyword);
3687 JUnitTestCase.assertNotNull(statement.leftParenthesis); 4246 JUnitTestCase.assertNotNull(statement.leftParenthesis);
3688 JUnitTestCase.assertNotNull(statement.condition); 4247 JUnitTestCase.assertNotNull(statement.condition);
3689 JUnitTestCase.assertNotNull(statement.rightParenthesis); 4248 JUnitTestCase.assertNotNull(statement.rightParenthesis);
3690 JUnitTestCase.assertNotNull(statement.body); 4249 JUnitTestCase.assertNotNull(statement.body);
3691 } 4250 }
4251
3692 void test_parseWithClause_multiple() { 4252 void test_parseWithClause_multiple() {
3693 WithClause clause = ParserTestCase.parse5("parseWithClause", "with A, B, C", []); 4253 WithClause clause = ParserTestCase.parse5("parseWithClause", "with A, B, C", []);
3694 JUnitTestCase.assertNotNull(clause.withKeyword); 4254 JUnitTestCase.assertNotNull(clause.withKeyword);
3695 EngineTestCase.assertSize(3, clause.mixinTypes); 4255 EngineTestCase.assertSize(3, clause.mixinTypes);
3696 } 4256 }
4257
3697 void test_parseWithClause_single() { 4258 void test_parseWithClause_single() {
3698 WithClause clause = ParserTestCase.parse5("parseWithClause", "with M", []); 4259 WithClause clause = ParserTestCase.parse5("parseWithClause", "with M", []);
3699 JUnitTestCase.assertNotNull(clause.withKeyword); 4260 JUnitTestCase.assertNotNull(clause.withKeyword);
3700 EngineTestCase.assertSize(1, clause.mixinTypes); 4261 EngineTestCase.assertSize(1, clause.mixinTypes);
3701 } 4262 }
4263
3702 void test_skipPrefixedIdentifier_invalid() { 4264 void test_skipPrefixedIdentifier_invalid() {
3703 Token following = skip("skipPrefixedIdentifier", "+"); 4265 Token following = skip("skipPrefixedIdentifier", "+");
3704 JUnitTestCase.assertNull(following); 4266 JUnitTestCase.assertNull(following);
3705 } 4267 }
4268
3706 void test_skipPrefixedIdentifier_notPrefixed() { 4269 void test_skipPrefixedIdentifier_notPrefixed() {
3707 Token following = skip("skipPrefixedIdentifier", "a +"); 4270 Token following = skip("skipPrefixedIdentifier", "a +");
3708 JUnitTestCase.assertNotNull(following); 4271 JUnitTestCase.assertNotNull(following);
3709 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4272 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3710 } 4273 }
4274
3711 void test_skipPrefixedIdentifier_prefixed() { 4275 void test_skipPrefixedIdentifier_prefixed() {
3712 Token following = skip("skipPrefixedIdentifier", "a.b +"); 4276 Token following = skip("skipPrefixedIdentifier", "a.b +");
3713 JUnitTestCase.assertNotNull(following); 4277 JUnitTestCase.assertNotNull(following);
3714 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4278 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3715 } 4279 }
4280
3716 void test_skipReturnType_invalid() { 4281 void test_skipReturnType_invalid() {
3717 Token following = skip("skipReturnType", "+"); 4282 Token following = skip("skipReturnType", "+");
3718 JUnitTestCase.assertNull(following); 4283 JUnitTestCase.assertNull(following);
3719 } 4284 }
4285
3720 void test_skipReturnType_type() { 4286 void test_skipReturnType_type() {
3721 Token following = skip("skipReturnType", "C +"); 4287 Token following = skip("skipReturnType", "C +");
3722 JUnitTestCase.assertNotNull(following); 4288 JUnitTestCase.assertNotNull(following);
3723 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4289 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3724 } 4290 }
4291
3725 void test_skipReturnType_void() { 4292 void test_skipReturnType_void() {
3726 Token following = skip("skipReturnType", "void +"); 4293 Token following = skip("skipReturnType", "void +");
3727 JUnitTestCase.assertNotNull(following); 4294 JUnitTestCase.assertNotNull(following);
3728 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4295 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3729 } 4296 }
4297
3730 void test_skipSimpleIdentifier_identifier() { 4298 void test_skipSimpleIdentifier_identifier() {
3731 Token following = skip("skipSimpleIdentifier", "i +"); 4299 Token following = skip("skipSimpleIdentifier", "i +");
3732 JUnitTestCase.assertNotNull(following); 4300 JUnitTestCase.assertNotNull(following);
3733 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4301 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3734 } 4302 }
4303
3735 void test_skipSimpleIdentifier_invalid() { 4304 void test_skipSimpleIdentifier_invalid() {
3736 Token following = skip("skipSimpleIdentifier", "9 +"); 4305 Token following = skip("skipSimpleIdentifier", "9 +");
3737 JUnitTestCase.assertNull(following); 4306 JUnitTestCase.assertNull(following);
3738 } 4307 }
4308
3739 void test_skipSimpleIdentifier_pseudoKeyword() { 4309 void test_skipSimpleIdentifier_pseudoKeyword() {
3740 Token following = skip("skipSimpleIdentifier", "as +"); 4310 Token following = skip("skipSimpleIdentifier", "as +");
3741 JUnitTestCase.assertNotNull(following); 4311 JUnitTestCase.assertNotNull(following);
3742 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4312 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3743 } 4313 }
4314
3744 void test_skipStringLiteral_adjacent() { 4315 void test_skipStringLiteral_adjacent() {
3745 Token following = skip("skipStringLiteral", "'a' 'b' +"); 4316 Token following = skip("skipStringLiteral", "'a' 'b' +");
3746 JUnitTestCase.assertNotNull(following); 4317 JUnitTestCase.assertNotNull(following);
3747 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4318 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3748 } 4319 }
4320
3749 void test_skipStringLiteral_interpolated() { 4321 void test_skipStringLiteral_interpolated() {
3750 Token following = skip("skipStringLiteral", "'a\${b}c' +"); 4322 Token following = skip("skipStringLiteral", "'a\${b}c' +");
3751 JUnitTestCase.assertNotNull(following); 4323 JUnitTestCase.assertNotNull(following);
3752 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4324 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3753 } 4325 }
4326
3754 void test_skipStringLiteral_invalid() { 4327 void test_skipStringLiteral_invalid() {
3755 Token following = skip("skipStringLiteral", "a"); 4328 Token following = skip("skipStringLiteral", "a");
3756 JUnitTestCase.assertNull(following); 4329 JUnitTestCase.assertNull(following);
3757 } 4330 }
4331
3758 void test_skipStringLiteral_single() { 4332 void test_skipStringLiteral_single() {
3759 Token following = skip("skipStringLiteral", "'a' +"); 4333 Token following = skip("skipStringLiteral", "'a' +");
3760 JUnitTestCase.assertNotNull(following); 4334 JUnitTestCase.assertNotNull(following);
3761 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4335 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3762 } 4336 }
4337
3763 void test_skipTypeArgumentList_invalid() { 4338 void test_skipTypeArgumentList_invalid() {
3764 Token following = skip("skipTypeArgumentList", "+"); 4339 Token following = skip("skipTypeArgumentList", "+");
3765 JUnitTestCase.assertNull(following); 4340 JUnitTestCase.assertNull(following);
3766 } 4341 }
4342
3767 void test_skipTypeArgumentList_multiple() { 4343 void test_skipTypeArgumentList_multiple() {
3768 Token following = skip("skipTypeArgumentList", "<E, F, G> +"); 4344 Token following = skip("skipTypeArgumentList", "<E, F, G> +");
3769 JUnitTestCase.assertNotNull(following); 4345 JUnitTestCase.assertNotNull(following);
3770 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4346 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3771 } 4347 }
4348
3772 void test_skipTypeArgumentList_single() { 4349 void test_skipTypeArgumentList_single() {
3773 Token following = skip("skipTypeArgumentList", "<E> +"); 4350 Token following = skip("skipTypeArgumentList", "<E> +");
3774 JUnitTestCase.assertNotNull(following); 4351 JUnitTestCase.assertNotNull(following);
3775 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4352 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3776 } 4353 }
4354
3777 void test_skipTypeName_invalid() { 4355 void test_skipTypeName_invalid() {
3778 Token following = skip("skipTypeName", "+"); 4356 Token following = skip("skipTypeName", "+");
3779 JUnitTestCase.assertNull(following); 4357 JUnitTestCase.assertNull(following);
3780 } 4358 }
4359
3781 void test_skipTypeName_parameterized() { 4360 void test_skipTypeName_parameterized() {
3782 Token following = skip("skipTypeName", "C<E<F<G>>> +"); 4361 Token following = skip("skipTypeName", "C<E<F<G>>> +");
3783 JUnitTestCase.assertNotNull(following); 4362 JUnitTestCase.assertNotNull(following);
3784 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4363 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3785 } 4364 }
4365
3786 void test_skipTypeName_simple() { 4366 void test_skipTypeName_simple() {
3787 Token following = skip("skipTypeName", "C +"); 4367 Token following = skip("skipTypeName", "C +");
3788 JUnitTestCase.assertNotNull(following); 4368 JUnitTestCase.assertNotNull(following);
3789 JUnitTestCase.assertEquals(TokenType.PLUS, following.type); 4369 JUnitTestCase.assertEquals(TokenType.PLUS, following.type);
3790 } 4370 }
3791 4371
3792 /** 4372 /**
3793 * Invoke the method [Parser#computeStringValue] with the given argument. 4373 * Invoke the method [Parser#computeStringValue] with the given argument.
3794 * 4374 *
3795 * @param lexeme the argument to the method 4375 * @param lexeme the argument to the method
3796 * @param first `true` if this is the first token in a string literal 4376 * @param first `true` if this is the first token in a string literal
3797 * @param last `true` if this is the last token in a string literal 4377 * @param last `true` if this is the last token in a string literal
3798 * @return the result of invoking the method 4378 * @return the result of invoking the method
3799 * @throws Exception if the method could not be invoked or throws an exception 4379 * @throws Exception if the method could not be invoked or throws an exception
3800 */ 4380 */
3801 String computeStringValue(String lexeme, bool first, bool last) { 4381 String computeStringValue(String lexeme, bool first, bool last) {
3802 AnalysisErrorListener listener = new AnalysisErrorListener_24(); 4382 AnalysisErrorListener listener = new AnalysisErrorListener_25();
3803 Parser parser = new Parser(null, listener); 4383 Parser parser = new Parser(null, listener);
3804 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme , first, last], null) as String; 4384 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme , first, last], null) as String;
3805 } 4385 }
3806 4386
3807 /** 4387 /**
3808 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token 4388 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to the token
3809 * stream produced by scanning the given source. 4389 * stream produced by scanning the given source.
3810 * 4390 *
3811 * @param source the source to be scanned to produce the token stream being te sted 4391 * @param source the source to be scanned to produce the token stream being te sted
3812 * @return the result of invoking the method 4392 * @return the result of invoking the method
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3895 * @throws Exception if the method could not be invoked or throws an exception 4475 * @throws Exception if the method could not be invoked or throws an exception
3896 * @throws AssertionFailedError if the result is `null` 4476 * @throws AssertionFailedError if the result is `null`
3897 */ 4477 */
3898 Token skip(String methodName, String source) { 4478 Token skip(String methodName, String source) {
3899 GatheringErrorListener listener = new GatheringErrorListener(); 4479 GatheringErrorListener listener = new GatheringErrorListener();
3900 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence( source)), listener); 4480 Scanner scanner = new Scanner(null, new CharSequenceReader(new CharSequence( source)), listener);
3901 Token tokenStream = scanner.tokenize(); 4481 Token tokenStream = scanner.tokenize();
3902 Parser parser = new Parser(null, listener); 4482 Parser parser = new Parser(null, listener);
3903 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to kenStream) as Token; 4483 return invokeParserMethodImpl(parser, methodName, <Object> [tokenStream], to kenStream) as Token;
3904 } 4484 }
4485
3905 static dartSuite() { 4486 static dartSuite() {
3906 _ut.group('SimpleParserTest', () { 4487 _ut.group('SimpleParserTest', () {
3907 _ut.test('test_Parser', () { 4488 _ut.test('test_Parser', () {
3908 final __test = new SimpleParserTest(); 4489 final __test = new SimpleParserTest();
3909 runJUnitTest(__test, __test.test_Parser); 4490 runJUnitTest(__test, __test.test_Parser);
3910 }); 4491 });
3911 _ut.test('test_computeStringValue_emptyInterpolationPrefix', () { 4492 _ut.test('test_computeStringValue_emptyInterpolationPrefix', () {
3912 final __test = new SimpleParserTest(); 4493 final __test = new SimpleParserTest();
3913 runJUnitTest(__test, __test.test_computeStringValue_emptyInterpolationPr efix); 4494 runJUnitTest(__test, __test.test_computeStringValue_emptyInterpolationPr efix);
3914 }); 4495 });
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4033 runJUnitTest(__test, __test.test_isFunctionExpression_false_notParameter s); 4614 runJUnitTest(__test, __test.test_isFunctionExpression_false_notParameter s);
4034 }); 4615 });
4035 _ut.test('test_isFunctionExpression_noName_block', () { 4616 _ut.test('test_isFunctionExpression_noName_block', () {
4036 final __test = new SimpleParserTest(); 4617 final __test = new SimpleParserTest();
4037 runJUnitTest(__test, __test.test_isFunctionExpression_noName_block); 4618 runJUnitTest(__test, __test.test_isFunctionExpression_noName_block);
4038 }); 4619 });
4039 _ut.test('test_isFunctionExpression_noName_expression', () { 4620 _ut.test('test_isFunctionExpression_noName_expression', () {
4040 final __test = new SimpleParserTest(); 4621 final __test = new SimpleParserTest();
4041 runJUnitTest(__test, __test.test_isFunctionExpression_noName_expression) ; 4622 runJUnitTest(__test, __test.test_isFunctionExpression_noName_expression) ;
4042 }); 4623 });
4624 _ut.test('test_isFunctionExpression_parameter_final', () {
4625 final __test = new SimpleParserTest();
4626 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_final);
4627 });
4628 _ut.test('test_isFunctionExpression_parameter_final_typed', () {
4629 final __test = new SimpleParserTest();
4630 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_final_ty ped);
4631 });
4043 _ut.test('test_isFunctionExpression_parameter_multiple', () { 4632 _ut.test('test_isFunctionExpression_parameter_multiple', () {
4044 final __test = new SimpleParserTest(); 4633 final __test = new SimpleParserTest();
4045 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_multiple ); 4634 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_multiple );
4046 }); 4635 });
4047 _ut.test('test_isFunctionExpression_parameter_named', () { 4636 _ut.test('test_isFunctionExpression_parameter_named', () {
4048 final __test = new SimpleParserTest(); 4637 final __test = new SimpleParserTest();
4049 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_named); 4638 runJUnitTest(__test, __test.test_isFunctionExpression_parameter_named);
4050 }); 4639 });
4051 _ut.test('test_isFunctionExpression_parameter_optional', () { 4640 _ut.test('test_isFunctionExpression_parameter_optional', () {
4052 final __test = new SimpleParserTest(); 4641 final __test = new SimpleParserTest();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
4401 runJUnitTest(__test, __test.test_parseClassMember_field_instance_prefixe dType); 4990 runJUnitTest(__test, __test.test_parseClassMember_field_instance_prefixe dType);
4402 }); 4991 });
4403 _ut.test('test_parseClassMember_field_namedGet', () { 4992 _ut.test('test_parseClassMember_field_namedGet', () {
4404 final __test = new SimpleParserTest(); 4993 final __test = new SimpleParserTest();
4405 runJUnitTest(__test, __test.test_parseClassMember_field_namedGet); 4994 runJUnitTest(__test, __test.test_parseClassMember_field_namedGet);
4406 }); 4995 });
4407 _ut.test('test_parseClassMember_field_namedOperator', () { 4996 _ut.test('test_parseClassMember_field_namedOperator', () {
4408 final __test = new SimpleParserTest(); 4997 final __test = new SimpleParserTest();
4409 runJUnitTest(__test, __test.test_parseClassMember_field_namedOperator); 4998 runJUnitTest(__test, __test.test_parseClassMember_field_namedOperator);
4410 }); 4999 });
5000 _ut.test('test_parseClassMember_field_namedOperator_withAssignment', () {
5001 final __test = new SimpleParserTest();
5002 runJUnitTest(__test, __test.test_parseClassMember_field_namedOperator_wi thAssignment);
5003 });
4411 _ut.test('test_parseClassMember_field_namedSet', () { 5004 _ut.test('test_parseClassMember_field_namedSet', () {
4412 final __test = new SimpleParserTest(); 5005 final __test = new SimpleParserTest();
4413 runJUnitTest(__test, __test.test_parseClassMember_field_namedSet); 5006 runJUnitTest(__test, __test.test_parseClassMember_field_namedSet);
4414 }); 5007 });
4415 _ut.test('test_parseClassMember_getter_void', () { 5008 _ut.test('test_parseClassMember_getter_void', () {
4416 final __test = new SimpleParserTest(); 5009 final __test = new SimpleParserTest();
4417 runJUnitTest(__test, __test.test_parseClassMember_getter_void); 5010 runJUnitTest(__test, __test.test_parseClassMember_getter_void);
4418 }); 5011 });
4419 _ut.test('test_parseClassMember_method_external', () { 5012 _ut.test('test_parseClassMember_method_external', () {
4420 final __test = new SimpleParserTest(); 5013 final __test = new SimpleParserTest();
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4697 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableGet) ; 5290 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableGet) ;
4698 }); 5291 });
4699 _ut.test('test_parseCompilationUnitMember_variableSet', () { 5292 _ut.test('test_parseCompilationUnitMember_variableSet', () {
4700 final __test = new SimpleParserTest(); 5293 final __test = new SimpleParserTest();
4701 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableSet) ; 5294 runJUnitTest(__test, __test.test_parseCompilationUnitMember_variableSet) ;
4702 }); 5295 });
4703 _ut.test('test_parseCompilationUnit_abstractAsPrefix_parameterized', () { 5296 _ut.test('test_parseCompilationUnit_abstractAsPrefix_parameterized', () {
4704 final __test = new SimpleParserTest(); 5297 final __test = new SimpleParserTest();
4705 runJUnitTest(__test, __test.test_parseCompilationUnit_abstractAsPrefix_p arameterized); 5298 runJUnitTest(__test, __test.test_parseCompilationUnit_abstractAsPrefix_p arameterized);
4706 }); 5299 });
5300 _ut.test('test_parseCompilationUnit_builtIn_asFunctionName', () {
5301 final __test = new SimpleParserTest();
5302 runJUnitTest(__test, __test.test_parseCompilationUnit_builtIn_asFunction Name);
5303 });
4707 _ut.test('test_parseCompilationUnit_directives_multiple', () { 5304 _ut.test('test_parseCompilationUnit_directives_multiple', () {
4708 final __test = new SimpleParserTest(); 5305 final __test = new SimpleParserTest();
4709 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_multipl e); 5306 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_multipl e);
4710 }); 5307 });
4711 _ut.test('test_parseCompilationUnit_directives_single', () { 5308 _ut.test('test_parseCompilationUnit_directives_single', () {
4712 final __test = new SimpleParserTest(); 5309 final __test = new SimpleParserTest();
4713 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_single) ; 5310 runJUnitTest(__test, __test.test_parseCompilationUnit_directives_single) ;
4714 }); 5311 });
4715 _ut.test('test_parseCompilationUnit_empty', () { 5312 _ut.test('test_parseCompilationUnit_empty', () {
4716 final __test = new SimpleParserTest(); 5313 final __test = new SimpleParserTest();
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
6028 final __test = new SimpleParserTest(); 6625 final __test = new SimpleParserTest();
6029 runJUnitTest(__test, __test.test_skipTypeName_parameterized); 6626 runJUnitTest(__test, __test.test_skipTypeName_parameterized);
6030 }); 6627 });
6031 _ut.test('test_skipTypeName_simple', () { 6628 _ut.test('test_skipTypeName_simple', () {
6032 final __test = new SimpleParserTest(); 6629 final __test = new SimpleParserTest();
6033 runJUnitTest(__test, __test.test_skipTypeName_simple); 6630 runJUnitTest(__test, __test.test_skipTypeName_simple);
6034 }); 6631 });
6035 }); 6632 });
6036 } 6633 }
6037 } 6634 }
6038 class AnalysisErrorListener_24 implements AnalysisErrorListener { 6635
6636 class AnalysisErrorListener_25 implements AnalysisErrorListener {
6039 void onError(AnalysisError event) { 6637 void onError(AnalysisError event) {
6040 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})"); 6638 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event. offset}, ${event.length})");
6041 } 6639 }
6042 } 6640 }
6641
6043 /** 6642 /**
6044 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex 6643 * The class `ComplexParserTest` defines parser tests that test the parsing of m ore complex
6045 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure 6644 * code fragments or the interactions between multiple parsing methods. For exam ple, tests to ensure
6046 * that the precedence of operations is being handled correctly should be define d in this class. 6645 * that the precedence of operations is being handled correctly should be define d in this class.
6047 * 6646 *
6048 * Simpler tests should be defined in the class [SimpleParserTest]. 6647 * Simpler tests should be defined in the class [SimpleParserTest].
6049 */ 6648 */
6050 class ComplexParserTest extends ParserTestCase { 6649 class ComplexParserTest extends ParserTestCase {
6051 void test_additiveExpression_normal() { 6650 void test_additiveExpression_normal() {
6052 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", [] ); 6651 BinaryExpression expression = ParserTestCase.parseExpression("x + y - z", [] );
6053 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6652 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6054 } 6653 }
6654
6055 void test_additiveExpression_noSpaces() { 6655 void test_additiveExpression_noSpaces() {
6056 BinaryExpression expression = ParserTestCase.parseExpression("i+1", []); 6656 BinaryExpression expression = ParserTestCase.parseExpression("i+1", []);
6057 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 6657 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
6058 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightOperand); 6658 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightOperand);
6059 } 6659 }
6660
6060 void test_additiveExpression_precedence_multiplicative_left() { 6661 void test_additiveExpression_precedence_multiplicative_left() {
6061 BinaryExpression expression = ParserTestCase.parseExpression("x * y + z", [] ); 6662 BinaryExpression expression = ParserTestCase.parseExpression("x * y + z", [] );
6062 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6663 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6063 } 6664 }
6665
6064 void test_additiveExpression_precedence_multiplicative_left_withSuper() { 6666 void test_additiveExpression_precedence_multiplicative_left_withSuper() {
6065 BinaryExpression expression = ParserTestCase.parseExpression("super * y - z" , []); 6667 BinaryExpression expression = ParserTestCase.parseExpression("super * y - z" , []);
6066 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6668 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6067 } 6669 }
6670
6068 void test_additiveExpression_precedence_multiplicative_right() { 6671 void test_additiveExpression_precedence_multiplicative_right() {
6069 BinaryExpression expression = ParserTestCase.parseExpression("x + y * z", [] ); 6672 BinaryExpression expression = ParserTestCase.parseExpression("x + y * z", [] );
6070 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6673 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6071 } 6674 }
6675
6072 void test_additiveExpression_super() { 6676 void test_additiveExpression_super() {
6073 BinaryExpression expression = ParserTestCase.parseExpression("super + y - z" , []); 6677 BinaryExpression expression = ParserTestCase.parseExpression("super + y - z" , []);
6074 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6678 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6075 } 6679 }
6680
6076 void test_assignableExpression_arguments_normal_chain() { 6681 void test_assignableExpression_arguments_normal_chain() {
6077 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []); 6682 PropertyAccess propertyAccess1 = ParserTestCase.parseExpression("a(b)(c).d(e ).f", []);
6078 JUnitTestCase.assertEquals("f", propertyAccess1.propertyName.name); 6683 JUnitTestCase.assertEquals("f", propertyAccess1.propertyName.name);
6079 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf(MethodInvocat ion, propertyAccess1.target); 6684 MethodInvocation invocation2 = EngineTestCase.assertInstanceOf(MethodInvocat ion, propertyAccess1.target);
6080 JUnitTestCase.assertEquals("d", invocation2.methodName.name); 6685 JUnitTestCase.assertEquals("d", invocation2.methodName.name);
6081 ArgumentList argumentList2 = invocation2.argumentList; 6686 ArgumentList argumentList2 = invocation2.argumentList;
6082 JUnitTestCase.assertNotNull(argumentList2); 6687 JUnitTestCase.assertNotNull(argumentList2);
6083 EngineTestCase.assertSize(1, argumentList2.arguments); 6688 EngineTestCase.assertSize(1, argumentList2.arguments);
6084 FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf(F unctionExpressionInvocation, invocation2.target); 6689 FunctionExpressionInvocation invocation3 = EngineTestCase.assertInstanceOf(F unctionExpressionInvocation, invocation2.target);
6085 ArgumentList argumentList3 = invocation3.argumentList; 6690 ArgumentList argumentList3 = invocation3.argumentList;
6086 JUnitTestCase.assertNotNull(argumentList3); 6691 JUnitTestCase.assertNotNull(argumentList3);
6087 EngineTestCase.assertSize(1, argumentList3.arguments); 6692 EngineTestCase.assertSize(1, argumentList3.arguments);
6088 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf(MethodInvocat ion, invocation3.function); 6693 MethodInvocation invocation4 = EngineTestCase.assertInstanceOf(MethodInvocat ion, invocation3.function);
6089 JUnitTestCase.assertEquals("a", invocation4.methodName.name); 6694 JUnitTestCase.assertEquals("a", invocation4.methodName.name);
6090 ArgumentList argumentList4 = invocation4.argumentList; 6695 ArgumentList argumentList4 = invocation4.argumentList;
6091 JUnitTestCase.assertNotNull(argumentList4); 6696 JUnitTestCase.assertNotNull(argumentList4);
6092 EngineTestCase.assertSize(1, argumentList4.arguments); 6697 EngineTestCase.assertSize(1, argumentList4.arguments);
6093 } 6698 }
6699
6094 void test_assignmentExpression_compound() { 6700 void test_assignmentExpression_compound() {
6095 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []); 6701 AssignmentExpression expression = ParserTestCase.parseExpression("x = y = 0" , []);
6096 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 6702 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
6097 EngineTestCase.assertInstanceOf(AssignmentExpression, expression.rightHandSi de); 6703 EngineTestCase.assertInstanceOf(AssignmentExpression, expression.rightHandSi de);
6098 } 6704 }
6705
6099 void test_assignmentExpression_indexExpression() { 6706 void test_assignmentExpression_indexExpression() {
6100 AssignmentExpression expression = ParserTestCase.parseExpression("x[1] = 0", []); 6707 AssignmentExpression expression = ParserTestCase.parseExpression("x[1] = 0", []);
6101 EngineTestCase.assertInstanceOf(IndexExpression, expression.leftHandSide); 6708 EngineTestCase.assertInstanceOf(IndexExpression, expression.leftHandSide);
6102 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide); 6709 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide);
6103 } 6710 }
6711
6104 void test_assignmentExpression_prefixedIdentifier() { 6712 void test_assignmentExpression_prefixedIdentifier() {
6105 AssignmentExpression expression = ParserTestCase.parseExpression("x.y = 0", []); 6713 AssignmentExpression expression = ParserTestCase.parseExpression("x.y = 0", []);
6106 EngineTestCase.assertInstanceOf(PrefixedIdentifier, expression.leftHandSide) ; 6714 EngineTestCase.assertInstanceOf(PrefixedIdentifier, expression.leftHandSide) ;
6107 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide); 6715 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide);
6108 } 6716 }
6717
6109 void test_assignmentExpression_propertyAccess() { 6718 void test_assignmentExpression_propertyAccess() {
6110 AssignmentExpression expression = ParserTestCase.parseExpression("super.y = 0", []); 6719 AssignmentExpression expression = ParserTestCase.parseExpression("super.y = 0", []);
6111 EngineTestCase.assertInstanceOf(PropertyAccess, expression.leftHandSide); 6720 EngineTestCase.assertInstanceOf(PropertyAccess, expression.leftHandSide);
6112 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide); 6721 EngineTestCase.assertInstanceOf(IntegerLiteral, expression.rightHandSide);
6113 } 6722 }
6723
6114 void test_bitwiseAndExpression_normal() { 6724 void test_bitwiseAndExpression_normal() {
6115 BinaryExpression expression = ParserTestCase.parseExpression("x & y & z", [] ); 6725 BinaryExpression expression = ParserTestCase.parseExpression("x & y & z", [] );
6116 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6726 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6117 } 6727 }
6728
6118 void test_bitwiseAndExpression_precedence_equality_left() { 6729 void test_bitwiseAndExpression_precedence_equality_left() {
6119 BinaryExpression expression = ParserTestCase.parseExpression("x == y && z", []); 6730 BinaryExpression expression = ParserTestCase.parseExpression("x == y && z", []);
6120 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6731 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6121 } 6732 }
6733
6122 void test_bitwiseAndExpression_precedence_equality_right() { 6734 void test_bitwiseAndExpression_precedence_equality_right() {
6123 BinaryExpression expression = ParserTestCase.parseExpression("x && y == z", []); 6735 BinaryExpression expression = ParserTestCase.parseExpression("x && y == z", []);
6124 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6736 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6125 } 6737 }
6738
6126 void test_bitwiseAndExpression_super() { 6739 void test_bitwiseAndExpression_super() {
6127 BinaryExpression expression = ParserTestCase.parseExpression("super & y & z" , []); 6740 BinaryExpression expression = ParserTestCase.parseExpression("super & y & z" , []);
6128 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6741 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6129 } 6742 }
6743
6130 void test_bitwiseOrExpression_normal() { 6744 void test_bitwiseOrExpression_normal() {
6131 BinaryExpression expression = ParserTestCase.parseExpression("x | y | z", [] ); 6745 BinaryExpression expression = ParserTestCase.parseExpression("x | y | z", [] );
6132 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6746 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6133 } 6747 }
6748
6134 void test_bitwiseOrExpression_precedence_xor_left() { 6749 void test_bitwiseOrExpression_precedence_xor_left() {
6135 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y | z", [] ); 6750 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y | z", [] );
6136 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6751 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6137 } 6752 }
6753
6138 void test_bitwiseOrExpression_precedence_xor_right() { 6754 void test_bitwiseOrExpression_precedence_xor_right() {
6139 BinaryExpression expression = ParserTestCase.parseExpression("x | y ^ z", [] ); 6755 BinaryExpression expression = ParserTestCase.parseExpression("x | y ^ z", [] );
6140 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6756 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6141 } 6757 }
6758
6142 void test_bitwiseOrExpression_super() { 6759 void test_bitwiseOrExpression_super() {
6143 BinaryExpression expression = ParserTestCase.parseExpression("super | y | z" , []); 6760 BinaryExpression expression = ParserTestCase.parseExpression("super | y | z" , []);
6144 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6761 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6145 } 6762 }
6763
6146 void test_bitwiseXorExpression_normal() { 6764 void test_bitwiseXorExpression_normal() {
6147 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y ^ z", [] ); 6765 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y ^ z", [] );
6148 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6766 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6149 } 6767 }
6768
6150 void test_bitwiseXorExpression_precedence_and_left() { 6769 void test_bitwiseXorExpression_precedence_and_left() {
6151 BinaryExpression expression = ParserTestCase.parseExpression("x & y ^ z", [] ); 6770 BinaryExpression expression = ParserTestCase.parseExpression("x & y ^ z", [] );
6152 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6771 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6153 } 6772 }
6773
6154 void test_bitwiseXorExpression_precedence_and_right() { 6774 void test_bitwiseXorExpression_precedence_and_right() {
6155 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y & z", [] ); 6775 BinaryExpression expression = ParserTestCase.parseExpression("x ^ y & z", [] );
6156 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6776 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6157 } 6777 }
6778
6158 void test_bitwiseXorExpression_super() { 6779 void test_bitwiseXorExpression_super() {
6159 BinaryExpression expression = ParserTestCase.parseExpression("super ^ y ^ z" , []); 6780 BinaryExpression expression = ParserTestCase.parseExpression("super ^ y ^ z" , []);
6160 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6781 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6161 } 6782 }
6783
6162 void test_cascade_withAssignment() { 6784 void test_cascade_withAssignment() {
6163 CascadeExpression cascade = ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;", []); 6785 CascadeExpression cascade = ParserTestCase.parseExpression("new Map()..[3] = 4 ..[0] = 11;", []);
6164 Expression target = cascade.target; 6786 Expression target = cascade.target;
6165 for (Expression section in cascade.cascadeSections) { 6787 for (Expression section in cascade.cascadeSections) {
6166 EngineTestCase.assertInstanceOf(AssignmentExpression, section); 6788 EngineTestCase.assertInstanceOf(AssignmentExpression, section);
6167 Expression lhs = ((section as AssignmentExpression)).leftHandSide; 6789 Expression lhs = (section as AssignmentExpression).leftHandSide;
6168 EngineTestCase.assertInstanceOf(IndexExpression, lhs); 6790 EngineTestCase.assertInstanceOf(IndexExpression, lhs);
6169 IndexExpression index = lhs as IndexExpression; 6791 IndexExpression index = lhs as IndexExpression;
6170 JUnitTestCase.assertTrue(index.isCascaded); 6792 JUnitTestCase.assertTrue(index.isCascaded);
6171 JUnitTestCase.assertSame(target, index.realTarget); 6793 JUnitTestCase.assertSame(target, index.realTarget);
6172 } 6794 }
6173 } 6795 }
6796
6174 void test_conditionalExpression_precedence_logicalOrExpression() { 6797 void test_conditionalExpression_precedence_logicalOrExpression() {
6175 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []); 6798 ConditionalExpression expression = ParserTestCase.parseExpression("a | b ? y : z", []);
6176 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition); 6799 EngineTestCase.assertInstanceOf(BinaryExpression, expression.condition);
6177 } 6800 }
6801
6178 void test_constructor_initializer_withParenthesizedExpression() { 6802 void test_constructor_initializer_withParenthesizedExpression() {
6179 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource([ 6803 CompilationUnit unit = ParserTestCase.parseCompilationUnit(EngineTestCase.cr eateSource([
6180 "class C {", 6804 "class C {",
6181 " C() :", 6805 " C() :",
6182 " this.a = (b == null ? c : d) {", 6806 " this.a = (b == null ? c : d) {",
6183 " }", 6807 " }",
6184 "}"]), []); 6808 "}"]), []);
6185 NodeList<CompilationUnitMember> declarations = unit.declarations; 6809 NodeList<CompilationUnitMember> declarations = unit.declarations;
6186 EngineTestCase.assertSize(1, declarations); 6810 EngineTestCase.assertSize(1, declarations);
6187 } 6811 }
6812
6188 void test_equalityExpression_normal() { 6813 void test_equalityExpression_normal() {
6189 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 6814 BinaryExpression expression = ParserTestCase.parseExpression("x == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
6190 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6815 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6191 } 6816 }
6817
6192 void test_equalityExpression_precedence_relational_left() { 6818 void test_equalityExpression_precedence_relational_left() {
6193 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []); 6819 BinaryExpression expression = ParserTestCase.parseExpression("x is y == z", []);
6194 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand); 6820 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand);
6195 } 6821 }
6822
6196 void test_equalityExpression_precedence_relational_right() { 6823 void test_equalityExpression_precedence_relational_right() {
6197 BinaryExpression expression = ParserTestCase.parseExpression("x == y is z", []); 6824 BinaryExpression expression = ParserTestCase.parseExpression("x == y is z", []);
6198 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand); 6825 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand);
6199 } 6826 }
6827
6200 void test_equalityExpression_super() { 6828 void test_equalityExpression_super() {
6201 BinaryExpression expression = ParserTestCase.parseExpression("super == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 6829 BinaryExpression expression = ParserTestCase.parseExpression("super == y != z", [ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
6202 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6830 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6203 } 6831 }
6832
6204 void test_logicalAndExpression() { 6833 void test_logicalAndExpression() {
6205 BinaryExpression expression = ParserTestCase.parseExpression("x && y && z", []); 6834 BinaryExpression expression = ParserTestCase.parseExpression("x && y && z", []);
6206 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6835 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6207 } 6836 }
6837
6208 void test_logicalAndExpression_precedence_bitwiseOr_left() { 6838 void test_logicalAndExpression_precedence_bitwiseOr_left() {
6209 BinaryExpression expression = ParserTestCase.parseExpression("x | y < z", [] ); 6839 BinaryExpression expression = ParserTestCase.parseExpression("x | y < z", [] );
6210 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6840 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6211 } 6841 }
6842
6212 void test_logicalAndExpression_precedence_bitwiseOr_right() { 6843 void test_logicalAndExpression_precedence_bitwiseOr_right() {
6213 BinaryExpression expression = ParserTestCase.parseExpression("x < y | z", [] ); 6844 BinaryExpression expression = ParserTestCase.parseExpression("x < y | z", [] );
6214 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6845 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6215 } 6846 }
6847
6216 void test_logicalOrExpression() { 6848 void test_logicalOrExpression() {
6217 BinaryExpression expression = ParserTestCase.parseExpression("x || y || z", []); 6849 BinaryExpression expression = ParserTestCase.parseExpression("x || y || z", []);
6218 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6850 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6219 } 6851 }
6852
6220 void test_logicalOrExpression_precedence_logicalAnd_left() { 6853 void test_logicalOrExpression_precedence_logicalAnd_left() {
6221 BinaryExpression expression = ParserTestCase.parseExpression("x && y || z", []); 6854 BinaryExpression expression = ParserTestCase.parseExpression("x && y || z", []);
6222 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6855 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6223 } 6856 }
6857
6224 void test_logicalOrExpression_precedence_logicalAnd_right() { 6858 void test_logicalOrExpression_precedence_logicalAnd_right() {
6225 BinaryExpression expression = ParserTestCase.parseExpression("x || y && z", []); 6859 BinaryExpression expression = ParserTestCase.parseExpression("x || y && z", []);
6226 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6860 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6227 } 6861 }
6862
6228 void test_multipleLabels_statement() { 6863 void test_multipleLabels_statement() {
6229 LabeledStatement statement = ParserTestCase.parseStatement("a: b: c: return x;", []); 6864 LabeledStatement statement = ParserTestCase.parseStatement("a: b: c: return x;", []);
6230 EngineTestCase.assertSize(3, statement.labels); 6865 EngineTestCase.assertSize(3, statement.labels);
6231 EngineTestCase.assertInstanceOf(ReturnStatement, statement.statement); 6866 EngineTestCase.assertInstanceOf(ReturnStatement, statement.statement);
6232 } 6867 }
6868
6233 void test_multiplicativeExpression_normal() { 6869 void test_multiplicativeExpression_normal() {
6234 BinaryExpression expression = ParserTestCase.parseExpression("x * y / z", [] ); 6870 BinaryExpression expression = ParserTestCase.parseExpression("x * y / z", [] );
6235 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6871 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6236 } 6872 }
6873
6237 void test_multiplicativeExpression_precedence_unary_left() { 6874 void test_multiplicativeExpression_precedence_unary_left() {
6238 BinaryExpression expression = ParserTestCase.parseExpression("-x * y", []); 6875 BinaryExpression expression = ParserTestCase.parseExpression("-x * y", []);
6239 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand); 6876 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand);
6240 } 6877 }
6878
6241 void test_multiplicativeExpression_precedence_unary_right() { 6879 void test_multiplicativeExpression_precedence_unary_right() {
6242 BinaryExpression expression = ParserTestCase.parseExpression("x * -y", []); 6880 BinaryExpression expression = ParserTestCase.parseExpression("x * -y", []);
6243 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand); 6881 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand);
6244 } 6882 }
6883
6245 void test_multiplicativeExpression_super() { 6884 void test_multiplicativeExpression_super() {
6246 BinaryExpression expression = ParserTestCase.parseExpression("super * y / z" , []); 6885 BinaryExpression expression = ParserTestCase.parseExpression("super * y / z" , []);
6247 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6886 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6248 } 6887 }
6888
6249 void test_relationalExpression_precedence_shift_right() { 6889 void test_relationalExpression_precedence_shift_right() {
6250 IsExpression expression = ParserTestCase.parseExpression("x << y is z", []); 6890 IsExpression expression = ParserTestCase.parseExpression("x << y is z", []);
6251 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression); 6891 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression);
6252 } 6892 }
6893
6253 void test_shiftExpression_normal() { 6894 void test_shiftExpression_normal() {
6254 BinaryExpression expression = ParserTestCase.parseExpression("x >> 4 << 3", []); 6895 BinaryExpression expression = ParserTestCase.parseExpression("x >> 4 << 3", []);
6255 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6896 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6256 } 6897 }
6898
6257 void test_shiftExpression_precedence_additive_left() { 6899 void test_shiftExpression_precedence_additive_left() {
6258 BinaryExpression expression = ParserTestCase.parseExpression("x + y << z", [ ]); 6900 BinaryExpression expression = ParserTestCase.parseExpression("x + y << z", [ ]);
6259 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6901 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6260 } 6902 }
6903
6261 void test_shiftExpression_precedence_additive_right() { 6904 void test_shiftExpression_precedence_additive_right() {
6262 BinaryExpression expression = ParserTestCase.parseExpression("x << y + z", [ ]); 6905 BinaryExpression expression = ParserTestCase.parseExpression("x << y + z", [ ]);
6263 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 6906 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
6264 } 6907 }
6908
6265 void test_shiftExpression_super() { 6909 void test_shiftExpression_super() {
6266 BinaryExpression expression = ParserTestCase.parseExpression("super >> 4 << 3", []); 6910 BinaryExpression expression = ParserTestCase.parseExpression("super >> 4 << 3", []);
6267 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 6911 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
6268 } 6912 }
6913
6269 void test_topLevelVariable_withMetadata() { 6914 void test_topLevelVariable_withMetadata() {
6270 ParserTestCase.parseCompilationUnit("String @A string;", []); 6915 ParserTestCase.parseCompilationUnit("String @A string;", []);
6271 } 6916 }
6917
6272 static dartSuite() { 6918 static dartSuite() {
6273 _ut.group('ComplexParserTest', () { 6919 _ut.group('ComplexParserTest', () {
6274 _ut.test('test_additiveExpression_noSpaces', () { 6920 _ut.test('test_additiveExpression_noSpaces', () {
6275 final __test = new ComplexParserTest(); 6921 final __test = new ComplexParserTest();
6276 runJUnitTest(__test, __test.test_additiveExpression_noSpaces); 6922 runJUnitTest(__test, __test.test_additiveExpression_noSpaces);
6277 }); 6923 });
6278 _ut.test('test_additiveExpression_normal', () { 6924 _ut.test('test_additiveExpression_normal', () {
6279 final __test = new ComplexParserTest(); 6925 final __test = new ComplexParserTest();
6280 runJUnitTest(__test, __test.test_additiveExpression_normal); 6926 runJUnitTest(__test, __test.test_additiveExpression_normal);
6281 }); 6927 });
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 final __test = new ComplexParserTest(); 7101 final __test = new ComplexParserTest();
6456 runJUnitTest(__test, __test.test_shiftExpression_super); 7102 runJUnitTest(__test, __test.test_shiftExpression_super);
6457 }); 7103 });
6458 _ut.test('test_topLevelVariable_withMetadata', () { 7104 _ut.test('test_topLevelVariable_withMetadata', () {
6459 final __test = new ComplexParserTest(); 7105 final __test = new ComplexParserTest();
6460 runJUnitTest(__test, __test.test_topLevelVariable_withMetadata); 7106 runJUnitTest(__test, __test.test_topLevelVariable_withMetadata);
6461 }); 7107 });
6462 }); 7108 });
6463 } 7109 }
6464 } 7110 }
7111
6465 /** 7112 /**
6466 * Instances of the class `ASTValidator` are used to validate the correct constr uction of an 7113 * Instances of the class `ASTValidator` are used to validate the correct constr uction of an
6467 * AST structure. 7114 * AST structure.
6468 */ 7115 */
6469 class ASTValidator extends UnifyingASTVisitor<Object> { 7116 class ASTValidator extends UnifyingASTVisitor<Object> {
6470
6471 /** 7117 /**
6472 * A list containing the errors found while traversing the AST structure. 7118 * A list containing the errors found while traversing the AST structure.
6473 */ 7119 */
6474 List<String> _errors = new List<String>(); 7120 List<String> _errors = new List<String>();
6475 7121
6476 /** 7122 /**
6477 * Assert that no errors were found while traversing any of the AST structures that have been 7123 * Assert that no errors were found while traversing any of the AST structures that have been
6478 * visited. 7124 * visited.
6479 */ 7125 */
6480 void assertValid() { 7126 void assertValid() {
6481 if (!_errors.isEmpty) { 7127 if (!_errors.isEmpty) {
6482 JavaStringBuilder builder = new JavaStringBuilder(); 7128 JavaStringBuilder builder = new JavaStringBuilder();
6483 builder.append("Invalid AST structure:"); 7129 builder.append("Invalid AST structure:");
6484 for (String message in _errors) { 7130 for (String message in _errors) {
6485 builder.append("\r\n "); 7131 builder.append("\r\n ");
6486 builder.append(message); 7132 builder.append(message);
6487 } 7133 }
6488 JUnitTestCase.fail(builder.toString()); 7134 JUnitTestCase.fail(builder.toString());
6489 } 7135 }
6490 } 7136 }
7137
6491 Object visitNode(ASTNode node) { 7138 Object visitNode(ASTNode node) {
6492 validate(node); 7139 validate(node);
6493 return super.visitNode(node); 7140 return super.visitNode(node);
6494 } 7141 }
6495 7142
6496 /** 7143 /**
6497 * Validate that the given AST node is correctly constructed. 7144 * Validate that the given AST node is correctly constructed.
6498 * 7145 *
6499 * @param node the AST node being validated 7146 * @param node the AST node being validated
6500 */ 7147 */
(...skipping 25 matching lines...) Expand all
6526 int parentEnd = parentStart + parent.length; 7173 int parentEnd = parentStart + parent.length;
6527 if (nodeStart < parentStart) { 7174 if (nodeStart < parentStart) {
6528 _errors.add("Invalid source start (${nodeStart}) for ${node.runtimeType. toString()} inside ${parent.runtimeType.toString()} (${parentStart})"); 7175 _errors.add("Invalid source start (${nodeStart}) for ${node.runtimeType. toString()} inside ${parent.runtimeType.toString()} (${parentStart})");
6529 } 7176 }
6530 if (nodeEnd > parentEnd) { 7177 if (nodeEnd > parentEnd) {
6531 _errors.add("Invalid source end (${nodeEnd}) for ${node.runtimeType.toSt ring()} inside ${parent.runtimeType.toString()} (${parentStart})"); 7178 _errors.add("Invalid source end (${nodeEnd}) for ${node.runtimeType.toSt ring()} inside ${parent.runtimeType.toString()} (${parentStart})");
6532 } 7179 }
6533 } 7180 }
6534 } 7181 }
6535 } 7182 }
7183
6536 class ParserTestCase extends EngineTestCase { 7184 class ParserTestCase extends EngineTestCase {
6537
6538 /** 7185 /**
6539 * An empty array of objects used as arguments to zero-argument methods. 7186 * An empty array of objects used as arguments to zero-argument methods.
6540 */ 7187 */
6541 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0); 7188 static List<Object> _EMPTY_ARGUMENTS = new List<Object>(0);
6542 7189
6543 /** 7190 /**
6544 * Invoke a parse method in [Parser]. The method is assumed to have the given number and 7191 * Invoke a parse method in [Parser]. The method is assumed to have the given number and
6545 * type of parameters and will be invoked with the given arguments. 7192 * type of parameters and will be invoked with the given arguments.
6546 * 7193 *
6547 * The given source is scanned and the parser is initialized to start with the first token in the 7194 * The given source is scanned and the parser is initialized to start with the first token in the
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 } 7409 }
6763 return new CommentAndMetadata(comment, metadata); 7410 return new CommentAndMetadata(comment, metadata);
6764 } 7411 }
6765 7412
6766 /** 7413 /**
6767 * Return an empty CommentAndMetadata object that can be used for testing. 7414 * Return an empty CommentAndMetadata object that can be used for testing.
6768 * 7415 *
6769 * @return an empty CommentAndMetadata object that can be used for testing 7416 * @return an empty CommentAndMetadata object that can be used for testing
6770 */ 7417 */
6771 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n ew List<Annotation>()); 7418 CommentAndMetadata emptyCommentAndMetadata() => new CommentAndMetadata(null, n ew List<Annotation>());
7419
6772 static dartSuite() { 7420 static dartSuite() {
6773 _ut.group('ParserTestCase', () { 7421 _ut.group('ParserTestCase', () {
6774 }); 7422 });
6775 } 7423 }
6776 } 7424 }
7425
6777 class ResolutionCopierTest extends EngineTestCase { 7426 class ResolutionCopierTest extends EngineTestCase {
6778 void test_visitAnnotation() { 7427 void test_visitAnnotation() {
6779 String annotationName = "proxy"; 7428 String annotationName = "proxy";
6780 Annotation fromNode = ASTFactory.annotation(ASTFactory.identifier3(annotatio nName)); 7429 Annotation fromNode = ASTFactory.annotation(ASTFactory.identifier3(annotatio nName));
6781 Element element = ElementFactory.topLevelVariableElement2(annotationName); 7430 Element element = ElementFactory.topLevelVariableElement2(annotationName);
6782 fromNode.element = element; 7431 fromNode.element = element;
6783 Annotation toNode = ASTFactory.annotation(ASTFactory.identifier3(annotationN ame)); 7432 Annotation toNode = ASTFactory.annotation(ASTFactory.identifier3(annotationN ame));
6784 ResolutionCopier.copyResolutionData(fromNode, toNode); 7433 ResolutionCopier.copyResolutionData(fromNode, toNode);
6785 JUnitTestCase.assertSame(element, toNode.element); 7434 JUnitTestCase.assertSame(element, toNode.element);
6786 } 7435 }
7436
6787 void test_visitArgumentDefinitionTest() { 7437 void test_visitArgumentDefinitionTest() {
6788 String identifier = "p"; 7438 String identifier = "p";
6789 ArgumentDefinitionTest fromNode = ASTFactory.argumentDefinitionTest(identifi er); 7439 ArgumentDefinitionTest fromNode = ASTFactory.argumentDefinitionTest(identifi er);
6790 Type2 propagatedType = ElementFactory.classElement2("A", []).type; 7440 Type2 propagatedType = ElementFactory.classElement2("A", []).type;
6791 fromNode.propagatedType = propagatedType; 7441 fromNode.propagatedType = propagatedType;
6792 Type2 staticType = ElementFactory.classElement2("B", []).type; 7442 Type2 staticType = ElementFactory.classElement2("B", []).type;
6793 fromNode.staticType = staticType; 7443 fromNode.staticType = staticType;
6794 ArgumentDefinitionTest toNode = ASTFactory.argumentDefinitionTest(identifier ); 7444 ArgumentDefinitionTest toNode = ASTFactory.argumentDefinitionTest(identifier );
6795 ResolutionCopier.copyResolutionData(fromNode, toNode); 7445 ResolutionCopier.copyResolutionData(fromNode, toNode);
6796 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7446 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6797 JUnitTestCase.assertSame(staticType, toNode.staticType); 7447 JUnitTestCase.assertSame(staticType, toNode.staticType);
6798 } 7448 }
7449
6799 void test_visitAsExpression() { 7450 void test_visitAsExpression() {
6800 AsExpression fromNode = ASTFactory.asExpression(ASTFactory.identifier3("x"), ASTFactory.typeName4("A", [])); 7451 AsExpression fromNode = ASTFactory.asExpression(ASTFactory.identifier3("x"), ASTFactory.typeName4("A", []));
6801 Type2 propagatedType = ElementFactory.classElement2("A", []).type; 7452 Type2 propagatedType = ElementFactory.classElement2("A", []).type;
6802 fromNode.propagatedType = propagatedType; 7453 fromNode.propagatedType = propagatedType;
6803 Type2 staticType = ElementFactory.classElement2("B", []).type; 7454 Type2 staticType = ElementFactory.classElement2("B", []).type;
6804 fromNode.staticType = staticType; 7455 fromNode.staticType = staticType;
6805 AsExpression toNode = ASTFactory.asExpression(ASTFactory.identifier3("x"), A STFactory.typeName4("A", [])); 7456 AsExpression toNode = ASTFactory.asExpression(ASTFactory.identifier3("x"), A STFactory.typeName4("A", []));
6806 ResolutionCopier.copyResolutionData(fromNode, toNode); 7457 ResolutionCopier.copyResolutionData(fromNode, toNode);
6807 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7458 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6808 JUnitTestCase.assertSame(staticType, toNode.staticType); 7459 JUnitTestCase.assertSame(staticType, toNode.staticType);
6809 } 7460 }
7461
6810 void test_visitAssignmentExpression() { 7462 void test_visitAssignmentExpression() {
6811 AssignmentExpression fromNode = ASTFactory.assignmentExpression(ASTFactory.i dentifier3("a"), TokenType.PLUS_EQ, ASTFactory.identifier3("b")); 7463 AssignmentExpression fromNode = ASTFactory.assignmentExpression(ASTFactory.i dentifier3("a"), TokenType.PLUS_EQ, ASTFactory.identifier3("b"));
6812 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7464 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6813 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []); 7465 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []);
6814 fromNode.propagatedElement = propagatedElement; 7466 fromNode.propagatedElement = propagatedElement;
6815 fromNode.propagatedType = propagatedType; 7467 fromNode.propagatedType = propagatedType;
6816 Type2 staticType = ElementFactory.classElement2("C", []).type; 7468 Type2 staticType = ElementFactory.classElement2("C", []).type;
6817 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []); 7469 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []);
6818 fromNode.staticElement = staticElement; 7470 fromNode.staticElement = staticElement;
6819 fromNode.staticType = staticType; 7471 fromNode.staticType = staticType;
6820 AssignmentExpression toNode = ASTFactory.assignmentExpression(ASTFactory.ide ntifier3("a"), TokenType.PLUS_EQ, ASTFactory.identifier3("b")); 7472 AssignmentExpression toNode = ASTFactory.assignmentExpression(ASTFactory.ide ntifier3("a"), TokenType.PLUS_EQ, ASTFactory.identifier3("b"));
6821 ResolutionCopier.copyResolutionData(fromNode, toNode); 7473 ResolutionCopier.copyResolutionData(fromNode, toNode);
6822 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7474 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
6823 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7475 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6824 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7476 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6825 JUnitTestCase.assertSame(staticType, toNode.staticType); 7477 JUnitTestCase.assertSame(staticType, toNode.staticType);
6826 } 7478 }
7479
6827 void test_visitBinaryExpression() { 7480 void test_visitBinaryExpression() {
6828 BinaryExpression fromNode = ASTFactory.binaryExpression(ASTFactory.identifie r3("a"), TokenType.PLUS, ASTFactory.identifier3("b")); 7481 BinaryExpression fromNode = ASTFactory.binaryExpression(ASTFactory.identifie r3("a"), TokenType.PLUS, ASTFactory.identifier3("b"));
6829 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7482 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6830 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []); 7483 MethodElement propagatedElement = ElementFactory.methodElement("+", propagat edType, []);
6831 fromNode.propagatedElement = propagatedElement; 7484 fromNode.propagatedElement = propagatedElement;
6832 fromNode.propagatedType = propagatedType; 7485 fromNode.propagatedType = propagatedType;
6833 Type2 staticType = ElementFactory.classElement2("C", []).type; 7486 Type2 staticType = ElementFactory.classElement2("C", []).type;
6834 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []); 7487 MethodElement staticElement = ElementFactory.methodElement("+", staticType, []);
6835 fromNode.staticElement = staticElement; 7488 fromNode.staticElement = staticElement;
6836 fromNode.staticType = staticType; 7489 fromNode.staticType = staticType;
6837 BinaryExpression toNode = ASTFactory.binaryExpression(ASTFactory.identifier3 ("a"), TokenType.PLUS, ASTFactory.identifier3("b")); 7490 BinaryExpression toNode = ASTFactory.binaryExpression(ASTFactory.identifier3 ("a"), TokenType.PLUS, ASTFactory.identifier3("b"));
6838 ResolutionCopier.copyResolutionData(fromNode, toNode); 7491 ResolutionCopier.copyResolutionData(fromNode, toNode);
6839 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7492 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
6840 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7493 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6841 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7494 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6842 JUnitTestCase.assertSame(staticType, toNode.staticType); 7495 JUnitTestCase.assertSame(staticType, toNode.staticType);
6843 } 7496 }
7497
6844 void test_visitBooleanLiteral() { 7498 void test_visitBooleanLiteral() {
6845 BooleanLiteral fromNode = ASTFactory.booleanLiteral(true); 7499 BooleanLiteral fromNode = ASTFactory.booleanLiteral(true);
6846 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7500 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6847 fromNode.propagatedType = propagatedType; 7501 fromNode.propagatedType = propagatedType;
6848 Type2 staticType = ElementFactory.classElement2("C", []).type; 7502 Type2 staticType = ElementFactory.classElement2("C", []).type;
6849 fromNode.staticType = staticType; 7503 fromNode.staticType = staticType;
6850 BooleanLiteral toNode = ASTFactory.booleanLiteral(true); 7504 BooleanLiteral toNode = ASTFactory.booleanLiteral(true);
6851 ResolutionCopier.copyResolutionData(fromNode, toNode); 7505 ResolutionCopier.copyResolutionData(fromNode, toNode);
6852 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7506 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6853 JUnitTestCase.assertSame(staticType, toNode.staticType); 7507 JUnitTestCase.assertSame(staticType, toNode.staticType);
6854 } 7508 }
7509
6855 void test_visitCascadeExpression() { 7510 void test_visitCascadeExpression() {
6856 CascadeExpression fromNode = ASTFactory.cascadeExpression(ASTFactory.identif ier3("a"), [ASTFactory.identifier3("b")]); 7511 CascadeExpression fromNode = ASTFactory.cascadeExpression(ASTFactory.identif ier3("a"), [ASTFactory.identifier3("b")]);
6857 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7512 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6858 fromNode.propagatedType = propagatedType; 7513 fromNode.propagatedType = propagatedType;
6859 Type2 staticType = ElementFactory.classElement2("C", []).type; 7514 Type2 staticType = ElementFactory.classElement2("C", []).type;
6860 fromNode.staticType = staticType; 7515 fromNode.staticType = staticType;
6861 CascadeExpression toNode = ASTFactory.cascadeExpression(ASTFactory.identifie r3("a"), [ASTFactory.identifier3("b")]); 7516 CascadeExpression toNode = ASTFactory.cascadeExpression(ASTFactory.identifie r3("a"), [ASTFactory.identifier3("b")]);
6862 ResolutionCopier.copyResolutionData(fromNode, toNode); 7517 ResolutionCopier.copyResolutionData(fromNode, toNode);
6863 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7518 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6864 JUnitTestCase.assertSame(staticType, toNode.staticType); 7519 JUnitTestCase.assertSame(staticType, toNode.staticType);
6865 } 7520 }
7521
6866 void test_visitCompilationUnit() { 7522 void test_visitCompilationUnit() {
6867 CompilationUnit fromNode = ASTFactory.compilationUnit(); 7523 CompilationUnit fromNode = ASTFactory.compilationUnit();
6868 CompilationUnitElement element = new CompilationUnitElementImpl("test.dart") ; 7524 CompilationUnitElement element = new CompilationUnitElementImpl("test.dart") ;
6869 fromNode.element = element; 7525 fromNode.element = element;
6870 CompilationUnit toNode = ASTFactory.compilationUnit(); 7526 CompilationUnit toNode = ASTFactory.compilationUnit();
6871 ResolutionCopier.copyResolutionData(fromNode, toNode); 7527 ResolutionCopier.copyResolutionData(fromNode, toNode);
6872 JUnitTestCase.assertSame(element, toNode.element); 7528 JUnitTestCase.assertSame(element, toNode.element);
6873 } 7529 }
7530
6874 void test_visitConditionalExpression() { 7531 void test_visitConditionalExpression() {
6875 ConditionalExpression fromNode = ASTFactory.conditionalExpression(ASTFactory .identifier3("c"), ASTFactory.identifier3("a"), ASTFactory.identifier3("b")); 7532 ConditionalExpression fromNode = ASTFactory.conditionalExpression(ASTFactory .identifier3("c"), ASTFactory.identifier3("a"), ASTFactory.identifier3("b"));
6876 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7533 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6877 fromNode.propagatedType = propagatedType; 7534 fromNode.propagatedType = propagatedType;
6878 Type2 staticType = ElementFactory.classElement2("C", []).type; 7535 Type2 staticType = ElementFactory.classElement2("C", []).type;
6879 fromNode.staticType = staticType; 7536 fromNode.staticType = staticType;
6880 ConditionalExpression toNode = ASTFactory.conditionalExpression(ASTFactory.i dentifier3("c"), ASTFactory.identifier3("a"), ASTFactory.identifier3("b")); 7537 ConditionalExpression toNode = ASTFactory.conditionalExpression(ASTFactory.i dentifier3("c"), ASTFactory.identifier3("a"), ASTFactory.identifier3("b"));
6881 ResolutionCopier.copyResolutionData(fromNode, toNode); 7538 ResolutionCopier.copyResolutionData(fromNode, toNode);
6882 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7539 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6883 JUnitTestCase.assertSame(staticType, toNode.staticType); 7540 JUnitTestCase.assertSame(staticType, toNode.staticType);
6884 } 7541 }
7542
6885 void test_visitConstructorDeclaration() { 7543 void test_visitConstructorDeclaration() {
6886 String className = "A"; 7544 String className = "A";
6887 String constructorName = "c"; 7545 String constructorName = "c";
6888 ConstructorDeclaration fromNode = ASTFactory.constructorDeclaration(ASTFacto ry.identifier3(className), constructorName, ASTFactory.formalParameterList([]), null); 7546 ConstructorDeclaration fromNode = ASTFactory.constructorDeclaration(ASTFacto ry.identifier3(className), constructorName, ASTFactory.formalParameterList([]), null);
6889 ConstructorElement element = ElementFactory.constructorElement(ElementFactor y.classElement2(className, []), constructorName); 7547 ConstructorElement element = ElementFactory.constructorElement2(ElementFacto ry.classElement2(className, []), constructorName, []);
6890 fromNode.element = element; 7548 fromNode.element = element;
6891 ConstructorDeclaration toNode = ASTFactory.constructorDeclaration(ASTFactory .identifier3(className), constructorName, ASTFactory.formalParameterList([]), nu ll); 7549 ConstructorDeclaration toNode = ASTFactory.constructorDeclaration(ASTFactory .identifier3(className), constructorName, ASTFactory.formalParameterList([]), nu ll);
6892 ResolutionCopier.copyResolutionData(fromNode, toNode); 7550 ResolutionCopier.copyResolutionData(fromNode, toNode);
6893 JUnitTestCase.assertSame(element, toNode.element); 7551 JUnitTestCase.assertSame(element, toNode.element);
6894 } 7552 }
7553
6895 void test_visitConstructorName() { 7554 void test_visitConstructorName() {
6896 ConstructorName fromNode = ASTFactory.constructorName(ASTFactory.typeName4(" A", []), "c"); 7555 ConstructorName fromNode = ASTFactory.constructorName(ASTFactory.typeName4(" A", []), "c");
6897 ConstructorElement staticElement = ElementFactory.constructorElement(Element Factory.classElement2("A", []), "c"); 7556 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("A", []), "c", []);
6898 fromNode.staticElement = staticElement; 7557 fromNode.staticElement = staticElement;
6899 ConstructorName toNode = ASTFactory.constructorName(ASTFactory.typeName4("A" , []), "c"); 7558 ConstructorName toNode = ASTFactory.constructorName(ASTFactory.typeName4("A" , []), "c");
6900 ResolutionCopier.copyResolutionData(fromNode, toNode); 7559 ResolutionCopier.copyResolutionData(fromNode, toNode);
6901 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7560 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6902 } 7561 }
7562
6903 void test_visitDoubleLiteral() { 7563 void test_visitDoubleLiteral() {
6904 DoubleLiteral fromNode = ASTFactory.doubleLiteral(1.0); 7564 DoubleLiteral fromNode = ASTFactory.doubleLiteral(1.0);
6905 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7565 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6906 fromNode.propagatedType = propagatedType; 7566 fromNode.propagatedType = propagatedType;
6907 Type2 staticType = ElementFactory.classElement2("C", []).type; 7567 Type2 staticType = ElementFactory.classElement2("C", []).type;
6908 fromNode.staticType = staticType; 7568 fromNode.staticType = staticType;
6909 DoubleLiteral toNode = ASTFactory.doubleLiteral(1.0); 7569 DoubleLiteral toNode = ASTFactory.doubleLiteral(1.0);
6910 ResolutionCopier.copyResolutionData(fromNode, toNode); 7570 ResolutionCopier.copyResolutionData(fromNode, toNode);
6911 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7571 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6912 JUnitTestCase.assertSame(staticType, toNode.staticType); 7572 JUnitTestCase.assertSame(staticType, toNode.staticType);
6913 } 7573 }
7574
6914 void test_visitExportDirective() { 7575 void test_visitExportDirective() {
6915 ExportDirective fromNode = ASTFactory.exportDirective2("dart:uri", []); 7576 ExportDirective fromNode = ASTFactory.exportDirective2("dart:uri", []);
6916 ExportElement element = new ExportElementImpl(); 7577 ExportElement element = new ExportElementImpl();
6917 fromNode.element = element; 7578 fromNode.element = element;
6918 ExportDirective toNode = ASTFactory.exportDirective2("dart:uri", []); 7579 ExportDirective toNode = ASTFactory.exportDirective2("dart:uri", []);
6919 ResolutionCopier.copyResolutionData(fromNode, toNode); 7580 ResolutionCopier.copyResolutionData(fromNode, toNode);
6920 JUnitTestCase.assertSame(element, toNode.element); 7581 JUnitTestCase.assertSame(element, toNode.element);
6921 } 7582 }
7583
6922 void test_visitFunctionExpression() { 7584 void test_visitFunctionExpression() {
6923 FunctionExpression fromNode = ASTFactory.functionExpression2(ASTFactory.form alParameterList([]), ASTFactory.emptyFunctionBody()); 7585 FunctionExpression fromNode = ASTFactory.functionExpression2(ASTFactory.form alParameterList([]), ASTFactory.emptyFunctionBody());
6924 MethodElement element = ElementFactory.methodElement("m", ElementFactory.cla ssElement2("C", []).type, []); 7586 MethodElement element = ElementFactory.methodElement("m", ElementFactory.cla ssElement2("C", []).type, []);
6925 fromNode.element = element; 7587 fromNode.element = element;
6926 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7588 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6927 fromNode.propagatedType = propagatedType; 7589 fromNode.propagatedType = propagatedType;
6928 Type2 staticType = ElementFactory.classElement2("C", []).type; 7590 Type2 staticType = ElementFactory.classElement2("C", []).type;
6929 fromNode.staticType = staticType; 7591 fromNode.staticType = staticType;
6930 FunctionExpression toNode = ASTFactory.functionExpression2(ASTFactory.formal ParameterList([]), ASTFactory.emptyFunctionBody()); 7592 FunctionExpression toNode = ASTFactory.functionExpression2(ASTFactory.formal ParameterList([]), ASTFactory.emptyFunctionBody());
6931 ResolutionCopier.copyResolutionData(fromNode, toNode); 7593 ResolutionCopier.copyResolutionData(fromNode, toNode);
6932 JUnitTestCase.assertSame(element, toNode.element); 7594 JUnitTestCase.assertSame(element, toNode.element);
6933 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7595 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6934 JUnitTestCase.assertSame(staticType, toNode.staticType); 7596 JUnitTestCase.assertSame(staticType, toNode.staticType);
6935 } 7597 }
7598
6936 void test_visitFunctionExpressionInvocation() { 7599 void test_visitFunctionExpressionInvocation() {
6937 FunctionExpressionInvocation fromNode = ASTFactory.functionExpressionInvocat ion(ASTFactory.identifier3("f"), []); 7600 FunctionExpressionInvocation fromNode = ASTFactory.functionExpressionInvocat ion(ASTFactory.identifier3("f"), []);
6938 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 7601 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
6939 fromNode.propagatedElement = propagatedElement; 7602 fromNode.propagatedElement = propagatedElement;
6940 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7603 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6941 fromNode.propagatedType = propagatedType; 7604 fromNode.propagatedType = propagatedType;
6942 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 7605 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
6943 fromNode.staticElement = staticElement; 7606 fromNode.staticElement = staticElement;
6944 Type2 staticType = ElementFactory.classElement2("C", []).type; 7607 Type2 staticType = ElementFactory.classElement2("C", []).type;
6945 fromNode.staticType = staticType; 7608 fromNode.staticType = staticType;
6946 FunctionExpressionInvocation toNode = ASTFactory.functionExpressionInvocatio n(ASTFactory.identifier3("f"), []); 7609 FunctionExpressionInvocation toNode = ASTFactory.functionExpressionInvocatio n(ASTFactory.identifier3("f"), []);
6947 ResolutionCopier.copyResolutionData(fromNode, toNode); 7610 ResolutionCopier.copyResolutionData(fromNode, toNode);
6948 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7611 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
6949 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7612 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6950 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7613 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6951 JUnitTestCase.assertSame(staticType, toNode.staticType); 7614 JUnitTestCase.assertSame(staticType, toNode.staticType);
6952 } 7615 }
7616
6953 void test_visitImportDirective() { 7617 void test_visitImportDirective() {
6954 ImportDirective fromNode = ASTFactory.importDirective2("dart:uri", null, []) ; 7618 ImportDirective fromNode = ASTFactory.importDirective2("dart:uri", null, []) ;
6955 ImportElement element = new ImportElementImpl(); 7619 ImportElement element = new ImportElementImpl();
6956 fromNode.element = element; 7620 fromNode.element = element;
6957 ImportDirective toNode = ASTFactory.importDirective2("dart:uri", null, []); 7621 ImportDirective toNode = ASTFactory.importDirective2("dart:uri", null, []);
6958 ResolutionCopier.copyResolutionData(fromNode, toNode); 7622 ResolutionCopier.copyResolutionData(fromNode, toNode);
6959 JUnitTestCase.assertSame(element, toNode.element); 7623 JUnitTestCase.assertSame(element, toNode.element);
6960 } 7624 }
7625
6961 void test_visitIndexExpression() { 7626 void test_visitIndexExpression() {
6962 IndexExpression fromNode = ASTFactory.indexExpression(ASTFactory.identifier3 ("a"), ASTFactory.integer(0)); 7627 IndexExpression fromNode = ASTFactory.indexExpression(ASTFactory.identifier3 ("a"), ASTFactory.integer(0));
6963 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 7628 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
6964 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 7629 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
6965 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement); 7630 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement);
6966 fromNode.auxiliaryElements = auxiliaryElements; 7631 fromNode.auxiliaryElements = auxiliaryElements;
6967 fromNode.propagatedElement = propagatedElement; 7632 fromNode.propagatedElement = propagatedElement;
6968 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7633 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6969 fromNode.propagatedType = propagatedType; 7634 fromNode.propagatedType = propagatedType;
6970 fromNode.staticElement = staticElement; 7635 fromNode.staticElement = staticElement;
6971 Type2 staticType = ElementFactory.classElement2("C", []).type; 7636 Type2 staticType = ElementFactory.classElement2("C", []).type;
6972 fromNode.staticType = staticType; 7637 fromNode.staticType = staticType;
6973 IndexExpression toNode = ASTFactory.indexExpression(ASTFactory.identifier3(" a"), ASTFactory.integer(0)); 7638 IndexExpression toNode = ASTFactory.indexExpression(ASTFactory.identifier3(" a"), ASTFactory.integer(0));
6974 ResolutionCopier.copyResolutionData(fromNode, toNode); 7639 ResolutionCopier.copyResolutionData(fromNode, toNode);
6975 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements); 7640 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements);
6976 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7641 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
6977 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7642 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6978 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7643 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6979 JUnitTestCase.assertSame(staticType, toNode.staticType); 7644 JUnitTestCase.assertSame(staticType, toNode.staticType);
6980 } 7645 }
7646
6981 void test_visitInstanceCreationExpression() { 7647 void test_visitInstanceCreationExpression() {
6982 InstanceCreationExpression fromNode = ASTFactory.instanceCreationExpression2 (Keyword.NEW, ASTFactory.typeName4("C", []), []); 7648 InstanceCreationExpression fromNode = ASTFactory.instanceCreationExpression2 (Keyword.NEW, ASTFactory.typeName4("C", []), []);
6983 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7649 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6984 fromNode.propagatedType = propagatedType; 7650 fromNode.propagatedType = propagatedType;
6985 ConstructorElement staticElement = ElementFactory.constructorElement(Element Factory.classElement2("C", []), null); 7651 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
6986 fromNode.staticElement = staticElement; 7652 fromNode.staticElement = staticElement;
6987 Type2 staticType = ElementFactory.classElement2("C", []).type; 7653 Type2 staticType = ElementFactory.classElement2("C", []).type;
6988 fromNode.staticType = staticType; 7654 fromNode.staticType = staticType;
6989 InstanceCreationExpression toNode = ASTFactory.instanceCreationExpression2(K eyword.NEW, ASTFactory.typeName4("C", []), []); 7655 InstanceCreationExpression toNode = ASTFactory.instanceCreationExpression2(K eyword.NEW, ASTFactory.typeName4("C", []), []);
6990 ResolutionCopier.copyResolutionData(fromNode, toNode); 7656 ResolutionCopier.copyResolutionData(fromNode, toNode);
6991 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7657 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
6992 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7658 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
6993 JUnitTestCase.assertSame(staticType, toNode.staticType); 7659 JUnitTestCase.assertSame(staticType, toNode.staticType);
6994 } 7660 }
7661
6995 void test_visitIntegerLiteral() { 7662 void test_visitIntegerLiteral() {
6996 IntegerLiteral fromNode = ASTFactory.integer(2); 7663 IntegerLiteral fromNode = ASTFactory.integer(2);
6997 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7664 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
6998 fromNode.propagatedType = propagatedType; 7665 fromNode.propagatedType = propagatedType;
6999 Type2 staticType = ElementFactory.classElement2("C", []).type; 7666 Type2 staticType = ElementFactory.classElement2("C", []).type;
7000 fromNode.staticType = staticType; 7667 fromNode.staticType = staticType;
7001 IntegerLiteral toNode = ASTFactory.integer(2); 7668 IntegerLiteral toNode = ASTFactory.integer(2);
7002 ResolutionCopier.copyResolutionData(fromNode, toNode); 7669 ResolutionCopier.copyResolutionData(fromNode, toNode);
7003 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7670 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7004 JUnitTestCase.assertSame(staticType, toNode.staticType); 7671 JUnitTestCase.assertSame(staticType, toNode.staticType);
7005 } 7672 }
7673
7006 void test_visitIsExpression() { 7674 void test_visitIsExpression() {
7007 IsExpression fromNode = ASTFactory.isExpression(ASTFactory.identifier3("x"), false, ASTFactory.typeName4("A", [])); 7675 IsExpression fromNode = ASTFactory.isExpression(ASTFactory.identifier3("x"), false, ASTFactory.typeName4("A", []));
7008 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7676 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7009 fromNode.propagatedType = propagatedType; 7677 fromNode.propagatedType = propagatedType;
7010 Type2 staticType = ElementFactory.classElement2("C", []).type; 7678 Type2 staticType = ElementFactory.classElement2("C", []).type;
7011 fromNode.staticType = staticType; 7679 fromNode.staticType = staticType;
7012 IsExpression toNode = ASTFactory.isExpression(ASTFactory.identifier3("x"), f alse, ASTFactory.typeName4("A", [])); 7680 IsExpression toNode = ASTFactory.isExpression(ASTFactory.identifier3("x"), f alse, ASTFactory.typeName4("A", []));
7013 ResolutionCopier.copyResolutionData(fromNode, toNode); 7681 ResolutionCopier.copyResolutionData(fromNode, toNode);
7014 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7682 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7015 JUnitTestCase.assertSame(staticType, toNode.staticType); 7683 JUnitTestCase.assertSame(staticType, toNode.staticType);
7016 } 7684 }
7685
7017 void test_visitLibraryIdentifier() { 7686 void test_visitLibraryIdentifier() {
7018 LibraryIdentifier fromNode = ASTFactory.libraryIdentifier([ASTFactory.identi fier3("lib")]); 7687 LibraryIdentifier fromNode = ASTFactory.libraryIdentifier([ASTFactory.identi fier3("lib")]);
7019 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7688 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7020 fromNode.propagatedType = propagatedType; 7689 fromNode.propagatedType = propagatedType;
7021 Type2 staticType = ElementFactory.classElement2("C", []).type; 7690 Type2 staticType = ElementFactory.classElement2("C", []).type;
7022 fromNode.staticType = staticType; 7691 fromNode.staticType = staticType;
7023 LibraryIdentifier toNode = ASTFactory.libraryIdentifier([ASTFactory.identifi er3("lib")]); 7692 LibraryIdentifier toNode = ASTFactory.libraryIdentifier([ASTFactory.identifi er3("lib")]);
7024 ResolutionCopier.copyResolutionData(fromNode, toNode); 7693 ResolutionCopier.copyResolutionData(fromNode, toNode);
7025 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7694 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7026 JUnitTestCase.assertSame(staticType, toNode.staticType); 7695 JUnitTestCase.assertSame(staticType, toNode.staticType);
7027 } 7696 }
7697
7028 void test_visitListLiteral() { 7698 void test_visitListLiteral() {
7029 ListLiteral fromNode = ASTFactory.listLiteral([]); 7699 ListLiteral fromNode = ASTFactory.listLiteral([]);
7030 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7700 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7031 fromNode.propagatedType = propagatedType; 7701 fromNode.propagatedType = propagatedType;
7032 Type2 staticType = ElementFactory.classElement2("C", []).type; 7702 Type2 staticType = ElementFactory.classElement2("C", []).type;
7033 fromNode.staticType = staticType; 7703 fromNode.staticType = staticType;
7034 ListLiteral toNode = ASTFactory.listLiteral([]); 7704 ListLiteral toNode = ASTFactory.listLiteral([]);
7035 ResolutionCopier.copyResolutionData(fromNode, toNode); 7705 ResolutionCopier.copyResolutionData(fromNode, toNode);
7036 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7706 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7037 JUnitTestCase.assertSame(staticType, toNode.staticType); 7707 JUnitTestCase.assertSame(staticType, toNode.staticType);
7038 } 7708 }
7709
7039 void test_visitMapLiteral() { 7710 void test_visitMapLiteral() {
7040 MapLiteral fromNode = ASTFactory.mapLiteral2([]); 7711 MapLiteral fromNode = ASTFactory.mapLiteral2([]);
7041 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7712 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7042 fromNode.propagatedType = propagatedType; 7713 fromNode.propagatedType = propagatedType;
7043 Type2 staticType = ElementFactory.classElement2("C", []).type; 7714 Type2 staticType = ElementFactory.classElement2("C", []).type;
7044 fromNode.staticType = staticType; 7715 fromNode.staticType = staticType;
7045 MapLiteral toNode = ASTFactory.mapLiteral2([]); 7716 MapLiteral toNode = ASTFactory.mapLiteral2([]);
7046 ResolutionCopier.copyResolutionData(fromNode, toNode); 7717 ResolutionCopier.copyResolutionData(fromNode, toNode);
7047 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7718 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7048 JUnitTestCase.assertSame(staticType, toNode.staticType); 7719 JUnitTestCase.assertSame(staticType, toNode.staticType);
7049 } 7720 }
7721
7050 void test_visitMethodInvocation() { 7722 void test_visitMethodInvocation() {
7051 MethodInvocation fromNode = ASTFactory.methodInvocation2("m", []); 7723 MethodInvocation fromNode = ASTFactory.methodInvocation2("m", []);
7052 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7724 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7053 fromNode.propagatedType = propagatedType; 7725 fromNode.propagatedType = propagatedType;
7054 Type2 staticType = ElementFactory.classElement2("C", []).type; 7726 Type2 staticType = ElementFactory.classElement2("C", []).type;
7055 fromNode.staticType = staticType; 7727 fromNode.staticType = staticType;
7056 MethodInvocation toNode = ASTFactory.methodInvocation2("m", []); 7728 MethodInvocation toNode = ASTFactory.methodInvocation2("m", []);
7057 ResolutionCopier.copyResolutionData(fromNode, toNode); 7729 ResolutionCopier.copyResolutionData(fromNode, toNode);
7058 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7730 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7059 JUnitTestCase.assertSame(staticType, toNode.staticType); 7731 JUnitTestCase.assertSame(staticType, toNode.staticType);
7060 } 7732 }
7733
7061 void test_visitNamedExpression() { 7734 void test_visitNamedExpression() {
7062 NamedExpression fromNode = ASTFactory.namedExpression2("n", ASTFactory.integ er(0)); 7735 NamedExpression fromNode = ASTFactory.namedExpression2("n", ASTFactory.integ er(0));
7063 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7736 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7064 fromNode.propagatedType = propagatedType; 7737 fromNode.propagatedType = propagatedType;
7065 Type2 staticType = ElementFactory.classElement2("C", []).type; 7738 Type2 staticType = ElementFactory.classElement2("C", []).type;
7066 fromNode.staticType = staticType; 7739 fromNode.staticType = staticType;
7067 NamedExpression toNode = ASTFactory.namedExpression2("n", ASTFactory.integer (0)); 7740 NamedExpression toNode = ASTFactory.namedExpression2("n", ASTFactory.integer (0));
7068 ResolutionCopier.copyResolutionData(fromNode, toNode); 7741 ResolutionCopier.copyResolutionData(fromNode, toNode);
7069 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7742 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7070 JUnitTestCase.assertSame(staticType, toNode.staticType); 7743 JUnitTestCase.assertSame(staticType, toNode.staticType);
7071 } 7744 }
7745
7072 void test_visitNullLiteral() { 7746 void test_visitNullLiteral() {
7073 NullLiteral fromNode = ASTFactory.nullLiteral(); 7747 NullLiteral fromNode = ASTFactory.nullLiteral();
7074 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7748 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7075 fromNode.propagatedType = propagatedType; 7749 fromNode.propagatedType = propagatedType;
7076 Type2 staticType = ElementFactory.classElement2("C", []).type; 7750 Type2 staticType = ElementFactory.classElement2("C", []).type;
7077 fromNode.staticType = staticType; 7751 fromNode.staticType = staticType;
7078 NullLiteral toNode = ASTFactory.nullLiteral(); 7752 NullLiteral toNode = ASTFactory.nullLiteral();
7079 ResolutionCopier.copyResolutionData(fromNode, toNode); 7753 ResolutionCopier.copyResolutionData(fromNode, toNode);
7080 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7754 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7081 JUnitTestCase.assertSame(staticType, toNode.staticType); 7755 JUnitTestCase.assertSame(staticType, toNode.staticType);
7082 } 7756 }
7757
7083 void test_visitParenthesizedExpression() { 7758 void test_visitParenthesizedExpression() {
7084 ParenthesizedExpression fromNode = ASTFactory.parenthesizedExpression(ASTFac tory.integer(0)); 7759 ParenthesizedExpression fromNode = ASTFactory.parenthesizedExpression(ASTFac tory.integer(0));
7085 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7760 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7086 fromNode.propagatedType = propagatedType; 7761 fromNode.propagatedType = propagatedType;
7087 Type2 staticType = ElementFactory.classElement2("C", []).type; 7762 Type2 staticType = ElementFactory.classElement2("C", []).type;
7088 fromNode.staticType = staticType; 7763 fromNode.staticType = staticType;
7089 ParenthesizedExpression toNode = ASTFactory.parenthesizedExpression(ASTFacto ry.integer(0)); 7764 ParenthesizedExpression toNode = ASTFactory.parenthesizedExpression(ASTFacto ry.integer(0));
7090 ResolutionCopier.copyResolutionData(fromNode, toNode); 7765 ResolutionCopier.copyResolutionData(fromNode, toNode);
7091 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7766 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7092 JUnitTestCase.assertSame(staticType, toNode.staticType); 7767 JUnitTestCase.assertSame(staticType, toNode.staticType);
7093 } 7768 }
7769
7094 void test_visitPartDirective() { 7770 void test_visitPartDirective() {
7095 PartDirective fromNode = ASTFactory.partDirective2("part.dart"); 7771 PartDirective fromNode = ASTFactory.partDirective2("part.dart");
7096 LibraryElement element = new LibraryElementImpl(null, ASTFactory.libraryIden tifier2(["lib"])); 7772 LibraryElement element = new LibraryElementImpl(null, ASTFactory.libraryIden tifier2(["lib"]));
7097 fromNode.element = element; 7773 fromNode.element = element;
7098 PartDirective toNode = ASTFactory.partDirective2("part.dart"); 7774 PartDirective toNode = ASTFactory.partDirective2("part.dart");
7099 ResolutionCopier.copyResolutionData(fromNode, toNode); 7775 ResolutionCopier.copyResolutionData(fromNode, toNode);
7100 JUnitTestCase.assertSame(element, toNode.element); 7776 JUnitTestCase.assertSame(element, toNode.element);
7101 } 7777 }
7778
7102 void test_visitPartOfDirective() { 7779 void test_visitPartOfDirective() {
7103 PartOfDirective fromNode = ASTFactory.partOfDirective(ASTFactory.libraryIden tifier2(["lib"])); 7780 PartOfDirective fromNode = ASTFactory.partOfDirective(ASTFactory.libraryIden tifier2(["lib"]));
7104 LibraryElement element = new LibraryElementImpl(null, ASTFactory.libraryIden tifier2(["lib"])); 7781 LibraryElement element = new LibraryElementImpl(null, ASTFactory.libraryIden tifier2(["lib"]));
7105 fromNode.element = element; 7782 fromNode.element = element;
7106 PartOfDirective toNode = ASTFactory.partOfDirective(ASTFactory.libraryIdenti fier2(["lib"])); 7783 PartOfDirective toNode = ASTFactory.partOfDirective(ASTFactory.libraryIdenti fier2(["lib"]));
7107 ResolutionCopier.copyResolutionData(fromNode, toNode); 7784 ResolutionCopier.copyResolutionData(fromNode, toNode);
7108 JUnitTestCase.assertSame(element, toNode.element); 7785 JUnitTestCase.assertSame(element, toNode.element);
7109 } 7786 }
7787
7110 void test_visitPostfixExpression() { 7788 void test_visitPostfixExpression() {
7111 String variableName = "x"; 7789 String variableName = "x";
7112 PostfixExpression fromNode = ASTFactory.postfixExpression(ASTFactory.identif ier3(variableName), TokenType.PLUS_PLUS); 7790 PostfixExpression fromNode = ASTFactory.postfixExpression(ASTFactory.identif ier3(variableName), TokenType.PLUS_PLUS);
7113 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []); 7791 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []);
7114 fromNode.propagatedElement = propagatedElement; 7792 fromNode.propagatedElement = propagatedElement;
7115 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7793 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7116 fromNode.propagatedType = propagatedType; 7794 fromNode.propagatedType = propagatedType;
7117 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []); 7795 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []);
7118 fromNode.staticElement = staticElement; 7796 fromNode.staticElement = staticElement;
7119 Type2 staticType = ElementFactory.classElement2("C", []).type; 7797 Type2 staticType = ElementFactory.classElement2("C", []).type;
7120 fromNode.staticType = staticType; 7798 fromNode.staticType = staticType;
7121 PostfixExpression toNode = ASTFactory.postfixExpression(ASTFactory.identifie r3(variableName), TokenType.PLUS_PLUS); 7799 PostfixExpression toNode = ASTFactory.postfixExpression(ASTFactory.identifie r3(variableName), TokenType.PLUS_PLUS);
7122 ResolutionCopier.copyResolutionData(fromNode, toNode); 7800 ResolutionCopier.copyResolutionData(fromNode, toNode);
7123 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7801 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
7124 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7802 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7125 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7803 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
7126 JUnitTestCase.assertSame(staticType, toNode.staticType); 7804 JUnitTestCase.assertSame(staticType, toNode.staticType);
7127 } 7805 }
7806
7128 void test_visitPrefixedIdentifier() { 7807 void test_visitPrefixedIdentifier() {
7129 PrefixedIdentifier fromNode = ASTFactory.identifier5("p", "f"); 7808 PrefixedIdentifier fromNode = ASTFactory.identifier5("p", "f");
7130 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7809 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7131 fromNode.propagatedType = propagatedType; 7810 fromNode.propagatedType = propagatedType;
7132 Type2 staticType = ElementFactory.classElement2("C", []).type; 7811 Type2 staticType = ElementFactory.classElement2("C", []).type;
7133 fromNode.staticType = staticType; 7812 fromNode.staticType = staticType;
7134 PrefixedIdentifier toNode = ASTFactory.identifier5("p", "f"); 7813 PrefixedIdentifier toNode = ASTFactory.identifier5("p", "f");
7135 ResolutionCopier.copyResolutionData(fromNode, toNode); 7814 ResolutionCopier.copyResolutionData(fromNode, toNode);
7136 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7815 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7137 JUnitTestCase.assertSame(staticType, toNode.staticType); 7816 JUnitTestCase.assertSame(staticType, toNode.staticType);
7138 } 7817 }
7818
7139 void test_visitPrefixExpression() { 7819 void test_visitPrefixExpression() {
7140 PrefixExpression fromNode = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, ASTFactory.identifier3("x")); 7820 PrefixExpression fromNode = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, ASTFactory.identifier3("x"));
7141 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []); 7821 MethodElement propagatedElement = ElementFactory.methodElement("+", ElementF actory.classElement2("C", []).type, []);
7142 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7822 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7143 fromNode.propagatedElement = propagatedElement; 7823 fromNode.propagatedElement = propagatedElement;
7144 fromNode.propagatedType = propagatedType; 7824 fromNode.propagatedType = propagatedType;
7145 Type2 staticType = ElementFactory.classElement2("C", []).type; 7825 Type2 staticType = ElementFactory.classElement2("C", []).type;
7146 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []); 7826 MethodElement staticElement = ElementFactory.methodElement("+", ElementFacto ry.classElement2("C", []).type, []);
7147 fromNode.staticElement = staticElement; 7827 fromNode.staticElement = staticElement;
7148 fromNode.staticType = staticType; 7828 fromNode.staticType = staticType;
7149 PrefixExpression toNode = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, A STFactory.identifier3("x")); 7829 PrefixExpression toNode = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, A STFactory.identifier3("x"));
7150 ResolutionCopier.copyResolutionData(fromNode, toNode); 7830 ResolutionCopier.copyResolutionData(fromNode, toNode);
7151 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7831 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
7152 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7832 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7153 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7833 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
7154 JUnitTestCase.assertSame(staticType, toNode.staticType); 7834 JUnitTestCase.assertSame(staticType, toNode.staticType);
7155 } 7835 }
7836
7156 void test_visitPropertyAccess() { 7837 void test_visitPropertyAccess() {
7157 PropertyAccess fromNode = ASTFactory.propertyAccess2(ASTFactory.identifier3( "x"), "y"); 7838 PropertyAccess fromNode = ASTFactory.propertyAccess2(ASTFactory.identifier3( "x"), "y");
7158 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7839 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7159 fromNode.propagatedType = propagatedType; 7840 fromNode.propagatedType = propagatedType;
7160 Type2 staticType = ElementFactory.classElement2("C", []).type; 7841 Type2 staticType = ElementFactory.classElement2("C", []).type;
7161 fromNode.staticType = staticType; 7842 fromNode.staticType = staticType;
7162 PropertyAccess toNode = ASTFactory.propertyAccess2(ASTFactory.identifier3("x "), "y"); 7843 PropertyAccess toNode = ASTFactory.propertyAccess2(ASTFactory.identifier3("x "), "y");
7163 ResolutionCopier.copyResolutionData(fromNode, toNode); 7844 ResolutionCopier.copyResolutionData(fromNode, toNode);
7164 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7845 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7165 JUnitTestCase.assertSame(staticType, toNode.staticType); 7846 JUnitTestCase.assertSame(staticType, toNode.staticType);
7166 } 7847 }
7848
7167 void test_visitRedirectingConstructorInvocation() { 7849 void test_visitRedirectingConstructorInvocation() {
7168 RedirectingConstructorInvocation fromNode = ASTFactory.redirectingConstructo rInvocation([]); 7850 RedirectingConstructorInvocation fromNode = ASTFactory.redirectingConstructo rInvocation([]);
7169 ConstructorElement staticElement = ElementFactory.constructorElement(Element Factory.classElement2("C", []), null); 7851 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
7170 fromNode.staticElement = staticElement; 7852 fromNode.staticElement = staticElement;
7171 RedirectingConstructorInvocation toNode = ASTFactory.redirectingConstructorI nvocation([]); 7853 RedirectingConstructorInvocation toNode = ASTFactory.redirectingConstructorI nvocation([]);
7172 ResolutionCopier.copyResolutionData(fromNode, toNode); 7854 ResolutionCopier.copyResolutionData(fromNode, toNode);
7173 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7855 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
7174 } 7856 }
7857
7175 void test_visitRethrowExpression() { 7858 void test_visitRethrowExpression() {
7176 RethrowExpression fromNode = ASTFactory.rethrowExpression(); 7859 RethrowExpression fromNode = ASTFactory.rethrowExpression();
7177 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7860 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7178 fromNode.propagatedType = propagatedType; 7861 fromNode.propagatedType = propagatedType;
7179 Type2 staticType = ElementFactory.classElement2("C", []).type; 7862 Type2 staticType = ElementFactory.classElement2("C", []).type;
7180 fromNode.staticType = staticType; 7863 fromNode.staticType = staticType;
7181 RethrowExpression toNode = ASTFactory.rethrowExpression(); 7864 RethrowExpression toNode = ASTFactory.rethrowExpression();
7182 ResolutionCopier.copyResolutionData(fromNode, toNode); 7865 ResolutionCopier.copyResolutionData(fromNode, toNode);
7183 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7866 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7184 JUnitTestCase.assertSame(staticType, toNode.staticType); 7867 JUnitTestCase.assertSame(staticType, toNode.staticType);
7185 } 7868 }
7869
7186 void test_visitSimpleIdentifier() { 7870 void test_visitSimpleIdentifier() {
7187 SimpleIdentifier fromNode = ASTFactory.identifier3("x"); 7871 SimpleIdentifier fromNode = ASTFactory.identifier3("x");
7188 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []); 7872 MethodElement propagatedElement = ElementFactory.methodElement("m", ElementF actory.classElement2("C", []).type, []);
7189 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []); 7873 MethodElement staticElement = ElementFactory.methodElement("m", ElementFacto ry.classElement2("C", []).type, []);
7190 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement); 7874 AuxiliaryElements auxiliaryElements = new AuxiliaryElements(staticElement, p ropagatedElement);
7191 fromNode.auxiliaryElements = auxiliaryElements; 7875 fromNode.auxiliaryElements = auxiliaryElements;
7192 fromNode.propagatedElement = propagatedElement; 7876 fromNode.propagatedElement = propagatedElement;
7193 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7877 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7194 fromNode.propagatedType = propagatedType; 7878 fromNode.propagatedType = propagatedType;
7195 fromNode.staticElement = staticElement; 7879 fromNode.staticElement = staticElement;
7196 Type2 staticType = ElementFactory.classElement2("C", []).type; 7880 Type2 staticType = ElementFactory.classElement2("C", []).type;
7197 fromNode.staticType = staticType; 7881 fromNode.staticType = staticType;
7198 SimpleIdentifier toNode = ASTFactory.identifier3("x"); 7882 SimpleIdentifier toNode = ASTFactory.identifier3("x");
7199 ResolutionCopier.copyResolutionData(fromNode, toNode); 7883 ResolutionCopier.copyResolutionData(fromNode, toNode);
7200 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements); 7884 JUnitTestCase.assertSame(auxiliaryElements, toNode.auxiliaryElements);
7201 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement); 7885 JUnitTestCase.assertSame(propagatedElement, toNode.propagatedElement);
7202 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7886 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7203 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7887 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
7204 JUnitTestCase.assertSame(staticType, toNode.staticType); 7888 JUnitTestCase.assertSame(staticType, toNode.staticType);
7205 } 7889 }
7890
7206 void test_visitSimpleStringLiteral() { 7891 void test_visitSimpleStringLiteral() {
7207 SimpleStringLiteral fromNode = ASTFactory.string2("abc"); 7892 SimpleStringLiteral fromNode = ASTFactory.string2("abc");
7208 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7893 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7209 fromNode.propagatedType = propagatedType; 7894 fromNode.propagatedType = propagatedType;
7210 Type2 staticType = ElementFactory.classElement2("C", []).type; 7895 Type2 staticType = ElementFactory.classElement2("C", []).type;
7211 fromNode.staticType = staticType; 7896 fromNode.staticType = staticType;
7212 SimpleStringLiteral toNode = ASTFactory.string2("abc"); 7897 SimpleStringLiteral toNode = ASTFactory.string2("abc");
7213 ResolutionCopier.copyResolutionData(fromNode, toNode); 7898 ResolutionCopier.copyResolutionData(fromNode, toNode);
7214 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7899 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7215 JUnitTestCase.assertSame(staticType, toNode.staticType); 7900 JUnitTestCase.assertSame(staticType, toNode.staticType);
7216 } 7901 }
7902
7217 void test_visitStringInterpolation() { 7903 void test_visitStringInterpolation() {
7218 StringInterpolation fromNode = ASTFactory.string([ASTFactory.interpolationSt ring("a", "'a'")]); 7904 StringInterpolation fromNode = ASTFactory.string([ASTFactory.interpolationSt ring("a", "'a'")]);
7219 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7905 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7220 fromNode.propagatedType = propagatedType; 7906 fromNode.propagatedType = propagatedType;
7221 Type2 staticType = ElementFactory.classElement2("C", []).type; 7907 Type2 staticType = ElementFactory.classElement2("C", []).type;
7222 fromNode.staticType = staticType; 7908 fromNode.staticType = staticType;
7223 StringInterpolation toNode = ASTFactory.string([ASTFactory.interpolationStri ng("a", "'a'")]); 7909 StringInterpolation toNode = ASTFactory.string([ASTFactory.interpolationStri ng("a", "'a'")]);
7224 ResolutionCopier.copyResolutionData(fromNode, toNode); 7910 ResolutionCopier.copyResolutionData(fromNode, toNode);
7225 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7911 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7226 JUnitTestCase.assertSame(staticType, toNode.staticType); 7912 JUnitTestCase.assertSame(staticType, toNode.staticType);
7227 } 7913 }
7914
7228 void test_visitSuperConstructorInvocation() { 7915 void test_visitSuperConstructorInvocation() {
7229 SuperConstructorInvocation fromNode = ASTFactory.superConstructorInvocation( []); 7916 SuperConstructorInvocation fromNode = ASTFactory.superConstructorInvocation( []);
7230 ConstructorElement staticElement = ElementFactory.constructorElement(Element Factory.classElement2("C", []), null); 7917 ConstructorElement staticElement = ElementFactory.constructorElement2(Elemen tFactory.classElement2("C", []), null, []);
7231 fromNode.staticElement = staticElement; 7918 fromNode.staticElement = staticElement;
7232 SuperConstructorInvocation toNode = ASTFactory.superConstructorInvocation([] ); 7919 SuperConstructorInvocation toNode = ASTFactory.superConstructorInvocation([] );
7233 ResolutionCopier.copyResolutionData(fromNode, toNode); 7920 ResolutionCopier.copyResolutionData(fromNode, toNode);
7234 JUnitTestCase.assertSame(staticElement, toNode.staticElement); 7921 JUnitTestCase.assertSame(staticElement, toNode.staticElement);
7235 } 7922 }
7923
7236 void test_visitSuperExpression() { 7924 void test_visitSuperExpression() {
7237 SuperExpression fromNode = ASTFactory.superExpression(); 7925 SuperExpression fromNode = ASTFactory.superExpression();
7238 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7926 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7239 fromNode.propagatedType = propagatedType; 7927 fromNode.propagatedType = propagatedType;
7240 Type2 staticType = ElementFactory.classElement2("C", []).type; 7928 Type2 staticType = ElementFactory.classElement2("C", []).type;
7241 fromNode.staticType = staticType; 7929 fromNode.staticType = staticType;
7242 SuperExpression toNode = ASTFactory.superExpression(); 7930 SuperExpression toNode = ASTFactory.superExpression();
7243 ResolutionCopier.copyResolutionData(fromNode, toNode); 7931 ResolutionCopier.copyResolutionData(fromNode, toNode);
7244 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7932 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7245 JUnitTestCase.assertSame(staticType, toNode.staticType); 7933 JUnitTestCase.assertSame(staticType, toNode.staticType);
7246 } 7934 }
7935
7247 void test_visitSymbolLiteral() { 7936 void test_visitSymbolLiteral() {
7248 SymbolLiteral fromNode = ASTFactory.symbolLiteral(["s"]); 7937 SymbolLiteral fromNode = ASTFactory.symbolLiteral(["s"]);
7249 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7938 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7250 fromNode.propagatedType = propagatedType; 7939 fromNode.propagatedType = propagatedType;
7251 Type2 staticType = ElementFactory.classElement2("C", []).type; 7940 Type2 staticType = ElementFactory.classElement2("C", []).type;
7252 fromNode.staticType = staticType; 7941 fromNode.staticType = staticType;
7253 SymbolLiteral toNode = ASTFactory.symbolLiteral(["s"]); 7942 SymbolLiteral toNode = ASTFactory.symbolLiteral(["s"]);
7254 ResolutionCopier.copyResolutionData(fromNode, toNode); 7943 ResolutionCopier.copyResolutionData(fromNode, toNode);
7255 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7944 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7256 JUnitTestCase.assertSame(staticType, toNode.staticType); 7945 JUnitTestCase.assertSame(staticType, toNode.staticType);
7257 } 7946 }
7947
7258 void test_visitThisExpression() { 7948 void test_visitThisExpression() {
7259 ThisExpression fromNode = ASTFactory.thisExpression(); 7949 ThisExpression fromNode = ASTFactory.thisExpression();
7260 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7950 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7261 fromNode.propagatedType = propagatedType; 7951 fromNode.propagatedType = propagatedType;
7262 Type2 staticType = ElementFactory.classElement2("C", []).type; 7952 Type2 staticType = ElementFactory.classElement2("C", []).type;
7263 fromNode.staticType = staticType; 7953 fromNode.staticType = staticType;
7264 ThisExpression toNode = ASTFactory.thisExpression(); 7954 ThisExpression toNode = ASTFactory.thisExpression();
7265 ResolutionCopier.copyResolutionData(fromNode, toNode); 7955 ResolutionCopier.copyResolutionData(fromNode, toNode);
7266 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7956 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7267 JUnitTestCase.assertSame(staticType, toNode.staticType); 7957 JUnitTestCase.assertSame(staticType, toNode.staticType);
7268 } 7958 }
7959
7269 void test_visitThrowExpression() { 7960 void test_visitThrowExpression() {
7270 ThrowExpression fromNode = ASTFactory.throwExpression(); 7961 ThrowExpression fromNode = ASTFactory.throwExpression();
7271 Type2 propagatedType = ElementFactory.classElement2("C", []).type; 7962 Type2 propagatedType = ElementFactory.classElement2("C", []).type;
7272 fromNode.propagatedType = propagatedType; 7963 fromNode.propagatedType = propagatedType;
7273 Type2 staticType = ElementFactory.classElement2("C", []).type; 7964 Type2 staticType = ElementFactory.classElement2("C", []).type;
7274 fromNode.staticType = staticType; 7965 fromNode.staticType = staticType;
7275 ThrowExpression toNode = ASTFactory.throwExpression(); 7966 ThrowExpression toNode = ASTFactory.throwExpression();
7276 ResolutionCopier.copyResolutionData(fromNode, toNode); 7967 ResolutionCopier.copyResolutionData(fromNode, toNode);
7277 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType); 7968 JUnitTestCase.assertSame(propagatedType, toNode.propagatedType);
7278 JUnitTestCase.assertSame(staticType, toNode.staticType); 7969 JUnitTestCase.assertSame(staticType, toNode.staticType);
7279 } 7970 }
7971
7280 void test_visitTypeName() { 7972 void test_visitTypeName() {
7281 TypeName fromNode = ASTFactory.typeName4("C", []); 7973 TypeName fromNode = ASTFactory.typeName4("C", []);
7282 Type2 type = ElementFactory.classElement2("C", []).type; 7974 Type2 type = ElementFactory.classElement2("C", []).type;
7283 fromNode.type = type; 7975 fromNode.type = type;
7284 TypeName toNode = ASTFactory.typeName4("C", []); 7976 TypeName toNode = ASTFactory.typeName4("C", []);
7285 ResolutionCopier.copyResolutionData(fromNode, toNode); 7977 ResolutionCopier.copyResolutionData(fromNode, toNode);
7286 JUnitTestCase.assertSame(type, toNode.type); 7978 JUnitTestCase.assertSame(type, toNode.type);
7287 } 7979 }
7980
7288 static dartSuite() { 7981 static dartSuite() {
7289 _ut.group('ResolutionCopierTest', () { 7982 _ut.group('ResolutionCopierTest', () {
7290 _ut.test('test_visitAnnotation', () { 7983 _ut.test('test_visitAnnotation', () {
7291 final __test = new ResolutionCopierTest(); 7984 final __test = new ResolutionCopierTest();
7292 runJUnitTest(__test, __test.test_visitAnnotation); 7985 runJUnitTest(__test, __test.test_visitAnnotation);
7293 }); 7986 });
7294 _ut.test('test_visitArgumentDefinitionTest', () { 7987 _ut.test('test_visitArgumentDefinitionTest', () {
7295 final __test = new ResolutionCopierTest(); 7988 final __test = new ResolutionCopierTest();
7296 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest); 7989 runJUnitTest(__test, __test.test_visitArgumentDefinitionTest);
7297 }); 7990 });
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
7459 final __test = new ResolutionCopierTest(); 8152 final __test = new ResolutionCopierTest();
7460 runJUnitTest(__test, __test.test_visitThrowExpression); 8153 runJUnitTest(__test, __test.test_visitThrowExpression);
7461 }); 8154 });
7462 _ut.test('test_visitTypeName', () { 8155 _ut.test('test_visitTypeName', () {
7463 final __test = new ResolutionCopierTest(); 8156 final __test = new ResolutionCopierTest();
7464 runJUnitTest(__test, __test.test_visitTypeName); 8157 runJUnitTest(__test, __test.test_visitTypeName);
7465 }); 8158 });
7466 }); 8159 });
7467 } 8160 }
7468 } 8161 }
8162
7469 /** 8163 /**
7470 * The class `RecoveryParserTest` defines parser tests that test the parsing of invalid code 8164 * The class `RecoveryParserTest` defines parser tests that test the parsing of invalid code
7471 * sequences to ensure that the correct recovery steps are taken in the parser. 8165 * sequences to ensure that the correct recovery steps are taken in the parser.
7472 */ 8166 */
7473 class RecoveryParserTest extends ParserTestCase { 8167 class RecoveryParserTest extends ParserTestCase {
7474 void fail_incomplete_returnType() { 8168 void fail_incomplete_returnType() {
7475 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource([ 8169 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource([
7476 "Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {", 8170 "Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {",
7477 " if (map == null) return null;", 8171 " if (map == null) return null;",
7478 " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();", 8172 " Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();",
7479 " map.forEach((name, value) {", 8173 " map.forEach((name, value) {",
7480 " result[new Symbol(name)] = value;", 8174 " result[new Symbol(name)] = value;",
7481 " });", 8175 " });",
7482 " return result;", 8176 " return result;",
7483 "}"]), []); 8177 "}"]), []);
7484 } 8178 }
8179
7485 void test_additiveExpression_missing_LHS() { 8180 void test_additiveExpression_missing_LHS() {
7486 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 8181 BinaryExpression expression = ParserTestCase.parseExpression("+ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
7487 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8182 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7488 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8183 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7489 } 8184 }
8185
7490 void test_additiveExpression_missing_LHS_RHS() { 8186 void test_additiveExpression_missing_LHS_RHS() {
7491 BinaryExpression expression = ParserTestCase.parseExpression("+", [ 8187 BinaryExpression expression = ParserTestCase.parseExpression("+", [
7492 ParserErrorCode.MISSING_IDENTIFIER, 8188 ParserErrorCode.MISSING_IDENTIFIER,
7493 ParserErrorCode.MISSING_IDENTIFIER]); 8189 ParserErrorCode.MISSING_IDENTIFIER]);
7494 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8190 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7495 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8191 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7496 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8192 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7497 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8193 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7498 } 8194 }
8195
7499 void test_additiveExpression_missing_RHS() { 8196 void test_additiveExpression_missing_RHS() {
7500 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]); 8197 BinaryExpression expression = ParserTestCase.parseExpression("x +", [ParserE rrorCode.MISSING_IDENTIFIER]);
7501 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8198 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7502 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8199 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7503 } 8200 }
8201
7504 void test_additiveExpression_missing_RHS_super() { 8202 void test_additiveExpression_missing_RHS_super() {
7505 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]); 8203 BinaryExpression expression = ParserTestCase.parseExpression("super +", [Par serErrorCode.MISSING_IDENTIFIER]);
7506 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8204 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7507 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8205 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7508 } 8206 }
8207
7509 void test_additiveExpression_precedence_multiplicative_left() { 8208 void test_additiveExpression_precedence_multiplicative_left() {
7510 BinaryExpression expression = ParserTestCase.parseExpression("* +", [ 8209 BinaryExpression expression = ParserTestCase.parseExpression("* +", [
7511 ParserErrorCode.MISSING_IDENTIFIER, 8210 ParserErrorCode.MISSING_IDENTIFIER,
7512 ParserErrorCode.MISSING_IDENTIFIER, 8211 ParserErrorCode.MISSING_IDENTIFIER,
7513 ParserErrorCode.MISSING_IDENTIFIER]); 8212 ParserErrorCode.MISSING_IDENTIFIER]);
7514 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8213 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7515 } 8214 }
8215
7516 void test_additiveExpression_precedence_multiplicative_right() { 8216 void test_additiveExpression_precedence_multiplicative_right() {
7517 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [ 8217 BinaryExpression expression = ParserTestCase.parseExpression("+ *", [
7518 ParserErrorCode.MISSING_IDENTIFIER, 8218 ParserErrorCode.MISSING_IDENTIFIER,
7519 ParserErrorCode.MISSING_IDENTIFIER, 8219 ParserErrorCode.MISSING_IDENTIFIER,
7520 ParserErrorCode.MISSING_IDENTIFIER]); 8220 ParserErrorCode.MISSING_IDENTIFIER]);
7521 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8221 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7522 } 8222 }
8223
7523 void test_additiveExpression_super() { 8224 void test_additiveExpression_super() {
7524 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [ 8225 BinaryExpression expression = ParserTestCase.parseExpression("super + +", [
7525 ParserErrorCode.MISSING_IDENTIFIER, 8226 ParserErrorCode.MISSING_IDENTIFIER,
7526 ParserErrorCode.MISSING_IDENTIFIER]); 8227 ParserErrorCode.MISSING_IDENTIFIER]);
7527 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8228 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7528 } 8229 }
8230
7529 void test_assignmentExpression_missing_compound1() { 8231 void test_assignmentExpression_missing_compound1() {
7530 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 8232 AssignmentExpression expression = ParserTestCase.parseExpression("= y = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
7531 Expression syntheticExpression = expression.leftHandSide; 8233 Expression syntheticExpression = expression.leftHandSide;
7532 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8234 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7533 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8235 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7534 } 8236 }
8237
7535 void test_assignmentExpression_missing_compound2() { 8238 void test_assignmentExpression_missing_compound2() {
7536 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]); 8239 AssignmentExpression expression = ParserTestCase.parseExpression("x = = 0", [ParserErrorCode.MISSING_IDENTIFIER]);
7537 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).leftHandSide; 8240 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).leftHandSide;
7538 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8241 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7539 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8242 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7540 } 8243 }
8244
7541 void test_assignmentExpression_missing_compound3() { 8245 void test_assignmentExpression_missing_compound3() {
7542 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]); 8246 AssignmentExpression expression = ParserTestCase.parseExpression("x = y =", [ParserErrorCode.MISSING_IDENTIFIER]);
7543 Expression syntheticExpression = ((expression.rightHandSide as AssignmentExp ression)).rightHandSide; 8247 Expression syntheticExpression = (expression.rightHandSide as AssignmentExpr ession).rightHandSide;
7544 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8248 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7545 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8249 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7546 } 8250 }
8251
7547 void test_assignmentExpression_missing_LHS() { 8252 void test_assignmentExpression_missing_LHS() {
7548 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [Par serErrorCode.MISSING_IDENTIFIER]); 8253 AssignmentExpression expression = ParserTestCase.parseExpression("= 0", [Par serErrorCode.MISSING_IDENTIFIER]);
7549 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 8254 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
7550 JUnitTestCase.assertTrue(expression.leftHandSide.isSynthetic); 8255 JUnitTestCase.assertTrue(expression.leftHandSide.isSynthetic);
7551 } 8256 }
8257
7552 void test_assignmentExpression_missing_RHS() { 8258 void test_assignmentExpression_missing_RHS() {
7553 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]); 8259 AssignmentExpression expression = ParserTestCase.parseExpression("x =", [Par serErrorCode.MISSING_IDENTIFIER]);
7554 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide); 8260 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftHandSide);
7555 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic); 8261 JUnitTestCase.assertTrue(expression.rightHandSide.isSynthetic);
7556 } 8262 }
8263
7557 void test_bitwiseAndExpression_missing_LHS() { 8264 void test_bitwiseAndExpression_missing_LHS() {
7558 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]); 8265 BinaryExpression expression = ParserTestCase.parseExpression("& y", [ParserE rrorCode.MISSING_IDENTIFIER]);
7559 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8266 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7560 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8267 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7561 } 8268 }
8269
7562 void test_bitwiseAndExpression_missing_LHS_RHS() { 8270 void test_bitwiseAndExpression_missing_LHS_RHS() {
7563 BinaryExpression expression = ParserTestCase.parseExpression("&", [ 8271 BinaryExpression expression = ParserTestCase.parseExpression("&", [
7564 ParserErrorCode.MISSING_IDENTIFIER, 8272 ParserErrorCode.MISSING_IDENTIFIER,
7565 ParserErrorCode.MISSING_IDENTIFIER]); 8273 ParserErrorCode.MISSING_IDENTIFIER]);
7566 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8274 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7567 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8275 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7568 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8276 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7569 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8277 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7570 } 8278 }
8279
7571 void test_bitwiseAndExpression_missing_RHS() { 8280 void test_bitwiseAndExpression_missing_RHS() {
7572 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]); 8281 BinaryExpression expression = ParserTestCase.parseExpression("x &", [ParserE rrorCode.MISSING_IDENTIFIER]);
7573 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8282 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7574 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8283 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7575 } 8284 }
8285
7576 void test_bitwiseAndExpression_missing_RHS_super() { 8286 void test_bitwiseAndExpression_missing_RHS_super() {
7577 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]); 8287 BinaryExpression expression = ParserTestCase.parseExpression("super &", [Par serErrorCode.MISSING_IDENTIFIER]);
7578 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8288 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7579 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8289 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7580 } 8290 }
8291
7581 void test_bitwiseAndExpression_precedence_equality_left() { 8292 void test_bitwiseAndExpression_precedence_equality_left() {
7582 BinaryExpression expression = ParserTestCase.parseExpression("== &&", [ 8293 BinaryExpression expression = ParserTestCase.parseExpression("== &&", [
7583 ParserErrorCode.MISSING_IDENTIFIER, 8294 ParserErrorCode.MISSING_IDENTIFIER,
7584 ParserErrorCode.MISSING_IDENTIFIER, 8295 ParserErrorCode.MISSING_IDENTIFIER,
7585 ParserErrorCode.MISSING_IDENTIFIER]); 8296 ParserErrorCode.MISSING_IDENTIFIER]);
7586 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8297 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7587 } 8298 }
8299
7588 void test_bitwiseAndExpression_precedence_equality_right() { 8300 void test_bitwiseAndExpression_precedence_equality_right() {
7589 BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [ 8301 BinaryExpression expression = ParserTestCase.parseExpression("&& ==", [
7590 ParserErrorCode.MISSING_IDENTIFIER, 8302 ParserErrorCode.MISSING_IDENTIFIER,
7591 ParserErrorCode.MISSING_IDENTIFIER, 8303 ParserErrorCode.MISSING_IDENTIFIER,
7592 ParserErrorCode.MISSING_IDENTIFIER]); 8304 ParserErrorCode.MISSING_IDENTIFIER]);
7593 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8305 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7594 } 8306 }
8307
7595 void test_bitwiseAndExpression_super() { 8308 void test_bitwiseAndExpression_super() {
7596 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [ 8309 BinaryExpression expression = ParserTestCase.parseExpression("super & &", [
7597 ParserErrorCode.MISSING_IDENTIFIER, 8310 ParserErrorCode.MISSING_IDENTIFIER,
7598 ParserErrorCode.MISSING_IDENTIFIER]); 8311 ParserErrorCode.MISSING_IDENTIFIER]);
7599 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8312 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7600 } 8313 }
8314
7601 void test_bitwiseOrExpression_missing_LHS() { 8315 void test_bitwiseOrExpression_missing_LHS() {
7602 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]); 8316 BinaryExpression expression = ParserTestCase.parseExpression("| y", [ParserE rrorCode.MISSING_IDENTIFIER]);
7603 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8317 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7604 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8318 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7605 } 8319 }
8320
7606 void test_bitwiseOrExpression_missing_LHS_RHS() { 8321 void test_bitwiseOrExpression_missing_LHS_RHS() {
7607 BinaryExpression expression = ParserTestCase.parseExpression("|", [ 8322 BinaryExpression expression = ParserTestCase.parseExpression("|", [
7608 ParserErrorCode.MISSING_IDENTIFIER, 8323 ParserErrorCode.MISSING_IDENTIFIER,
7609 ParserErrorCode.MISSING_IDENTIFIER]); 8324 ParserErrorCode.MISSING_IDENTIFIER]);
7610 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8325 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7611 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8326 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7612 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8327 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7613 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8328 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7614 } 8329 }
8330
7615 void test_bitwiseOrExpression_missing_RHS() { 8331 void test_bitwiseOrExpression_missing_RHS() {
7616 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]); 8332 BinaryExpression expression = ParserTestCase.parseExpression("x |", [ParserE rrorCode.MISSING_IDENTIFIER]);
7617 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8333 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7618 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8334 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7619 } 8335 }
8336
7620 void test_bitwiseOrExpression_missing_RHS_super() { 8337 void test_bitwiseOrExpression_missing_RHS_super() {
7621 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]); 8338 BinaryExpression expression = ParserTestCase.parseExpression("super |", [Par serErrorCode.MISSING_IDENTIFIER]);
7622 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8339 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7623 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8340 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7624 } 8341 }
8342
7625 void test_bitwiseOrExpression_precedence_xor_left() { 8343 void test_bitwiseOrExpression_precedence_xor_left() {
7626 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [ 8344 BinaryExpression expression = ParserTestCase.parseExpression("^ |", [
7627 ParserErrorCode.MISSING_IDENTIFIER, 8345 ParserErrorCode.MISSING_IDENTIFIER,
7628 ParserErrorCode.MISSING_IDENTIFIER, 8346 ParserErrorCode.MISSING_IDENTIFIER,
7629 ParserErrorCode.MISSING_IDENTIFIER]); 8347 ParserErrorCode.MISSING_IDENTIFIER]);
7630 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8348 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7631 } 8349 }
8350
7632 void test_bitwiseOrExpression_precedence_xor_right() { 8351 void test_bitwiseOrExpression_precedence_xor_right() {
7633 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [ 8352 BinaryExpression expression = ParserTestCase.parseExpression("| ^", [
7634 ParserErrorCode.MISSING_IDENTIFIER, 8353 ParserErrorCode.MISSING_IDENTIFIER,
7635 ParserErrorCode.MISSING_IDENTIFIER, 8354 ParserErrorCode.MISSING_IDENTIFIER,
7636 ParserErrorCode.MISSING_IDENTIFIER]); 8355 ParserErrorCode.MISSING_IDENTIFIER]);
7637 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8356 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7638 } 8357 }
8358
7639 void test_bitwiseOrExpression_super() { 8359 void test_bitwiseOrExpression_super() {
7640 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [ 8360 BinaryExpression expression = ParserTestCase.parseExpression("super | |", [
7641 ParserErrorCode.MISSING_IDENTIFIER, 8361 ParserErrorCode.MISSING_IDENTIFIER,
7642 ParserErrorCode.MISSING_IDENTIFIER]); 8362 ParserErrorCode.MISSING_IDENTIFIER]);
7643 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8363 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7644 } 8364 }
8365
7645 void test_bitwiseXorExpression_missing_LHS() { 8366 void test_bitwiseXorExpression_missing_LHS() {
7646 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]); 8367 BinaryExpression expression = ParserTestCase.parseExpression("^ y", [ParserE rrorCode.MISSING_IDENTIFIER]);
7647 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8368 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7648 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8369 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7649 } 8370 }
8371
7650 void test_bitwiseXorExpression_missing_LHS_RHS() { 8372 void test_bitwiseXorExpression_missing_LHS_RHS() {
7651 BinaryExpression expression = ParserTestCase.parseExpression("^", [ 8373 BinaryExpression expression = ParserTestCase.parseExpression("^", [
7652 ParserErrorCode.MISSING_IDENTIFIER, 8374 ParserErrorCode.MISSING_IDENTIFIER,
7653 ParserErrorCode.MISSING_IDENTIFIER]); 8375 ParserErrorCode.MISSING_IDENTIFIER]);
7654 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8376 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7655 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8377 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7656 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8378 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7657 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8379 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7658 } 8380 }
8381
7659 void test_bitwiseXorExpression_missing_RHS() { 8382 void test_bitwiseXorExpression_missing_RHS() {
7660 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]); 8383 BinaryExpression expression = ParserTestCase.parseExpression("x ^", [ParserE rrorCode.MISSING_IDENTIFIER]);
7661 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8384 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7662 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8385 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7663 } 8386 }
8387
7664 void test_bitwiseXorExpression_missing_RHS_super() { 8388 void test_bitwiseXorExpression_missing_RHS_super() {
7665 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]); 8389 BinaryExpression expression = ParserTestCase.parseExpression("super ^", [Par serErrorCode.MISSING_IDENTIFIER]);
7666 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8390 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7667 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8391 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7668 } 8392 }
8393
7669 void test_bitwiseXorExpression_precedence_and_left() { 8394 void test_bitwiseXorExpression_precedence_and_left() {
7670 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [ 8395 BinaryExpression expression = ParserTestCase.parseExpression("& ^", [
7671 ParserErrorCode.MISSING_IDENTIFIER, 8396 ParserErrorCode.MISSING_IDENTIFIER,
7672 ParserErrorCode.MISSING_IDENTIFIER, 8397 ParserErrorCode.MISSING_IDENTIFIER,
7673 ParserErrorCode.MISSING_IDENTIFIER]); 8398 ParserErrorCode.MISSING_IDENTIFIER]);
7674 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8399 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7675 } 8400 }
8401
7676 void test_bitwiseXorExpression_precedence_and_right() { 8402 void test_bitwiseXorExpression_precedence_and_right() {
7677 BinaryExpression expression = ParserTestCase.parseExpression("^ &", [ 8403 BinaryExpression expression = ParserTestCase.parseExpression("^ &", [
7678 ParserErrorCode.MISSING_IDENTIFIER, 8404 ParserErrorCode.MISSING_IDENTIFIER,
7679 ParserErrorCode.MISSING_IDENTIFIER, 8405 ParserErrorCode.MISSING_IDENTIFIER,
7680 ParserErrorCode.MISSING_IDENTIFIER]); 8406 ParserErrorCode.MISSING_IDENTIFIER]);
7681 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8407 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7682 } 8408 }
8409
7683 void test_bitwiseXorExpression_super() { 8410 void test_bitwiseXorExpression_super() {
7684 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [ 8411 BinaryExpression expression = ParserTestCase.parseExpression("super ^ ^", [
7685 ParserErrorCode.MISSING_IDENTIFIER, 8412 ParserErrorCode.MISSING_IDENTIFIER,
7686 ParserErrorCode.MISSING_IDENTIFIER]); 8413 ParserErrorCode.MISSING_IDENTIFIER]);
7687 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8414 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7688 } 8415 }
8416
7689 void test_classTypeAlias_withBody() { 8417 void test_classTypeAlias_withBody() {
7690 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["class A {} ", "class B = Object with A {}"]), [ParserErrorCode.EXPECTED_TOKEN]); 8418 ParserTestCase.parseCompilationUnit(EngineTestCase.createSource(["class A {} ", "class B = Object with A {}"]), [ParserErrorCode.EXPECTED_TOKEN]);
7691 } 8419 }
8420
7692 void test_conditionalExpression_missingElse() { 8421 void test_conditionalExpression_missingElse() {
7693 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]); 8422 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? y :", [ParserErrorCode.MISSING_IDENTIFIER]);
7694 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ; 8423 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.elseExpression) ;
7695 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic); 8424 JUnitTestCase.assertTrue(expression.elseExpression.isSynthetic);
7696 } 8425 }
8426
7697 void test_conditionalExpression_missingThen() { 8427 void test_conditionalExpression_missingThen() {
7698 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]); 8428 ConditionalExpression expression = ParserTestCase.parse5("parseConditionalEx pression", "x ? : z", [ParserErrorCode.MISSING_IDENTIFIER]);
7699 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ; 8429 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.thenExpression) ;
7700 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic); 8430 JUnitTestCase.assertTrue(expression.thenExpression.isSynthetic);
7701 } 8431 }
8432
7702 void test_equalityExpression_missing_LHS() { 8433 void test_equalityExpression_missing_LHS() {
7703 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]); 8434 BinaryExpression expression = ParserTestCase.parseExpression("== y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7704 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8435 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7705 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8436 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7706 } 8437 }
8438
7707 void test_equalityExpression_missing_LHS_RHS() { 8439 void test_equalityExpression_missing_LHS_RHS() {
7708 BinaryExpression expression = ParserTestCase.parseExpression("==", [ 8440 BinaryExpression expression = ParserTestCase.parseExpression("==", [
7709 ParserErrorCode.MISSING_IDENTIFIER, 8441 ParserErrorCode.MISSING_IDENTIFIER,
7710 ParserErrorCode.MISSING_IDENTIFIER]); 8442 ParserErrorCode.MISSING_IDENTIFIER]);
7711 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8443 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7712 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8444 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7713 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8445 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7714 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8446 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7715 } 8447 }
8448
7716 void test_equalityExpression_missing_RHS() { 8449 void test_equalityExpression_missing_RHS() {
7717 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]); 8450 BinaryExpression expression = ParserTestCase.parseExpression("x ==", [Parser ErrorCode.MISSING_IDENTIFIER]);
7718 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8451 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7719 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8452 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7720 } 8453 }
8454
7721 void test_equalityExpression_missing_RHS_super() { 8455 void test_equalityExpression_missing_RHS_super() {
7722 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]); 8456 BinaryExpression expression = ParserTestCase.parseExpression("super ==", [Pa rserErrorCode.MISSING_IDENTIFIER]);
7723 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8457 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7724 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8458 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7725 } 8459 }
8460
7726 void test_equalityExpression_precedence_relational_left() { 8461 void test_equalityExpression_precedence_relational_left() {
7727 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [ 8462 BinaryExpression expression = ParserTestCase.parseExpression("is ==", [
7728 ParserErrorCode.EXPECTED_TYPE_NAME, 8463 ParserErrorCode.EXPECTED_TYPE_NAME,
7729 ParserErrorCode.MISSING_IDENTIFIER, 8464 ParserErrorCode.MISSING_IDENTIFIER,
7730 ParserErrorCode.MISSING_IDENTIFIER]); 8465 ParserErrorCode.MISSING_IDENTIFIER]);
7731 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand); 8466 EngineTestCase.assertInstanceOf(IsExpression, expression.leftOperand);
7732 } 8467 }
8468
7733 void test_equalityExpression_precedence_relational_right() { 8469 void test_equalityExpression_precedence_relational_right() {
7734 BinaryExpression expression = ParserTestCase.parseExpression("== is", [ 8470 BinaryExpression expression = ParserTestCase.parseExpression("== is", [
7735 ParserErrorCode.EXPECTED_TYPE_NAME, 8471 ParserErrorCode.EXPECTED_TYPE_NAME,
7736 ParserErrorCode.MISSING_IDENTIFIER, 8472 ParserErrorCode.MISSING_IDENTIFIER,
7737 ParserErrorCode.MISSING_IDENTIFIER]); 8473 ParserErrorCode.MISSING_IDENTIFIER]);
7738 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand); 8474 EngineTestCase.assertInstanceOf(IsExpression, expression.rightOperand);
7739 } 8475 }
8476
7740 void test_equalityExpression_super() { 8477 void test_equalityExpression_super() {
7741 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ 8478 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
7742 ParserErrorCode.MISSING_IDENTIFIER, 8479 ParserErrorCode.MISSING_IDENTIFIER,
7743 ParserErrorCode.MISSING_IDENTIFIER, 8480 ParserErrorCode.MISSING_IDENTIFIER,
7744 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 8481 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
7745 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8482 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7746 } 8483 }
8484
7747 void test_expressionList_multiple_end() { 8485 void test_expressionList_multiple_end() {
7748 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]); 8486 List<Expression> result = ParserTestCase.parse5("parseExpressionList", ", 2, 3, 4", [ParserErrorCode.MISSING_IDENTIFIER]);
7749 EngineTestCase.assertSize(4, result); 8487 EngineTestCase.assertSize(4, result);
7750 Expression syntheticExpression = result[0]; 8488 Expression syntheticExpression = result[0];
7751 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8489 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7752 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8490 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7753 } 8491 }
8492
7754 void test_expressionList_multiple_middle() { 8493 void test_expressionList_multiple_middle() {
7755 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , , 4", [ParserErrorCode.MISSING_IDENTIFIER]); 8494 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , , 4", [ParserErrorCode.MISSING_IDENTIFIER]);
7756 EngineTestCase.assertSize(4, result); 8495 EngineTestCase.assertSize(4, result);
7757 Expression syntheticExpression = result[2]; 8496 Expression syntheticExpression = result[2];
7758 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8497 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7759 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8498 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7760 } 8499 }
8500
7761 void test_expressionList_multiple_start() { 8501 void test_expressionList_multiple_start() {
7762 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3,", [ParserErrorCode.MISSING_IDENTIFIER]); 8502 List<Expression> result = ParserTestCase.parse5("parseExpressionList", "1, 2 , 3,", [ParserErrorCode.MISSING_IDENTIFIER]);
7763 EngineTestCase.assertSize(4, result); 8503 EngineTestCase.assertSize(4, result);
7764 Expression syntheticExpression = result[3]; 8504 Expression syntheticExpression = result[3];
7765 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression); 8505 EngineTestCase.assertInstanceOf(SimpleIdentifier, syntheticExpression);
7766 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic); 8506 JUnitTestCase.assertTrue(syntheticExpression.isSynthetic);
7767 } 8507 }
8508
7768 void test_incomplete_topLevelVariable() { 8509 void test_incomplete_topLevelVariable() {
7769 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]); 8510 CompilationUnit unit = ParserTestCase.parseCompilationUnit("String", [Parser ErrorCode.EXPECTED_EXECUTABLE]);
7770 NodeList<CompilationUnitMember> declarations = unit.declarations; 8511 NodeList<CompilationUnitMember> declarations = unit.declarations;
7771 EngineTestCase.assertSize(1, declarations); 8512 EngineTestCase.assertSize(1, declarations);
7772 CompilationUnitMember member = declarations[0]; 8513 CompilationUnitMember member = declarations[0];
7773 EngineTestCase.assertInstanceOf(TopLevelVariableDeclaration, member); 8514 EngineTestCase.assertInstanceOf(TopLevelVariableDeclaration, member);
7774 NodeList<VariableDeclaration> variables = ((member as TopLevelVariableDeclar ation)).variables.variables; 8515 NodeList<VariableDeclaration> variables = (member as TopLevelVariableDeclara tion).variables.variables;
7775 EngineTestCase.assertSize(1, variables); 8516 EngineTestCase.assertSize(1, variables);
7776 SimpleIdentifier name = variables[0].name; 8517 SimpleIdentifier name = variables[0].name;
7777 JUnitTestCase.assertTrue(name.isSynthetic); 8518 JUnitTestCase.assertTrue(name.isSynthetic);
7778 } 8519 }
8520
7779 void test_isExpression_noType() { 8521 void test_isExpression_noType() {
7780 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [ 8522 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Bar<T exte nds Foo> {m(x){if (x is ) return;if (x is !)}}", [
7781 ParserErrorCode.EXPECTED_TYPE_NAME, 8523 ParserErrorCode.EXPECTED_TYPE_NAME,
7782 ParserErrorCode.EXPECTED_TYPE_NAME, 8524 ParserErrorCode.EXPECTED_TYPE_NAME,
7783 ParserErrorCode.MISSING_STATEMENT]); 8525 ParserErrorCode.MISSING_STATEMENT]);
7784 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration; 8526 ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
7785 MethodDeclaration method = declaration.members[0] as MethodDeclaration; 8527 MethodDeclaration method = declaration.members[0] as MethodDeclaration;
7786 BlockFunctionBody body = method.body as BlockFunctionBody; 8528 BlockFunctionBody body = method.body as BlockFunctionBody;
7787 IfStatement ifStatement = body.block.statements[1] as IfStatement; 8529 IfStatement ifStatement = body.block.statements[1] as IfStatement;
7788 IsExpression expression = ifStatement.condition as IsExpression; 8530 IsExpression expression = ifStatement.condition as IsExpression;
7789 JUnitTestCase.assertNotNull(expression.expression); 8531 JUnitTestCase.assertNotNull(expression.expression);
7790 JUnitTestCase.assertNotNull(expression.isOperator); 8532 JUnitTestCase.assertNotNull(expression.isOperator);
7791 JUnitTestCase.assertNotNull(expression.notOperator); 8533 JUnitTestCase.assertNotNull(expression.notOperator);
7792 TypeName type = expression.type; 8534 TypeName type = expression.type;
7793 JUnitTestCase.assertNotNull(type); 8535 JUnitTestCase.assertNotNull(type);
7794 JUnitTestCase.assertTrue(type.name.isSynthetic); 8536 JUnitTestCase.assertTrue(type.name.isSynthetic);
7795 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement); 8537 EngineTestCase.assertInstanceOf(EmptyStatement, ifStatement.thenStatement);
7796 } 8538 }
8539
7797 void test_logicalAndExpression_missing_LHS() { 8540 void test_logicalAndExpression_missing_LHS() {
7798 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]); 8541 BinaryExpression expression = ParserTestCase.parseExpression("&& y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7799 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8542 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7800 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8543 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7801 } 8544 }
8545
7802 void test_logicalAndExpression_missing_LHS_RHS() { 8546 void test_logicalAndExpression_missing_LHS_RHS() {
7803 BinaryExpression expression = ParserTestCase.parseExpression("&&", [ 8547 BinaryExpression expression = ParserTestCase.parseExpression("&&", [
7804 ParserErrorCode.MISSING_IDENTIFIER, 8548 ParserErrorCode.MISSING_IDENTIFIER,
7805 ParserErrorCode.MISSING_IDENTIFIER]); 8549 ParserErrorCode.MISSING_IDENTIFIER]);
7806 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8550 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7807 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8551 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7808 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8552 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7809 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8553 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7810 } 8554 }
8555
7811 void test_logicalAndExpression_missing_RHS() { 8556 void test_logicalAndExpression_missing_RHS() {
7812 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]); 8557 BinaryExpression expression = ParserTestCase.parseExpression("x &&", [Parser ErrorCode.MISSING_IDENTIFIER]);
7813 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8558 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7814 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8559 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7815 } 8560 }
8561
7816 void test_logicalAndExpression_precedence_bitwiseOr_left() { 8562 void test_logicalAndExpression_precedence_bitwiseOr_left() {
7817 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [ 8563 BinaryExpression expression = ParserTestCase.parseExpression("| &&", [
7818 ParserErrorCode.MISSING_IDENTIFIER, 8564 ParserErrorCode.MISSING_IDENTIFIER,
7819 ParserErrorCode.MISSING_IDENTIFIER, 8565 ParserErrorCode.MISSING_IDENTIFIER,
7820 ParserErrorCode.MISSING_IDENTIFIER]); 8566 ParserErrorCode.MISSING_IDENTIFIER]);
7821 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8567 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7822 } 8568 }
8569
7823 void test_logicalAndExpression_precedence_bitwiseOr_right() { 8570 void test_logicalAndExpression_precedence_bitwiseOr_right() {
7824 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [ 8571 BinaryExpression expression = ParserTestCase.parseExpression("&& |", [
7825 ParserErrorCode.MISSING_IDENTIFIER, 8572 ParserErrorCode.MISSING_IDENTIFIER,
7826 ParserErrorCode.MISSING_IDENTIFIER, 8573 ParserErrorCode.MISSING_IDENTIFIER,
7827 ParserErrorCode.MISSING_IDENTIFIER]); 8574 ParserErrorCode.MISSING_IDENTIFIER]);
7828 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8575 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7829 } 8576 }
8577
7830 void test_logicalOrExpression_missing_LHS() { 8578 void test_logicalOrExpression_missing_LHS() {
7831 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]); 8579 BinaryExpression expression = ParserTestCase.parseExpression("|| y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7832 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8580 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7833 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8581 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7834 } 8582 }
8583
7835 void test_logicalOrExpression_missing_LHS_RHS() { 8584 void test_logicalOrExpression_missing_LHS_RHS() {
7836 BinaryExpression expression = ParserTestCase.parseExpression("||", [ 8585 BinaryExpression expression = ParserTestCase.parseExpression("||", [
7837 ParserErrorCode.MISSING_IDENTIFIER, 8586 ParserErrorCode.MISSING_IDENTIFIER,
7838 ParserErrorCode.MISSING_IDENTIFIER]); 8587 ParserErrorCode.MISSING_IDENTIFIER]);
7839 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8588 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7840 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8589 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7841 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8590 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7842 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8591 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7843 } 8592 }
8593
7844 void test_logicalOrExpression_missing_RHS() { 8594 void test_logicalOrExpression_missing_RHS() {
7845 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]); 8595 BinaryExpression expression = ParserTestCase.parseExpression("x ||", [Parser ErrorCode.MISSING_IDENTIFIER]);
7846 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8596 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7847 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8597 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7848 } 8598 }
8599
7849 void test_logicalOrExpression_precedence_logicalAnd_left() { 8600 void test_logicalOrExpression_precedence_logicalAnd_left() {
7850 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [ 8601 BinaryExpression expression = ParserTestCase.parseExpression("&& ||", [
7851 ParserErrorCode.MISSING_IDENTIFIER, 8602 ParserErrorCode.MISSING_IDENTIFIER,
7852 ParserErrorCode.MISSING_IDENTIFIER, 8603 ParserErrorCode.MISSING_IDENTIFIER,
7853 ParserErrorCode.MISSING_IDENTIFIER]); 8604 ParserErrorCode.MISSING_IDENTIFIER]);
7854 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8605 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7855 } 8606 }
8607
7856 void test_logicalOrExpression_precedence_logicalAnd_right() { 8608 void test_logicalOrExpression_precedence_logicalAnd_right() {
7857 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [ 8609 BinaryExpression expression = ParserTestCase.parseExpression("|| &&", [
7858 ParserErrorCode.MISSING_IDENTIFIER, 8610 ParserErrorCode.MISSING_IDENTIFIER,
7859 ParserErrorCode.MISSING_IDENTIFIER, 8611 ParserErrorCode.MISSING_IDENTIFIER,
7860 ParserErrorCode.MISSING_IDENTIFIER]); 8612 ParserErrorCode.MISSING_IDENTIFIER]);
7861 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8613 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7862 } 8614 }
8615
7863 void test_multiplicativeExpression_missing_LHS() { 8616 void test_multiplicativeExpression_missing_LHS() {
7864 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]); 8617 BinaryExpression expression = ParserTestCase.parseExpression("* y", [ParserE rrorCode.MISSING_IDENTIFIER]);
7865 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8618 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7866 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8619 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7867 } 8620 }
8621
7868 void test_multiplicativeExpression_missing_LHS_RHS() { 8622 void test_multiplicativeExpression_missing_LHS_RHS() {
7869 BinaryExpression expression = ParserTestCase.parseExpression("*", [ 8623 BinaryExpression expression = ParserTestCase.parseExpression("*", [
7870 ParserErrorCode.MISSING_IDENTIFIER, 8624 ParserErrorCode.MISSING_IDENTIFIER,
7871 ParserErrorCode.MISSING_IDENTIFIER]); 8625 ParserErrorCode.MISSING_IDENTIFIER]);
7872 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8626 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7873 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8627 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7874 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8628 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7875 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8629 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7876 } 8630 }
8631
7877 void test_multiplicativeExpression_missing_RHS() { 8632 void test_multiplicativeExpression_missing_RHS() {
7878 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]); 8633 BinaryExpression expression = ParserTestCase.parseExpression("x *", [ParserE rrorCode.MISSING_IDENTIFIER]);
7879 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8634 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7880 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8635 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7881 } 8636 }
8637
7882 void test_multiplicativeExpression_missing_RHS_super() { 8638 void test_multiplicativeExpression_missing_RHS_super() {
7883 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]); 8639 BinaryExpression expression = ParserTestCase.parseExpression("super *", [Par serErrorCode.MISSING_IDENTIFIER]);
7884 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8640 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7885 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8641 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7886 } 8642 }
8643
7887 void test_multiplicativeExpression_precedence_unary_left() { 8644 void test_multiplicativeExpression_precedence_unary_left() {
7888 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]); 8645 BinaryExpression expression = ParserTestCase.parseExpression("-x *", [Parser ErrorCode.MISSING_IDENTIFIER]);
7889 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand); 8646 EngineTestCase.assertInstanceOf(PrefixExpression, expression.leftOperand);
7890 } 8647 }
8648
7891 void test_multiplicativeExpression_precedence_unary_right() { 8649 void test_multiplicativeExpression_precedence_unary_right() {
7892 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]); 8650 BinaryExpression expression = ParserTestCase.parseExpression("* -y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7893 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand); 8651 EngineTestCase.assertInstanceOf(PrefixExpression, expression.rightOperand);
7894 } 8652 }
8653
7895 void test_multiplicativeExpression_super() { 8654 void test_multiplicativeExpression_super() {
7896 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [ 8655 BinaryExpression expression = ParserTestCase.parseExpression("super == ==", [
7897 ParserErrorCode.MISSING_IDENTIFIER, 8656 ParserErrorCode.MISSING_IDENTIFIER,
7898 ParserErrorCode.MISSING_IDENTIFIER, 8657 ParserErrorCode.MISSING_IDENTIFIER,
7899 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]); 8658 ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND]);
7900 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8659 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7901 } 8660 }
8661
7902 void test_prefixExpression_missing_operand_minus() { 8662 void test_prefixExpression_missing_operand_minus() {
7903 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]); 8663 PrefixExpression expression = ParserTestCase.parseExpression("-", [ParserErr orCode.MISSING_IDENTIFIER]);
7904 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand); 8664 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.operand);
7905 JUnitTestCase.assertTrue(expression.operand.isSynthetic); 8665 JUnitTestCase.assertTrue(expression.operand.isSynthetic);
7906 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type); 8666 JUnitTestCase.assertEquals(TokenType.MINUS, expression.operator.type);
7907 } 8667 }
8668
7908 void test_relationalExpression_missing_LHS() { 8669 void test_relationalExpression_missing_LHS() {
7909 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]); 8670 IsExpression expression = ParserTestCase.parseExpression("is y", [ParserErro rCode.MISSING_IDENTIFIER]);
7910 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 8671 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
7911 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 8672 JUnitTestCase.assertTrue(expression.expression.isSynthetic);
7912 } 8673 }
8674
7913 void test_relationalExpression_missing_LHS_RHS() { 8675 void test_relationalExpression_missing_LHS_RHS() {
7914 IsExpression expression = ParserTestCase.parseExpression("is", [ 8676 IsExpression expression = ParserTestCase.parseExpression("is", [
7915 ParserErrorCode.EXPECTED_TYPE_NAME, 8677 ParserErrorCode.EXPECTED_TYPE_NAME,
7916 ParserErrorCode.MISSING_IDENTIFIER]); 8678 ParserErrorCode.MISSING_IDENTIFIER]);
7917 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression); 8679 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.expression);
7918 JUnitTestCase.assertTrue(expression.expression.isSynthetic); 8680 JUnitTestCase.assertTrue(expression.expression.isSynthetic);
7919 EngineTestCase.assertInstanceOf(TypeName, expression.type); 8681 EngineTestCase.assertInstanceOf(TypeName, expression.type);
7920 JUnitTestCase.assertTrue(expression.type.isSynthetic); 8682 JUnitTestCase.assertTrue(expression.type.isSynthetic);
7921 } 8683 }
8684
7922 void test_relationalExpression_missing_RHS() { 8685 void test_relationalExpression_missing_RHS() {
7923 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]); 8686 IsExpression expression = ParserTestCase.parseExpression("x is", [ParserErro rCode.EXPECTED_TYPE_NAME]);
7924 EngineTestCase.assertInstanceOf(TypeName, expression.type); 8687 EngineTestCase.assertInstanceOf(TypeName, expression.type);
7925 JUnitTestCase.assertTrue(expression.type.isSynthetic); 8688 JUnitTestCase.assertTrue(expression.type.isSynthetic);
7926 } 8689 }
8690
7927 void test_relationalExpression_precedence_shift_right() { 8691 void test_relationalExpression_precedence_shift_right() {
7928 IsExpression expression = ParserTestCase.parseExpression("<< is", [ 8692 IsExpression expression = ParserTestCase.parseExpression("<< is", [
7929 ParserErrorCode.EXPECTED_TYPE_NAME, 8693 ParserErrorCode.EXPECTED_TYPE_NAME,
7930 ParserErrorCode.MISSING_IDENTIFIER, 8694 ParserErrorCode.MISSING_IDENTIFIER,
7931 ParserErrorCode.MISSING_IDENTIFIER]); 8695 ParserErrorCode.MISSING_IDENTIFIER]);
7932 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression); 8696 EngineTestCase.assertInstanceOf(BinaryExpression, expression.expression);
7933 } 8697 }
8698
7934 void test_shiftExpression_missing_LHS() { 8699 void test_shiftExpression_missing_LHS() {
7935 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]); 8700 BinaryExpression expression = ParserTestCase.parseExpression("<< y", [Parser ErrorCode.MISSING_IDENTIFIER]);
7936 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8701 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7937 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8702 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7938 } 8703 }
8704
7939 void test_shiftExpression_missing_LHS_RHS() { 8705 void test_shiftExpression_missing_LHS_RHS() {
7940 BinaryExpression expression = ParserTestCase.parseExpression("<<", [ 8706 BinaryExpression expression = ParserTestCase.parseExpression("<<", [
7941 ParserErrorCode.MISSING_IDENTIFIER, 8707 ParserErrorCode.MISSING_IDENTIFIER,
7942 ParserErrorCode.MISSING_IDENTIFIER]); 8708 ParserErrorCode.MISSING_IDENTIFIER]);
7943 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand); 8709 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.leftOperand);
7944 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic); 8710 JUnitTestCase.assertTrue(expression.leftOperand.isSynthetic);
7945 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8711 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7946 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8712 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7947 } 8713 }
8714
7948 void test_shiftExpression_missing_RHS() { 8715 void test_shiftExpression_missing_RHS() {
7949 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]); 8716 BinaryExpression expression = ParserTestCase.parseExpression("x <<", [Parser ErrorCode.MISSING_IDENTIFIER]);
7950 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8717 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7951 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8718 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7952 } 8719 }
8720
7953 void test_shiftExpression_missing_RHS_super() { 8721 void test_shiftExpression_missing_RHS_super() {
7954 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]); 8722 BinaryExpression expression = ParserTestCase.parseExpression("super <<", [Pa rserErrorCode.MISSING_IDENTIFIER]);
7955 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand); 8723 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression.rightOperand);
7956 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic); 8724 JUnitTestCase.assertTrue(expression.rightOperand.isSynthetic);
7957 } 8725 }
8726
7958 void test_shiftExpression_precedence_unary_left() { 8727 void test_shiftExpression_precedence_unary_left() {
7959 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [ 8728 BinaryExpression expression = ParserTestCase.parseExpression("+ <<", [
7960 ParserErrorCode.MISSING_IDENTIFIER, 8729 ParserErrorCode.MISSING_IDENTIFIER,
7961 ParserErrorCode.MISSING_IDENTIFIER, 8730 ParserErrorCode.MISSING_IDENTIFIER,
7962 ParserErrorCode.MISSING_IDENTIFIER]); 8731 ParserErrorCode.MISSING_IDENTIFIER]);
7963 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8732 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7964 } 8733 }
8734
7965 void test_shiftExpression_precedence_unary_right() { 8735 void test_shiftExpression_precedence_unary_right() {
7966 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [ 8736 BinaryExpression expression = ParserTestCase.parseExpression("<< +", [
7967 ParserErrorCode.MISSING_IDENTIFIER, 8737 ParserErrorCode.MISSING_IDENTIFIER,
7968 ParserErrorCode.MISSING_IDENTIFIER, 8738 ParserErrorCode.MISSING_IDENTIFIER,
7969 ParserErrorCode.MISSING_IDENTIFIER]); 8739 ParserErrorCode.MISSING_IDENTIFIER]);
7970 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand); 8740 EngineTestCase.assertInstanceOf(BinaryExpression, expression.rightOperand);
7971 } 8741 }
8742
7972 void test_shiftExpression_super() { 8743 void test_shiftExpression_super() {
7973 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [ 8744 BinaryExpression expression = ParserTestCase.parseExpression("super << <<", [
7974 ParserErrorCode.MISSING_IDENTIFIER, 8745 ParserErrorCode.MISSING_IDENTIFIER,
7975 ParserErrorCode.MISSING_IDENTIFIER]); 8746 ParserErrorCode.MISSING_IDENTIFIER]);
7976 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand); 8747 EngineTestCase.assertInstanceOf(BinaryExpression, expression.leftOperand);
7977 } 8748 }
8749
7978 void test_typedef_eof() { 8750 void test_typedef_eof() {
7979 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [ 8751 CompilationUnit unit = ParserTestCase.parseCompilationUnit("typedef n", [
7980 ParserErrorCode.EXPECTED_TOKEN, 8752 ParserErrorCode.EXPECTED_TOKEN,
7981 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]); 8753 ParserErrorCode.MISSING_TYPEDEF_PARAMETERS]);
7982 NodeList<CompilationUnitMember> declarations = unit.declarations; 8754 NodeList<CompilationUnitMember> declarations = unit.declarations;
7983 EngineTestCase.assertSize(1, declarations); 8755 EngineTestCase.assertSize(1, declarations);
7984 CompilationUnitMember member = declarations[0]; 8756 CompilationUnitMember member = declarations[0];
7985 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member); 8757 EngineTestCase.assertInstanceOf(FunctionTypeAlias, member);
7986 } 8758 }
8759
7987 static dartSuite() { 8760 static dartSuite() {
7988 _ut.group('RecoveryParserTest', () { 8761 _ut.group('RecoveryParserTest', () {
7989 _ut.test('test_additiveExpression_missing_LHS', () { 8762 _ut.test('test_additiveExpression_missing_LHS', () {
7990 final __test = new RecoveryParserTest(); 8763 final __test = new RecoveryParserTest();
7991 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS); 8764 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS);
7992 }); 8765 });
7993 _ut.test('test_additiveExpression_missing_LHS_RHS', () { 8766 _ut.test('test_additiveExpression_missing_LHS_RHS', () {
7994 final __test = new RecoveryParserTest(); 8767 final __test = new RecoveryParserTest();
7995 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS_RHS); 8768 runJUnitTest(__test, __test.test_additiveExpression_missing_LHS_RHS);
7996 }); 8769 });
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
8294 final __test = new RecoveryParserTest(); 9067 final __test = new RecoveryParserTest();
8295 runJUnitTest(__test, __test.test_shiftExpression_super); 9068 runJUnitTest(__test, __test.test_shiftExpression_super);
8296 }); 9069 });
8297 _ut.test('test_typedef_eof', () { 9070 _ut.test('test_typedef_eof', () {
8298 final __test = new RecoveryParserTest(); 9071 final __test = new RecoveryParserTest();
8299 runJUnitTest(__test, __test.test_typedef_eof); 9072 runJUnitTest(__test, __test.test_typedef_eof);
8300 }); 9073 });
8301 }); 9074 });
8302 } 9075 }
8303 } 9076 }
9077
8304 class IncrementalParserTest extends EngineTestCase { 9078 class IncrementalParserTest extends EngineTestCase {
8305 void fail_reparse_oneFunctionToTwo() { 9079 void fail_reparse_oneFunctionToTwo() {
8306 assertParse("f() {}", "f() => 0; g() {}"); 9080 assertParse("f() {}", "f() => 0; g() {}");
8307 } 9081 }
9082
8308 void test_reparse_addedAfterIdentifier1() { 9083 void test_reparse_addedAfterIdentifier1() {
8309 assertParse("f() => a + b;", "f() => abs + b;"); 9084 assertParse("f() => a + b;", "f() => abs + b;");
8310 } 9085 }
9086
8311 void test_reparse_addedAfterIdentifier2() { 9087 void test_reparse_addedAfterIdentifier2() {
8312 assertParse("f() => a + b;", "f() => a + bar;"); 9088 assertParse("f() => a + b;", "f() => a + bar;");
8313 } 9089 }
9090
8314 void test_resparse_addedBeforeIdentifier1() { 9091 void test_resparse_addedBeforeIdentifier1() {
8315 assertParse("f() => a + b;", "f() => xa + b;"); 9092 assertParse("f() => a + b;", "f() => xa + b;");
8316 } 9093 }
9094
8317 void test_resparse_addedBeforeIdentifier2() { 9095 void test_resparse_addedBeforeIdentifier2() {
8318 assertParse("f() => a + b;", "f() => a + xb;"); 9096 assertParse("f() => a + b;", "f() => a + xb;");
8319 } 9097 }
9098
8320 void test_resparse_addedNewIdentifier1() { 9099 void test_resparse_addedNewIdentifier1() {
8321 assertParse("a; c;", "a; b c;"); 9100 assertParse("a; c;", "a; b c;");
8322 } 9101 }
9102
8323 void test_resparse_addedNewIdentifier2() { 9103 void test_resparse_addedNewIdentifier2() {
8324 assertParse("a; c;", "a;b c;"); 9104 assertParse("a; c;", "a;b c;");
8325 } 9105 }
9106
8326 void test_resparse_appendWhitespace1() { 9107 void test_resparse_appendWhitespace1() {
8327 assertParse("f() => a + b;", "f() => a + b; "); 9108 assertParse("f() => a + b;", "f() => a + b; ");
8328 } 9109 }
9110
8329 void test_resparse_appendWhitespace2() { 9111 void test_resparse_appendWhitespace2() {
8330 assertParse("f() => a + b;", "f() => a + b; "); 9112 assertParse("f() => a + b;", "f() => a + b; ");
8331 } 9113 }
9114
8332 void test_resparse_insertedPeriod() { 9115 void test_resparse_insertedPeriod() {
8333 assertParse("f() => a + b;", "f() => a + b.;"); 9116 assertParse("f() => a + b;", "f() => a + b.;");
8334 } 9117 }
9118
8335 void test_resparse_insertWhitespace() { 9119 void test_resparse_insertWhitespace() {
8336 assertParse("f() => a + b;", "f() => a + b;"); 9120 assertParse("f() => a + b;", "f() => a + b;");
8337 } 9121 }
9122
8338 void assertParse(String originalContents, String modifiedContents) { 9123 void assertParse(String originalContents, String modifiedContents) {
8339 int originalLength = originalContents.length; 9124 int originalLength = originalContents.length;
8340 int modifiedLength = modifiedContents.length; 9125 int modifiedLength = modifiedContents.length;
8341 int replaceStart = 0; 9126 int replaceStart = 0;
8342 while (replaceStart < originalLength && replaceStart < modifiedLength && ori ginalContents.codeUnitAt(replaceStart) == modifiedContents.codeUnitAt(replaceSta rt)) { 9127 while (replaceStart < originalLength && replaceStart < modifiedLength && ori ginalContents.codeUnitAt(replaceStart) == modifiedContents.codeUnitAt(replaceSta rt)) {
8343 replaceStart++; 9128 replaceStart++;
8344 } 9129 }
8345 int lengthDelta = modifiedLength - originalLength; 9130 int lengthDelta = modifiedLength - originalLength;
8346 int originalEnd = originalLength - 1; 9131 int originalEnd = originalLength - 1;
8347 int modifiedEnd = modifiedLength - 1; 9132 int modifiedEnd = modifiedLength - 1;
(...skipping 18 matching lines...) Expand all
8366 JUnitTestCase.assertNotNull(modifiedUnit); 9151 JUnitTestCase.assertNotNull(modifiedUnit);
8367 GatheringErrorListener incrementalListener = new GatheringErrorListener(); 9152 GatheringErrorListener incrementalListener = new GatheringErrorListener();
8368 IncrementalScanner incrementalScanner = new IncrementalScanner(source, new C harSequenceReader(new CharSequence(modifiedContents)), incrementalListener); 9153 IncrementalScanner incrementalScanner = new IncrementalScanner(source, new C harSequenceReader(new CharSequence(modifiedContents)), incrementalListener);
8369 Token incrementalToken = incrementalScanner.rescan(originalToken, replaceSta rt, originalEnd - replaceStart + 1, modifiedEnd - replaceStart + 1); 9154 Token incrementalToken = incrementalScanner.rescan(originalToken, replaceSta rt, originalEnd - replaceStart + 1, modifiedEnd - replaceStart + 1);
8370 JUnitTestCase.assertNotNull(incrementalToken); 9155 JUnitTestCase.assertNotNull(incrementalToken);
8371 IncrementalParser incrementalParser = new IncrementalParser(source, incremen talScanner.tokenMap, incrementalListener); 9156 IncrementalParser incrementalParser = new IncrementalParser(source, incremen talScanner.tokenMap, incrementalListener);
8372 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in crementalScanner.firstToken, incrementalScanner.lastToken, replaceStart, origina lEnd); 9157 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in crementalScanner.firstToken, incrementalScanner.lastToken, replaceStart, origina lEnd);
8373 JUnitTestCase.assertNotNull(incrementalUnit); 9158 JUnitTestCase.assertNotNull(incrementalUnit);
8374 JUnitTestCase.assertTrue(ASTComparator.equals3(modifiedUnit, incrementalUnit )); 9159 JUnitTestCase.assertTrue(ASTComparator.equals3(modifiedUnit, incrementalUnit ));
8375 } 9160 }
9161
8376 static dartSuite() { 9162 static dartSuite() {
8377 _ut.group('IncrementalParserTest', () { 9163 _ut.group('IncrementalParserTest', () {
8378 _ut.test('test_reparse_addedAfterIdentifier1', () { 9164 _ut.test('test_reparse_addedAfterIdentifier1', () {
8379 final __test = new IncrementalParserTest(); 9165 final __test = new IncrementalParserTest();
8380 runJUnitTest(__test, __test.test_reparse_addedAfterIdentifier1); 9166 runJUnitTest(__test, __test.test_reparse_addedAfterIdentifier1);
8381 }); 9167 });
8382 _ut.test('test_reparse_addedAfterIdentifier2', () { 9168 _ut.test('test_reparse_addedAfterIdentifier2', () {
8383 final __test = new IncrementalParserTest(); 9169 final __test = new IncrementalParserTest();
8384 runJUnitTest(__test, __test.test_reparse_addedAfterIdentifier2); 9170 runJUnitTest(__test, __test.test_reparse_addedAfterIdentifier2);
8385 }); 9171 });
(...skipping 25 matching lines...) Expand all
8411 final __test = new IncrementalParserTest(); 9197 final __test = new IncrementalParserTest();
8412 runJUnitTest(__test, __test.test_resparse_insertWhitespace); 9198 runJUnitTest(__test, __test.test_resparse_insertWhitespace);
8413 }); 9199 });
8414 _ut.test('test_resparse_insertedPeriod', () { 9200 _ut.test('test_resparse_insertedPeriod', () {
8415 final __test = new IncrementalParserTest(); 9201 final __test = new IncrementalParserTest();
8416 runJUnitTest(__test, __test.test_resparse_insertedPeriod); 9202 runJUnitTest(__test, __test.test_resparse_insertedPeriod);
8417 }); 9203 });
8418 }); 9204 });
8419 } 9205 }
8420 } 9206 }
9207
8421 /** 9208 /**
8422 * The class `ErrorParserTest` defines parser tests that test the parsing of cod e to ensure 9209 * The class `ErrorParserTest` defines parser tests that test the parsing of cod e to ensure
8423 * that errors are correctly reported, and in some cases, not reported. 9210 * that errors are correctly reported, and in some cases, not reported.
8424 */ 9211 */
8425 class ErrorParserTest extends ParserTestCase { 9212 class ErrorParserTest extends ParserTestCase {
8426 void fail_expectedListOrMapLiteral() { 9213 void fail_expectedListOrMapLiteral() {
8427 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]); 9214 TypedLiteral literal = ParserTestCase.parse4("parseListOrMapLiteral", <Objec t> [null], "1", [ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL]);
8428 JUnitTestCase.assertTrue(literal.isSynthetic); 9215 JUnitTestCase.assertTrue(literal.isSynthetic);
8429 } 9216 }
9217
8430 void fail_illegalAssignmentToNonAssignable_superAssigned() { 9218 void fail_illegalAssignmentToNonAssignable_superAssigned() {
8431 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN MENT_TO_NON_ASSIGNABLE]); 9219 ParserTestCase.parseExpression("super = x;", [ParserErrorCode.ILLEGAL_ASSIGN MENT_TO_NON_ASSIGNABLE]);
8432 } 9220 }
9221
8433 void fail_invalidCommentReference__new_nonIdentifier() { 9222 void fail_invalidCommentReference__new_nonIdentifier() {
8434 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [ ParserErrorCode.INVALID_COMMENT_REFERENCE]); 9223 ParserTestCase.parse4("parseCommentReference", <Object> ["new 42", 0], "", [ ParserErrorCode.INVALID_COMMENT_REFERENCE]);
8435 } 9224 }
9225
8436 void fail_invalidCommentReference__new_tooMuch() { 9226 void fail_invalidCommentReference__new_tooMuch() {
8437 ParserTestCase.parse4("parseCommentReference", <Object> ["new a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]); 9227 ParserTestCase.parse4("parseCommentReference", <Object> ["new a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
8438 } 9228 }
9229
8439 void fail_invalidCommentReference__nonNew_nonIdentifier() { 9230 void fail_invalidCommentReference__nonNew_nonIdentifier() {
8440 ParserTestCase.parse4("parseCommentReference", <Object> ["42", 0], "", [Pars erErrorCode.INVALID_COMMENT_REFERENCE]); 9231 ParserTestCase.parse4("parseCommentReference", <Object> ["42", 0], "", [Pars erErrorCode.INVALID_COMMENT_REFERENCE]);
8441 } 9232 }
9233
8442 void fail_invalidCommentReference__nonNew_tooMuch() { 9234 void fail_invalidCommentReference__nonNew_tooMuch() {
8443 ParserTestCase.parse4("parseCommentReference", <Object> ["a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]); 9235 ParserTestCase.parse4("parseCommentReference", <Object> ["a.b.c.d", 0], "", [ParserErrorCode.INVALID_COMMENT_REFERENCE]);
8444 } 9236 }
9237
8445 void fail_missingClosingParenthesis() { 9238 void fail_missingClosingParenthesis() {
8446 ParserTestCase.parse5("parseFormalParameterList", "(int a, int b ;", [Parser ErrorCode.MISSING_CLOSING_PARENTHESIS]); 9239 ParserTestCase.parse5("parseFormalParameterList", "(int a, int b ;", [Parser ErrorCode.MISSING_CLOSING_PARENTHESIS]);
8447 } 9240 }
9241
8448 void fail_missingFunctionParameters_local_nonVoid_block() { 9242 void fail_missingFunctionParameters_local_nonVoid_block() {
8449 ParserTestCase.parseStatement("int f { return x;}", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]); 9243 ParserTestCase.parseStatement("int f { return x;}", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]);
8450 } 9244 }
9245
8451 void fail_missingFunctionParameters_local_nonVoid_expression() { 9246 void fail_missingFunctionParameters_local_nonVoid_expression() {
8452 ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTI ON_PARAMETERS]); 9247 ParserTestCase.parseStatement("int f => x;", [ParserErrorCode.MISSING_FUNCTI ON_PARAMETERS]);
8453 } 9248 }
9249
8454 void fail_namedFunctionExpression() { 9250 void fail_namedFunctionExpression() {
8455 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]); 9251 Expression expression = ParserTestCase.parse5("parsePrimaryExpression", "f() {}", [ParserErrorCode.NAMED_FUNCTION_EXPRESSION]);
8456 EngineTestCase.assertInstanceOf(FunctionExpression, expression); 9252 EngineTestCase.assertInstanceOf(FunctionExpression, expression);
8457 } 9253 }
9254
8458 void fail_unexpectedToken_invalidPostfixExpression() { 9255 void fail_unexpectedToken_invalidPostfixExpression() {
8459 ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]); 9256 ParserTestCase.parseExpression("f()++", [ParserErrorCode.UNEXPECTED_TOKEN]);
8460 } 9257 }
9258
8461 void fail_varAndType_local() { 9259 void fail_varAndType_local() {
8462 ParserTestCase.parseStatement("var int x;", [ParserErrorCode.VAR_AND_TYPE]); 9260 ParserTestCase.parseStatement("var int x;", [ParserErrorCode.VAR_AND_TYPE]);
8463 } 9261 }
9262
8464 void fail_varAndType_parameter() { 9263 void fail_varAndType_parameter() {
8465 ParserTestCase.parse5("parseFormalParameterList", "(var int x)", [ParserErro rCode.VAR_AND_TYPE]); 9264 ParserTestCase.parse5("parseFormalParameterList", "(var int x)", [ParserErro rCode.VAR_AND_TYPE]);
8466 } 9265 }
9266
8467 void test_abstractClassMember_constructor() { 9267 void test_abstractClassMember_constructor() {
8468 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 9268 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C.c();", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
8469 } 9269 }
9270
8470 void test_abstractClassMember_field() { 9271 void test_abstractClassMember_field() {
8471 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C f;", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 9272 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract C f;", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
8472 } 9273 }
9274
8473 void test_abstractClassMember_getter() { 9275 void test_abstractClassMember_getter() {
8474 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract get m;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 9276 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract get m;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
8475 } 9277 }
9278
8476 void test_abstractClassMember_method() { 9279 void test_abstractClassMember_method() {
8477 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract m();", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 9280 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract m();", [ ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
8478 } 9281 }
9282
8479 void test_abstractClassMember_setter() { 9283 void test_abstractClassMember_setter() {
8480 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract set m(v) ;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]); 9284 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "abstract set m(v) ;", [ParserErrorCode.ABSTRACT_CLASS_MEMBER]);
8481 } 9285 }
9286
8482 void test_abstractTopLevelFunction_function() { 9287 void test_abstractTopLevelFunction_function() {
8483 ParserTestCase.parseCompilationUnit("abstract f(v) {}", [ParserErrorCode.ABS TRACT_TOP_LEVEL_FUNCTION]); 9288 ParserTestCase.parseCompilationUnit("abstract f(v) {}", [ParserErrorCode.ABS TRACT_TOP_LEVEL_FUNCTION]);
8484 } 9289 }
9290
8485 void test_abstractTopLevelFunction_getter() { 9291 void test_abstractTopLevelFunction_getter() {
8486 ParserTestCase.parseCompilationUnit("abstract get m {}", [ParserErrorCode.AB STRACT_TOP_LEVEL_FUNCTION]); 9292 ParserTestCase.parseCompilationUnit("abstract get m {}", [ParserErrorCode.AB STRACT_TOP_LEVEL_FUNCTION]);
8487 } 9293 }
9294
8488 void test_abstractTopLevelFunction_setter() { 9295 void test_abstractTopLevelFunction_setter() {
8489 ParserTestCase.parseCompilationUnit("abstract set m(v) {}", [ParserErrorCode .ABSTRACT_TOP_LEVEL_FUNCTION]); 9296 ParserTestCase.parseCompilationUnit("abstract set m(v) {}", [ParserErrorCode .ABSTRACT_TOP_LEVEL_FUNCTION]);
8490 } 9297 }
9298
8491 void test_abstractTopLevelVariable() { 9299 void test_abstractTopLevelVariable() {
8492 ParserTestCase.parseCompilationUnit("abstract C f;", [ParserErrorCode.ABSTRA CT_TOP_LEVEL_VARIABLE]); 9300 ParserTestCase.parseCompilationUnit("abstract C f;", [ParserErrorCode.ABSTRA CT_TOP_LEVEL_VARIABLE]);
8493 } 9301 }
9302
8494 void test_abstractTypeDef() { 9303 void test_abstractTypeDef() {
8495 ParserTestCase.parseCompilationUnit("abstract typedef F();", [ParserErrorCod e.ABSTRACT_TYPEDEF]); 9304 ParserTestCase.parseCompilationUnit("abstract typedef F();", [ParserErrorCod e.ABSTRACT_TYPEDEF]);
8496 } 9305 }
9306
8497 void test_assertDoesNotTakeAssignment() { 9307 void test_assertDoesNotTakeAssignment() {
8498 ParserTestCase.parse5("parseAssertStatement", "assert(b = true);", [ParserEr rorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT]); 9308 ParserTestCase.parse5("parseAssertStatement", "assert(b = true);", [ParserEr rorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT]);
8499 } 9309 }
9310
8500 void test_assertDoesNotTakeCascades() { 9311 void test_assertDoesNotTakeCascades() {
8501 ParserTestCase.parse5("parseAssertStatement", "assert(new A()..m());", [Pars erErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE]); 9312 ParserTestCase.parse5("parseAssertStatement", "assert(new A()..m());", [Pars erErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE]);
8502 } 9313 }
9314
8503 void test_assertDoesNotTakeRethrow() { 9315 void test_assertDoesNotTakeRethrow() {
8504 ParserTestCase.parse5("parseAssertStatement", "assert(rethrow);", [ParserErr orCode.ASSERT_DOES_NOT_TAKE_RETHROW]); 9316 ParserTestCase.parse5("parseAssertStatement", "assert(rethrow);", [ParserErr orCode.ASSERT_DOES_NOT_TAKE_RETHROW]);
8505 } 9317 }
9318
8506 void test_assertDoesNotTakeThrow() { 9319 void test_assertDoesNotTakeThrow() {
8507 ParserTestCase.parse5("parseAssertStatement", "assert(throw x);", [ParserErr orCode.ASSERT_DOES_NOT_TAKE_THROW]); 9320 ParserTestCase.parse5("parseAssertStatement", "assert(throw x);", [ParserErr orCode.ASSERT_DOES_NOT_TAKE_THROW]);
8508 } 9321 }
9322
8509 void test_breakOutsideOfLoop_breakInDoStatement() { 9323 void test_breakOutsideOfLoop_breakInDoStatement() {
8510 ParserTestCase.parse5("parseDoStatement", "do {break;} while (x);", []); 9324 ParserTestCase.parse5("parseDoStatement", "do {break;} while (x);", []);
8511 } 9325 }
9326
8512 void test_breakOutsideOfLoop_breakInForStatement() { 9327 void test_breakOutsideOfLoop_breakInForStatement() {
8513 ParserTestCase.parse5("parseForStatement", "for (; x;) {break;}", []); 9328 ParserTestCase.parse5("parseForStatement", "for (; x;) {break;}", []);
8514 } 9329 }
9330
8515 void test_breakOutsideOfLoop_breakInIfStatement() { 9331 void test_breakOutsideOfLoop_breakInIfStatement() {
8516 ParserTestCase.parse5("parseIfStatement", "if (x) {break;}", [ParserErrorCod e.BREAK_OUTSIDE_OF_LOOP]); 9332 ParserTestCase.parse5("parseIfStatement", "if (x) {break;}", [ParserErrorCod e.BREAK_OUTSIDE_OF_LOOP]);
8517 } 9333 }
9334
8518 void test_breakOutsideOfLoop_breakInSwitchStatement() { 9335 void test_breakOutsideOfLoop_breakInSwitchStatement() {
8519 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: break;}", []); 9336 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: break;}", []);
8520 } 9337 }
9338
8521 void test_breakOutsideOfLoop_breakInWhileStatement() { 9339 void test_breakOutsideOfLoop_breakInWhileStatement() {
8522 ParserTestCase.parse5("parseWhileStatement", "while (x) {break;}", []); 9340 ParserTestCase.parse5("parseWhileStatement", "while (x) {break;}", []);
8523 } 9341 }
9342
8524 void test_breakOutsideOfLoop_functionExpression_inALoop() { 9343 void test_breakOutsideOfLoop_functionExpression_inALoop() {
8525 ParserTestCase.parseStatement("for(; x;) {() {break;};}", [ParserErrorCode.B REAK_OUTSIDE_OF_LOOP]); 9344 ParserTestCase.parseStatement("for(; x;) {() {break;};}", [ParserErrorCode.B REAK_OUTSIDE_OF_LOOP]);
8526 } 9345 }
9346
8527 void test_breakOutsideOfLoop_functionExpression_withALoop() { 9347 void test_breakOutsideOfLoop_functionExpression_withALoop() {
8528 ParserTestCase.parseStatement("() {for (; x;) {break;}};", []); 9348 ParserTestCase.parseStatement("() {for (; x;) {break;}};", []);
8529 } 9349 }
9350
8530 void test_constAndFinal() { 9351 void test_constAndFinal() {
8531 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const final int x ;", [ParserErrorCode.CONST_AND_FINAL]); 9352 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const final int x ;", [ParserErrorCode.CONST_AND_FINAL]);
8532 } 9353 }
9354
8533 void test_constAndVar() { 9355 void test_constAndVar() {
8534 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const var x;", [P arserErrorCode.CONST_AND_VAR]); 9356 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const var x;", [P arserErrorCode.CONST_AND_VAR]);
8535 } 9357 }
9358
8536 void test_constClass() { 9359 void test_constClass() {
8537 ParserTestCase.parseCompilationUnit("const class C {}", [ParserErrorCode.CON ST_CLASS]); 9360 ParserTestCase.parseCompilationUnit("const class C {}", [ParserErrorCode.CON ST_CLASS]);
8538 } 9361 }
9362
8539 void test_constConstructorWithBody() { 9363 void test_constConstructorWithBody() {
8540 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const C() {}", [P arserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]); 9364 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const C() {}", [P arserErrorCode.CONST_CONSTRUCTOR_WITH_BODY]);
8541 } 9365 }
9366
8542 void test_constFactory() { 9367 void test_constFactory() {
8543 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const factory C() {}", [ParserErrorCode.CONST_FACTORY]); 9368 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const factory C() {}", [ParserErrorCode.CONST_FACTORY]);
8544 } 9369 }
9370
8545 void test_constMethod() { 9371 void test_constMethod() {
8546 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const int m() {}" , [ParserErrorCode.CONST_METHOD]); 9372 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const int m() {}" , [ParserErrorCode.CONST_METHOD]);
8547 } 9373 }
9374
8548 void test_constructorWithReturnType() { 9375 void test_constructorWithReturnType() {
8549 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C C() {}", [Parse rErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]); 9376 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C C() {}", [Parse rErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
8550 } 9377 }
9378
8551 void test_constructorWithReturnType_var() { 9379 void test_constructorWithReturnType_var() {
8552 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var C() {}", [Par serErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]); 9380 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var C() {}", [Par serErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE]);
8553 } 9381 }
9382
8554 void test_constTypedef() { 9383 void test_constTypedef() {
8555 ParserTestCase.parseCompilationUnit("const typedef F();", [ParserErrorCode.C ONST_TYPEDEF]); 9384 ParserTestCase.parseCompilationUnit("const typedef F();", [ParserErrorCode.C ONST_TYPEDEF]);
8556 } 9385 }
9386
8557 void test_continueOutsideOfLoop_continueInDoStatement() { 9387 void test_continueOutsideOfLoop_continueInDoStatement() {
8558 ParserTestCase.parse5("parseDoStatement", "do {continue;} while (x);", []); 9388 ParserTestCase.parse5("parseDoStatement", "do {continue;} while (x);", []);
8559 } 9389 }
9390
8560 void test_continueOutsideOfLoop_continueInForStatement() { 9391 void test_continueOutsideOfLoop_continueInForStatement() {
8561 ParserTestCase.parse5("parseForStatement", "for (; x;) {continue;}", []); 9392 ParserTestCase.parse5("parseForStatement", "for (; x;) {continue;}", []);
8562 } 9393 }
9394
8563 void test_continueOutsideOfLoop_continueInIfStatement() { 9395 void test_continueOutsideOfLoop_continueInIfStatement() {
8564 ParserTestCase.parse5("parseIfStatement", "if (x) {continue;}", [ParserError Code.CONTINUE_OUTSIDE_OF_LOOP]); 9396 ParserTestCase.parse5("parseIfStatement", "if (x) {continue;}", [ParserError Code.CONTINUE_OUTSIDE_OF_LOOP]);
8565 } 9397 }
9398
8566 void test_continueOutsideOfLoop_continueInSwitchStatement() { 9399 void test_continueOutsideOfLoop_continueInSwitchStatement() {
8567 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []); 9400 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []);
8568 } 9401 }
9402
8569 void test_continueOutsideOfLoop_continueInWhileStatement() { 9403 void test_continueOutsideOfLoop_continueInWhileStatement() {
8570 ParserTestCase.parse5("parseWhileStatement", "while (x) {continue;}", []); 9404 ParserTestCase.parse5("parseWhileStatement", "while (x) {continue;}", []);
8571 } 9405 }
9406
8572 void test_continueOutsideOfLoop_functionExpression_inALoop() { 9407 void test_continueOutsideOfLoop_functionExpression_inALoop() {
8573 ParserTestCase.parseStatement("for(; x;) {() {continue;};}", [ParserErrorCod e.CONTINUE_OUTSIDE_OF_LOOP]); 9408 ParserTestCase.parseStatement("for(; x;) {() {continue;};}", [ParserErrorCod e.CONTINUE_OUTSIDE_OF_LOOP]);
8574 } 9409 }
9410
8575 void test_continueOutsideOfLoop_functionExpression_withALoop() { 9411 void test_continueOutsideOfLoop_functionExpression_withALoop() {
8576 ParserTestCase.parseStatement("() {for (; x;) {continue;}};", []); 9412 ParserTestCase.parseStatement("() {for (; x;) {continue;}};", []);
8577 } 9413 }
9414
8578 void test_continueWithoutLabelInCase_error() { 9415 void test_continueWithoutLabelInCase_error() {
8579 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue; }", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]); 9416 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue; }", [ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE]);
8580 } 9417 }
9418
8581 void test_continueWithoutLabelInCase_noError() { 9419 void test_continueWithoutLabelInCase_noError() {
8582 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []); 9420 ParserTestCase.parse5("parseSwitchStatement", "switch (x) {case 1: continue a;}", []);
8583 } 9421 }
9422
8584 void test_continueWithoutLabelInCase_noError_switchInLoop() { 9423 void test_continueWithoutLabelInCase_noError_switchInLoop() {
8585 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul t: continue;}}", []); 9424 ParserTestCase.parse5("parseWhileStatement", "while (a) { switch (b) {defaul t: continue;}}", []);
8586 } 9425 }
9426
8587 void test_deprecatedClassTypeAlias() { 9427 void test_deprecatedClassTypeAlias() {
8588 ParserTestCase.parseCompilationUnit("typedef C = abstract S with M;", [Parse rErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); 9428 ParserTestCase.parseCompilationUnit("typedef C = abstract S with M;", [Parse rErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
8589 } 9429 }
9430
8590 void test_deprecatedClassTypeAlias_withGeneric() { 9431 void test_deprecatedClassTypeAlias_withGeneric() {
8591 ParserTestCase.parseCompilationUnit("typedef C<T> = abstract S<T> with M;", [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]); 9432 ParserTestCase.parseCompilationUnit("typedef C<T> = abstract S<T> with M;", [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
8592 } 9433 }
9434
8593 void test_directiveAfterDeclaration_classBeforeDirective() { 9435 void test_directiveAfterDeclaration_classBeforeDirective() {
8594 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); 9436 CompilationUnit unit = ParserTestCase.parseCompilationUnit("class Foo{} libr ary l;", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
8595 JUnitTestCase.assertNotNull(unit); 9437 JUnitTestCase.assertNotNull(unit);
8596 } 9438 }
9439
8597 void test_directiveAfterDeclaration_classBetweenDirectives() { 9440 void test_directiveAfterDeclaration_classBetweenDirectives() {
8598 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]); 9441 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library l;\nclas s Foo{}\npart 'a.dart';", [ParserErrorCode.DIRECTIVE_AFTER_DECLARATION]);
8599 JUnitTestCase.assertNotNull(unit); 9442 JUnitTestCase.assertNotNull(unit);
8600 } 9443 }
9444
8601 void test_duplicatedModifier_const() { 9445 void test_duplicatedModifier_const() {
8602 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 9446 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const const m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
8603 } 9447 }
9448
8604 void test_duplicatedModifier_external() { 9449 void test_duplicatedModifier_external() {
8605 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]); 9450 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external external f();", [ParserErrorCode.DUPLICATED_MODIFIER]);
8606 } 9451 }
9452
8607 void test_duplicatedModifier_factory() { 9453 void test_duplicatedModifier_factory() {
8608 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory factory C () {}", [ParserErrorCode.DUPLICATED_MODIFIER]); 9454 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory factory C () {}", [ParserErrorCode.DUPLICATED_MODIFIER]);
8609 } 9455 }
9456
8610 void test_duplicatedModifier_final() { 9457 void test_duplicatedModifier_final() {
8611 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final final m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 9458 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final final m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
8612 } 9459 }
9460
8613 void test_duplicatedModifier_static() { 9461 void test_duplicatedModifier_static() {
8614 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static static var m;", [ParserErrorCode.DUPLICATED_MODIFIER]); 9462 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static static var m;", [ParserErrorCode.DUPLICATED_MODIFIER]);
8615 } 9463 }
9464
8616 void test_duplicatedModifier_var() { 9465 void test_duplicatedModifier_var() {
8617 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var var m;", [Par serErrorCode.DUPLICATED_MODIFIER]); 9466 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var var m;", [Par serErrorCode.DUPLICATED_MODIFIER]);
8618 } 9467 }
9468
8619 void test_duplicateLabelInSwitchStatement() { 9469 void test_duplicateLabelInSwitchStatement() {
8620 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {l1: case 0: break ; l1: case 1: break;}", [ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT]); 9470 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {l1: case 0: break ; l1: case 1: break;}", [ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT]);
8621 } 9471 }
9472
8622 void test_equalityCannotBeEqualityOperand_eq_eq() { 9473 void test_equalityCannotBeEqualityOperand_eq_eq() {
8623 ParserTestCase.parseExpression("1 == 2 == 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]); 9474 ParserTestCase.parseExpression("1 == 2 == 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]);
8624 } 9475 }
9476
8625 void test_equalityCannotBeEqualityOperand_eq_neq() { 9477 void test_equalityCannotBeEqualityOperand_eq_neq() {
8626 ParserTestCase.parseExpression("1 == 2 != 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]); 9478 ParserTestCase.parseExpression("1 == 2 != 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]);
8627 } 9479 }
9480
8628 void test_equalityCannotBeEqualityOperand_neq_eq() { 9481 void test_equalityCannotBeEqualityOperand_neq_eq() {
8629 ParserTestCase.parseExpression("1 != 2 == 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]); 9482 ParserTestCase.parseExpression("1 != 2 == 3", [ParserErrorCode.EQUALITY_CANN OT_BE_EQUALITY_OPERAND]);
8630 } 9483 }
9484
8631 void test_expectedCaseOrDefault() { 9485 void test_expectedCaseOrDefault() {
8632 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {break;}", [Parser ErrorCode.EXPECTED_CASE_OR_DEFAULT]); 9486 ParserTestCase.parse5("parseSwitchStatement", "switch (e) {break;}", [Parser ErrorCode.EXPECTED_CASE_OR_DEFAULT]);
8633 } 9487 }
9488
8634 void test_expectedClassMember_inClass_afterType() { 9489 void test_expectedClassMember_inClass_afterType() {
8635 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "heart 2 heart", [ ParserErrorCode.EXPECTED_CLASS_MEMBER]); 9490 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "heart 2 heart", [ ParserErrorCode.EXPECTED_CLASS_MEMBER]);
8636 } 9491 }
9492
8637 void test_expectedClassMember_inClass_beforeType() { 9493 void test_expectedClassMember_inClass_beforeType() {
8638 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "4 score", [Parser ErrorCode.EXPECTED_CLASS_MEMBER]); 9494 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "4 score", [Parser ErrorCode.EXPECTED_CLASS_MEMBER]);
8639 } 9495 }
9496
8640 void test_expectedExecutable_inClass_afterVoid() { 9497 void test_expectedExecutable_inClass_afterVoid() {
8641 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void 2 void", [Pa rserErrorCode.EXPECTED_EXECUTABLE]); 9498 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void 2 void", [Pa rserErrorCode.EXPECTED_EXECUTABLE]);
8642 } 9499 }
9500
8643 void test_expectedExecutable_topLevel_afterType() { 9501 void test_expectedExecutable_topLevel_afterType() {
8644 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]); 9502 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "heart 2 heart", [ParserErrorCode.EXPECTED_EXECUTABLE]);
8645 } 9503 }
9504
8646 void test_expectedExecutable_topLevel_afterVoid() { 9505 void test_expectedExecutable_topLevel_afterVoid() {
8647 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]); 9506 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void 2 void", [ParserErrorCode.EXPECTED_EXECUTABLE]);
8648 } 9507 }
9508
8649 void test_expectedExecutable_topLevel_beforeType() { 9509 void test_expectedExecutable_topLevel_beforeType() {
8650 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]); 9510 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "4 score", [ParserErrorCode.EXPECTED_EXECUTABLE]);
8651 } 9511 }
9512
8652 void test_expectedInterpolationIdentifier() { 9513 void test_expectedInterpolationIdentifier() {
8653 ParserTestCase.parse5("parseStringLiteral", "'\$x\$'", [ParserErrorCode.MISS ING_IDENTIFIER]); 9514 ParserTestCase.parse5("parseStringLiteral", "'\$x\$'", [ParserErrorCode.MISS ING_IDENTIFIER]);
8654 } 9515 }
9516
8655 void test_expectedStringLiteral() { 9517 void test_expectedStringLiteral() {
8656 StringLiteral expression = ParserTestCase.parse5("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]); 9518 StringLiteral expression = ParserTestCase.parse5("parseStringLiteral", "1", [ParserErrorCode.EXPECTED_STRING_LITERAL]);
8657 JUnitTestCase.assertTrue(expression.isSynthetic); 9519 JUnitTestCase.assertTrue(expression.isSynthetic);
8658 } 9520 }
9521
8659 void test_expectedToken_commaMissingInArgumentList() { 9522 void test_expectedToken_commaMissingInArgumentList() {
8660 ParserTestCase.parse5("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]); 9523 ParserTestCase.parse5("parseArgumentList", "(x, y z)", [ParserErrorCode.EXPE CTED_TOKEN]);
8661 } 9524 }
9525
8662 void test_expectedToken_parseStatement_afterVoid() { 9526 void test_expectedToken_parseStatement_afterVoid() {
8663 ParserTestCase.parseStatement("void}", [ 9527 ParserTestCase.parseStatement("void}", [
8664 ParserErrorCode.EXPECTED_TOKEN, 9528 ParserErrorCode.EXPECTED_TOKEN,
8665 ParserErrorCode.MISSING_IDENTIFIER]); 9529 ParserErrorCode.MISSING_IDENTIFIER]);
8666 } 9530 }
9531
8667 void test_expectedToken_semicolonAfterClass() { 9532 void test_expectedToken_semicolonAfterClass() {
8668 Token token = TokenFactory.token(Keyword.CLASS); 9533 Token token = TokenFactory.token(Keyword.CLASS);
8669 ParserTestCase.parse4("parseClassTypeAlias", <Object> [emptyCommentAndMetada ta(), token], "A = B", [ParserErrorCode.EXPECTED_TOKEN]); 9534 ParserTestCase.parse4("parseClassTypeAlias", <Object> [emptyCommentAndMetada ta(), token], "A = B", [ParserErrorCode.EXPECTED_TOKEN]);
8670 } 9535 }
9536
8671 void test_expectedToken_semicolonMissingAfterExpression() { 9537 void test_expectedToken_semicolonMissingAfterExpression() {
8672 ParserTestCase.parseStatement("x", [ParserErrorCode.EXPECTED_TOKEN]); 9538 ParserTestCase.parseStatement("x", [ParserErrorCode.EXPECTED_TOKEN]);
8673 } 9539 }
9540
8674 void test_expectedToken_whileMissingInDoStatement() { 9541 void test_expectedToken_whileMissingInDoStatement() {
8675 ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN] ); 9542 ParserTestCase.parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN] );
8676 } 9543 }
9544
8677 void test_expectedTypeName_is() { 9545 void test_expectedTypeName_is() {
8678 ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]) ; 9546 ParserTestCase.parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]) ;
8679 } 9547 }
9548
8680 void test_exportDirectiveAfterPartDirective() { 9549 void test_exportDirectiveAfterPartDirective() {
8681 ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';", [Pars erErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]); 9550 ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';", [Pars erErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
8682 } 9551 }
9552
8683 void test_externalAfterConst() { 9553 void test_externalAfterConst() {
8684 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const external C( );", [ParserErrorCode.EXTERNAL_AFTER_CONST]); 9554 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const external C( );", [ParserErrorCode.EXTERNAL_AFTER_CONST]);
8685 } 9555 }
9556
8686 void test_externalAfterFactory() { 9557 void test_externalAfterFactory() {
8687 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory external C();", [ParserErrorCode.EXTERNAL_AFTER_FACTORY]); 9558 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory external C();", [ParserErrorCode.EXTERNAL_AFTER_FACTORY]);
8688 } 9559 }
9560
8689 void test_externalAfterStatic() { 9561 void test_externalAfterStatic() {
8690 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static external i nt m();", [ParserErrorCode.EXTERNAL_AFTER_STATIC]); 9562 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static external i nt m();", [ParserErrorCode.EXTERNAL_AFTER_STATIC]);
8691 } 9563 }
9564
8692 void test_externalClass() { 9565 void test_externalClass() {
8693 ParserTestCase.parseCompilationUnit("external class C {}", [ParserErrorCode. EXTERNAL_CLASS]); 9566 ParserTestCase.parseCompilationUnit("external class C {}", [ParserErrorCode. EXTERNAL_CLASS]);
8694 } 9567 }
9568
8695 void test_externalConstructorWithBody_factory() { 9569 void test_externalConstructorWithBody_factory() {
8696 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external factory C() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]); 9570 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external factory C() {}", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
8697 } 9571 }
9572
8698 void test_externalConstructorWithBody_named() { 9573 void test_externalConstructorWithBody_named() {
8699 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external C.c() {} ", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]); 9574 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external C.c() {} ", [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
8700 } 9575 }
9576
8701 void test_externalField_const() { 9577 void test_externalField_const() {
8702 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]); 9578 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external const A f;", [ParserErrorCode.EXTERNAL_FIELD]);
8703 } 9579 }
9580
8704 void test_externalField_final() { 9581 void test_externalField_final() {
8705 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external final A f;", [ParserErrorCode.EXTERNAL_FIELD]); 9582 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external final A f;", [ParserErrorCode.EXTERNAL_FIELD]);
8706 } 9583 }
9584
8707 void test_externalField_static() { 9585 void test_externalField_static() {
8708 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external static A f;", [ParserErrorCode.EXTERNAL_FIELD]); 9586 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external static A f;", [ParserErrorCode.EXTERNAL_FIELD]);
8709 } 9587 }
9588
8710 void test_externalField_typed() { 9589 void test_externalField_typed() {
8711 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external A f;", [ ParserErrorCode.EXTERNAL_FIELD]); 9590 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external A f;", [ ParserErrorCode.EXTERNAL_FIELD]);
8712 } 9591 }
9592
8713 void test_externalField_untyped() { 9593 void test_externalField_untyped() {
8714 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external var f;", [ParserErrorCode.EXTERNAL_FIELD]); 9594 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external var f;", [ParserErrorCode.EXTERNAL_FIELD]);
8715 } 9595 }
9596
8716 void test_externalGetterWithBody() { 9597 void test_externalGetterWithBody() {
8717 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external int get x {}", [ParserErrorCode.EXTERNAL_GETTER_WITH_BODY]); 9598 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external int get x {}", [ParserErrorCode.EXTERNAL_GETTER_WITH_BODY]);
8718 } 9599 }
9600
8719 void test_externalMethodWithBody() { 9601 void test_externalMethodWithBody() {
8720 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external m() {}", [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]); 9602 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external m() {}", [ParserErrorCode.EXTERNAL_METHOD_WITH_BODY]);
8721 } 9603 }
9604
8722 void test_externalOperatorWithBody() { 9605 void test_externalOperatorWithBody() {
8723 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external operator +(int value) {}", [ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY]); 9606 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external operator +(int value) {}", [ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY]);
8724 } 9607 }
9608
8725 void test_externalSetterWithBody() { 9609 void test_externalSetterWithBody() {
8726 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external set x(in t value) {}", [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]); 9610 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "external set x(in t value) {}", [ParserErrorCode.EXTERNAL_SETTER_WITH_BODY]);
8727 } 9611 }
9612
8728 void test_externalTypedef() { 9613 void test_externalTypedef() {
8729 ParserTestCase.parseCompilationUnit("external typedef F();", [ParserErrorCod e.EXTERNAL_TYPEDEF]); 9614 ParserTestCase.parseCompilationUnit("external typedef F();", [ParserErrorCod e.EXTERNAL_TYPEDEF]);
8730 } 9615 }
9616
8731 void test_factoryTopLevelDeclaration_class() { 9617 void test_factoryTopLevelDeclaration_class() {
8732 ParserTestCase.parseCompilationUnit("factory class C {}", [ParserErrorCode.F ACTORY_TOP_LEVEL_DECLARATION]); 9618 ParserTestCase.parseCompilationUnit("factory class C {}", [ParserErrorCode.F ACTORY_TOP_LEVEL_DECLARATION]);
8733 } 9619 }
9620
8734 void test_factoryTopLevelDeclaration_typedef() { 9621 void test_factoryTopLevelDeclaration_typedef() {
8735 ParserTestCase.parseCompilationUnit("factory typedef F();", [ParserErrorCode .FACTORY_TOP_LEVEL_DECLARATION]); 9622 ParserTestCase.parseCompilationUnit("factory typedef F();", [ParserErrorCode .FACTORY_TOP_LEVEL_DECLARATION]);
8736 } 9623 }
9624
8737 void test_factoryWithoutBody() { 9625 void test_factoryWithoutBody() {
8738 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory C();", [P arserErrorCode.FACTORY_WITHOUT_BODY]); 9626 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory C();", [P arserErrorCode.FACTORY_WITHOUT_BODY]);
8739 } 9627 }
9628
8740 void test_fieldInitializerOutsideConstructor() { 9629 void test_fieldInitializerOutsideConstructor() {
8741 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void m(this.x);", [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]); 9630 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void m(this.x);", [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
8742 } 9631 }
9632
8743 void test_finalAndVar() { 9633 void test_finalAndVar() {
8744 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final var x;", [P arserErrorCode.FINAL_AND_VAR]); 9634 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final var x;", [P arserErrorCode.FINAL_AND_VAR]);
8745 } 9635 }
9636
8746 void test_finalClass() { 9637 void test_finalClass() {
8747 ParserTestCase.parseCompilationUnit("final class C {}", [ParserErrorCode.FIN AL_CLASS]); 9638 ParserTestCase.parseCompilationUnit("final class C {}", [ParserErrorCode.FIN AL_CLASS]);
8748 } 9639 }
9640
8749 void test_finalConstructor() { 9641 void test_finalConstructor() {
8750 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final C() {}", [P arserErrorCode.FINAL_CONSTRUCTOR]); 9642 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final C() {}", [P arserErrorCode.FINAL_CONSTRUCTOR]);
8751 } 9643 }
9644
8752 void test_finalMethod() { 9645 void test_finalMethod() {
8753 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final int m() {}" , [ParserErrorCode.FINAL_METHOD]); 9646 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final int m() {}" , [ParserErrorCode.FINAL_METHOD]);
8754 } 9647 }
9648
8755 void test_finalTypedef() { 9649 void test_finalTypedef() {
8756 ParserTestCase.parseCompilationUnit("final typedef F();", [ParserErrorCode.F INAL_TYPEDEF]); 9650 ParserTestCase.parseCompilationUnit("final typedef F();", [ParserErrorCode.F INAL_TYPEDEF]);
8757 } 9651 }
9652
8758 void test_functionTypedParameter_const() { 9653 void test_functionTypedParameter_const() {
8759 ParserTestCase.parseCompilationUnit("void f(const x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]); 9654 ParserTestCase.parseCompilationUnit("void f(const x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]);
8760 } 9655 }
9656
8761 void test_functionTypedParameter_final() { 9657 void test_functionTypedParameter_final() {
8762 ParserTestCase.parseCompilationUnit("void f(final x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]); 9658 ParserTestCase.parseCompilationUnit("void f(final x()) {}", [ParserErrorCode .FUNCTION_TYPED_PARAMETER_VAR]);
8763 } 9659 }
9660
8764 void test_functionTypedParameter_var() { 9661 void test_functionTypedParameter_var() {
8765 ParserTestCase.parseCompilationUnit("void f(var x()) {}", [ParserErrorCode.F UNCTION_TYPED_PARAMETER_VAR]); 9662 ParserTestCase.parseCompilationUnit("void f(var x()) {}", [ParserErrorCode.F UNCTION_TYPED_PARAMETER_VAR]);
8766 } 9663 }
9664
8767 void test_getterInFunction_block() { 9665 void test_getterInFunction_block() {
8768 ParserTestCase.parseStatement("get x { return _x; }", [ParserErrorCode.GETTE R_IN_FUNCTION]); 9666 ParserTestCase.parseStatement("get x { return _x; }", [ParserErrorCode.GETTE R_IN_FUNCTION]);
8769 } 9667 }
9668
8770 void test_getterInFunction_expression() { 9669 void test_getterInFunction_expression() {
8771 ParserTestCase.parseStatement("get x => _x;", [ParserErrorCode.GETTER_IN_FUN CTION]); 9670 ParserTestCase.parseStatement("get x => _x;", [ParserErrorCode.GETTER_IN_FUN CTION]);
8772 } 9671 }
9672
8773 void test_getterWithParameters() { 9673 void test_getterWithParameters() {
8774 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]); 9674 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int get x() {}", [ParserErrorCode.GETTER_WITH_PARAMETERS]);
8775 } 9675 }
9676
8776 void test_illegalAssignmentToNonAssignable_superAssigned() { 9677 void test_illegalAssignmentToNonAssignable_superAssigned() {
8777 ParserTestCase.parseExpression("super = x;", [ 9678 ParserTestCase.parseExpression("super = x;", [
8778 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, 9679 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
8779 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]); 9680 ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE]);
8780 } 9681 }
9682
8781 void test_implementsBeforeExtends() { 9683 void test_implementsBeforeExtends() {
8782 ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [Pa rserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]); 9684 ParserTestCase.parseCompilationUnit("class A implements B extends C {}", [Pa rserErrorCode.IMPLEMENTS_BEFORE_EXTENDS]);
8783 } 9685 }
9686
8784 void test_implementsBeforeWith() { 9687 void test_implementsBeforeWith() {
8785 ParserTestCase.parseCompilationUnit("class A extends B implements C with D { }", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]); 9688 ParserTestCase.parseCompilationUnit("class A extends B implements C with D { }", [ParserErrorCode.IMPLEMENTS_BEFORE_WITH]);
8786 } 9689 }
9690
8787 void test_importDirectiveAfterPartDirective() { 9691 void test_importDirectiveAfterPartDirective() {
8788 ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [Pars erErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]); 9692 ParserTestCase.parseCompilationUnit("part 'a.dart'; import 'b.dart';", [Pars erErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
8789 } 9693 }
9694
8790 void test_initializedVariableInForEach() { 9695 void test_initializedVariableInForEach() {
8791 ParserTestCase.parse5("parseForStatement", "for (int a = 0 in foo) {}", [Par serErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH]); 9696 ParserTestCase.parse5("parseForStatement", "for (int a = 0 in foo) {}", [Par serErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH]);
8792 } 9697 }
9698
8793 void test_invalidCodePoint() { 9699 void test_invalidCodePoint() {
8794 ParserTestCase.parse5("parseStringLiteral", "'\\uD900'", [ParserErrorCode.IN VALID_CODE_POINT]); 9700 ParserTestCase.parse5("parseStringLiteral", "'\\uD900'", [ParserErrorCode.IN VALID_CODE_POINT]);
8795 } 9701 }
9702
8796 void test_invalidHexEscape_invalidDigit() { 9703 void test_invalidHexEscape_invalidDigit() {
8797 ParserTestCase.parse5("parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INV ALID_HEX_ESCAPE]); 9704 ParserTestCase.parse5("parseStringLiteral", "'\\x0 a'", [ParserErrorCode.INV ALID_HEX_ESCAPE]);
8798 } 9705 }
9706
8799 void test_invalidHexEscape_tooFewDigits() { 9707 void test_invalidHexEscape_tooFewDigits() {
8800 ParserTestCase.parse5("parseStringLiteral", "'\\x0'", [ParserErrorCode.INVAL ID_HEX_ESCAPE]); 9708 ParserTestCase.parse5("parseStringLiteral", "'\\x0'", [ParserErrorCode.INVAL ID_HEX_ESCAPE]);
8801 } 9709 }
9710
8802 void test_invalidInterpolationIdentifier_startWithDigit() { 9711 void test_invalidInterpolationIdentifier_startWithDigit() {
8803 ParserTestCase.parse5("parseStringLiteral", "'\$1'", [ParserErrorCode.MISSIN G_IDENTIFIER]); 9712 ParserTestCase.parse5("parseStringLiteral", "'\$1'", [ParserErrorCode.MISSIN G_IDENTIFIER]);
8804 } 9713 }
9714
8805 void test_invalidOperator() { 9715 void test_invalidOperator() {
8806 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void operator === (x) {}", [ParserErrorCode.INVALID_OPERATOR]); 9716 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void operator === (x) {}", [ParserErrorCode.INVALID_OPERATOR]);
8807 } 9717 }
9718
8808 void test_invalidOperatorForSuper() { 9719 void test_invalidOperatorForSuper() {
8809 ParserTestCase.parse5("parseUnaryExpression", "++super", [ParserErrorCode.IN VALID_OPERATOR_FOR_SUPER]); 9720 ParserTestCase.parse5("parseUnaryExpression", "++super", [ParserErrorCode.IN VALID_OPERATOR_FOR_SUPER]);
8810 } 9721 }
9722
8811 void test_invalidUnicodeEscape_incomplete_noDigits() { 9723 void test_invalidUnicodeEscape_incomplete_noDigits() {
8812 ParserTestCase.parse5("parseStringLiteral", "'\\u{'", [ParserErrorCode.INVAL ID_UNICODE_ESCAPE]); 9724 ParserTestCase.parse5("parseStringLiteral", "'\\u{'", [ParserErrorCode.INVAL ID_UNICODE_ESCAPE]);
8813 } 9725 }
9726
8814 void test_invalidUnicodeEscape_incomplete_someDigits() { 9727 void test_invalidUnicodeEscape_incomplete_someDigits() {
8815 ParserTestCase.parse5("parseStringLiteral", "'\\u{0A'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]); 9728 ParserTestCase.parse5("parseStringLiteral", "'\\u{0A'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]);
8816 } 9729 }
9730
8817 void test_invalidUnicodeEscape_invalidDigit() { 9731 void test_invalidUnicodeEscape_invalidDigit() {
8818 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]); 9732 ParserTestCase.parse5("parseStringLiteral", "'\\u0 a'", [ParserErrorCode.INV ALID_UNICODE_ESCAPE]);
8819 } 9733 }
9734
8820 void test_invalidUnicodeEscape_tooFewDigits_fixed() { 9735 void test_invalidUnicodeEscape_tooFewDigits_fixed() {
8821 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 9736 ParserTestCase.parse5("parseStringLiteral", "'\\u04'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
8822 } 9737 }
9738
8823 void test_invalidUnicodeEscape_tooFewDigits_variable() { 9739 void test_invalidUnicodeEscape_tooFewDigits_variable() {
8824 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]); 9740 ParserTestCase.parse5("parseStringLiteral", "'\\u{}'", [ParserErrorCode.INVA LID_UNICODE_ESCAPE]);
8825 } 9741 }
9742
8826 void test_invalidUnicodeEscape_tooManyDigits_variable() { 9743 void test_invalidUnicodeEscape_tooManyDigits_variable() {
8827 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [ 9744 ParserTestCase.parse5("parseStringLiteral", "'\\u{12345678}'", [
8828 ParserErrorCode.INVALID_UNICODE_ESCAPE, 9745 ParserErrorCode.INVALID_UNICODE_ESCAPE,
8829 ParserErrorCode.INVALID_CODE_POINT]); 9746 ParserErrorCode.INVALID_CODE_POINT]);
8830 } 9747 }
9748
8831 void test_libraryDirectiveNotFirst() { 9749 void test_libraryDirectiveNotFirst() {
8832 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 9750 ParserTestCase.parseCompilationUnit("import 'x.dart'; library l;", [ParserEr rorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
8833 } 9751 }
9752
8834 void test_libraryDirectiveNotFirst_afterPart() { 9753 void test_libraryDirectiveNotFirst_afterPart() {
8835 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]); 9754 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part 'a.dart';\n library l;", [ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST]);
8836 JUnitTestCase.assertNotNull(unit); 9755 JUnitTestCase.assertNotNull(unit);
8837 } 9756 }
9757
8838 void test_localFunctionDeclarationModifier_abstract() { 9758 void test_localFunctionDeclarationModifier_abstract() {
8839 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]); 9759 ParserTestCase.parseStatement("abstract f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]);
8840 } 9760 }
9761
8841 void test_localFunctionDeclarationModifier_external() { 9762 void test_localFunctionDeclarationModifier_external() {
8842 ParserTestCase.parseStatement("external f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]); 9763 ParserTestCase.parseStatement("external f() {}", [ParserErrorCode.LOCAL_FUNC TION_DECLARATION_MODIFIER]);
8843 } 9764 }
9765
8844 void test_localFunctionDeclarationModifier_factory() { 9766 void test_localFunctionDeclarationModifier_factory() {
8845 ParserTestCase.parseStatement("factory f() {}", [ParserErrorCode.LOCAL_FUNCT ION_DECLARATION_MODIFIER]); 9767 ParserTestCase.parseStatement("factory f() {}", [ParserErrorCode.LOCAL_FUNCT ION_DECLARATION_MODIFIER]);
8846 } 9768 }
9769
8847 void test_localFunctionDeclarationModifier_static() { 9770 void test_localFunctionDeclarationModifier_static() {
8848 ParserTestCase.parseStatement("static f() {}", [ParserErrorCode.LOCAL_FUNCTI ON_DECLARATION_MODIFIER]); 9771 ParserTestCase.parseStatement("static f() {}", [ParserErrorCode.LOCAL_FUNCTI ON_DECLARATION_MODIFIER]);
8849 } 9772 }
9773
8850 void test_missingAssignableSelector_identifiersAssigned() { 9774 void test_missingAssignableSelector_identifiersAssigned() {
8851 ParserTestCase.parseExpression("x.y = y;", []); 9775 ParserTestCase.parseExpression("x.y = y;", []);
8852 } 9776 }
9777
8853 void test_missingAssignableSelector_postfix_minusMinus_literal() { 9778 void test_missingAssignableSelector_postfix_minusMinus_literal() {
8854 ParserTestCase.parseExpression("0--", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]); 9779 ParserTestCase.parseExpression("0--", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]);
8855 } 9780 }
9781
8856 void test_missingAssignableSelector_postfix_plusPlus_literal() { 9782 void test_missingAssignableSelector_postfix_plusPlus_literal() {
8857 ParserTestCase.parseExpression("0++", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]); 9783 ParserTestCase.parseExpression("0++", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]);
8858 } 9784 }
9785
8859 void test_missingAssignableSelector_prefix_minusMinus_literal() { 9786 void test_missingAssignableSelector_prefix_minusMinus_literal() {
8860 ParserTestCase.parseExpression("--0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]); 9787 ParserTestCase.parseExpression("--0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]);
8861 } 9788 }
9789
8862 void test_missingAssignableSelector_prefix_plusPlus_literal() { 9790 void test_missingAssignableSelector_prefix_plusPlus_literal() {
8863 ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]); 9791 ParserTestCase.parseExpression("++0", [ParserErrorCode.MISSING_ASSIGNABLE_SE LECTOR]);
8864 } 9792 }
9793
8865 void test_missingAssignableSelector_primarySelectorPostfix() { 9794 void test_missingAssignableSelector_primarySelectorPostfix() {
8866 ParserTestCase.parseExpression("x(y)(z)++", [ParserErrorCode.MISSING_ASSIGNA BLE_SELECTOR]); 9795 ParserTestCase.parseExpression("x(y)(z)++", [ParserErrorCode.MISSING_ASSIGNA BLE_SELECTOR]);
8867 } 9796 }
9797
8868 void test_missingAssignableSelector_selector() { 9798 void test_missingAssignableSelector_selector() {
8869 ParserTestCase.parseExpression("x(y)(z).a++", []); 9799 ParserTestCase.parseExpression("x(y)(z).a++", []);
8870 } 9800 }
9801
8871 void test_missingAssignableSelector_superPrimaryExpression() { 9802 void test_missingAssignableSelector_superPrimaryExpression() {
8872 SuperExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]); 9803 SuperExpression expression = ParserTestCase.parse5("parsePrimaryExpression", "super", [ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR]);
8873 JUnitTestCase.assertNotNull(expression.keyword); 9804 JUnitTestCase.assertNotNull(expression.keyword);
8874 } 9805 }
9806
8875 void test_missingAssignableSelector_superPropertyAccessAssigned() { 9807 void test_missingAssignableSelector_superPropertyAccessAssigned() {
8876 ParserTestCase.parseExpression("super.x = x;", []); 9808 ParserTestCase.parseExpression("super.x = x;", []);
8877 } 9809 }
9810
8878 void test_missingCatchOrFinally() { 9811 void test_missingCatchOrFinally() {
8879 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]); 9812 TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {}" , [ParserErrorCode.MISSING_CATCH_OR_FINALLY]);
8880 JUnitTestCase.assertNotNull(statement); 9813 JUnitTestCase.assertNotNull(statement);
8881 } 9814 }
9815
8882 void test_missingClassBody() { 9816 void test_missingClassBody() {
8883 ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.M ISSING_CLASS_BODY]); 9817 ParserTestCase.parseCompilationUnit("class A class B {}", [ParserErrorCode.M ISSING_CLASS_BODY]);
8884 } 9818 }
9819
8885 void test_missingConstFinalVarOrType_static() { 9820 void test_missingConstFinalVarOrType_static() {
8886 ParserTestCase.parseCompilationUnit("class A { static f; }", [ParserErrorCod e.MISSING_CONST_FINAL_VAR_OR_TYPE]); 9821 ParserTestCase.parseCompilationUnit("class A { static f; }", [ParserErrorCod e.MISSING_CONST_FINAL_VAR_OR_TYPE]);
8887 } 9822 }
9823
8888 void test_missingConstFinalVarOrType_topLevel() { 9824 void test_missingConstFinalVarOrType_topLevel() {
8889 ParserTestCase.parse4("parseFinalConstVarOrType", <Object> [false], "a;", [P arserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]); 9825 ParserTestCase.parse4("parseFinalConstVarOrType", <Object> [false], "a;", [P arserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
8890 } 9826 }
9827
8891 void test_missingExpressionInThrow_withCascade() { 9828 void test_missingExpressionInThrow_withCascade() {
8892 ParserTestCase.parse5("parseThrowExpression", "throw;", [ParserErrorCode.MIS SING_EXPRESSION_IN_THROW]); 9829 ParserTestCase.parse5("parseThrowExpression", "throw;", [ParserErrorCode.MIS SING_EXPRESSION_IN_THROW]);
8893 } 9830 }
9831
8894 void test_missingExpressionInThrow_withoutCascade() { 9832 void test_missingExpressionInThrow_withoutCascade() {
8895 ParserTestCase.parse5("parseThrowExpressionWithoutCascade", "throw;", [Parse rErrorCode.MISSING_EXPRESSION_IN_THROW]); 9833 ParserTestCase.parse5("parseThrowExpressionWithoutCascade", "throw;", [Parse rErrorCode.MISSING_EXPRESSION_IN_THROW]);
8896 } 9834 }
9835
8897 void test_missingFunctionBody_emptyNotAllowed() { 9836 void test_missingFunctionBody_emptyNotAllowed() {
8898 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], ";", [ParserErrorCode.MISSING_FUNCTION_BODY]); 9837 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], ";", [ParserErrorCode.MISSING_FUNCTION_BODY]);
8899 } 9838 }
9839
8900 void test_missingFunctionBody_invalid() { 9840 void test_missingFunctionBody_invalid() {
8901 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], "return 0;", [ParserErrorCode.MISSING_FUNCTION_BO DY]); 9841 ParserTestCase.parse4("parseFunctionBody", <Object> [false, ParserErrorCode. MISSING_FUNCTION_BODY, false], "return 0;", [ParserErrorCode.MISSING_FUNCTION_BO DY]);
8902 } 9842 }
9843
8903 void test_missingFunctionParameters_local_void_block() { 9844 void test_missingFunctionParameters_local_void_block() {
8904 ParserTestCase.parseStatement("void f { return x;}", [ParserErrorCode.MISSIN G_FUNCTION_PARAMETERS]); 9845 ParserTestCase.parseStatement("void f { return x;}", [ParserErrorCode.MISSIN G_FUNCTION_PARAMETERS]);
8905 } 9846 }
9847
8906 void test_missingFunctionParameters_local_void_expression() { 9848 void test_missingFunctionParameters_local_void_expression() {
8907 ParserTestCase.parseStatement("void f => x;", [ParserErrorCode.MISSING_FUNCT ION_PARAMETERS]); 9849 ParserTestCase.parseStatement("void f => x;", [ParserErrorCode.MISSING_FUNCT ION_PARAMETERS]);
8908 } 9850 }
9851
8909 void test_missingFunctionParameters_topLevel_nonVoid_block() { 9852 void test_missingFunctionParameters_topLevel_nonVoid_block() {
8910 ParserTestCase.parseCompilationUnit("int f { return x;}", [ParserErrorCode.M ISSING_FUNCTION_PARAMETERS]); 9853 ParserTestCase.parseCompilationUnit("int f { return x;}", [ParserErrorCode.M ISSING_FUNCTION_PARAMETERS]);
8911 } 9854 }
9855
8912 void test_missingFunctionParameters_topLevel_nonVoid_expression() { 9856 void test_missingFunctionParameters_topLevel_nonVoid_expression() {
8913 ParserTestCase.parseCompilationUnit("int f => x;", [ParserErrorCode.MISSING_ FUNCTION_PARAMETERS]); 9857 ParserTestCase.parseCompilationUnit("int f => x;", [ParserErrorCode.MISSING_ FUNCTION_PARAMETERS]);
8914 } 9858 }
9859
8915 void test_missingFunctionParameters_topLevel_void_block() { 9860 void test_missingFunctionParameters_topLevel_void_block() {
8916 ParserTestCase.parseCompilationUnit("void f { return x;}", [ParserErrorCode. MISSING_FUNCTION_PARAMETERS]); 9861 ParserTestCase.parseCompilationUnit("void f { return x;}", [ParserErrorCode. MISSING_FUNCTION_PARAMETERS]);
8917 } 9862 }
9863
8918 void test_missingFunctionParameters_topLevel_void_expression() { 9864 void test_missingFunctionParameters_topLevel_void_expression() {
8919 ParserTestCase.parseCompilationUnit("void f => x;", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]); 9865 ParserTestCase.parseCompilationUnit("void f => x;", [ParserErrorCode.MISSING _FUNCTION_PARAMETERS]);
8920 } 9866 }
9867
8921 void test_missingIdentifier_afterOperator() { 9868 void test_missingIdentifier_afterOperator() {
8922 ParserTestCase.parse5("parseMultiplicativeExpression", "1 *", [ParserErrorCo de.MISSING_IDENTIFIER]); 9869 ParserTestCase.parse5("parseMultiplicativeExpression", "1 *", [ParserErrorCo de.MISSING_IDENTIFIER]);
8923 } 9870 }
9871
8924 void test_missingIdentifier_beforeClosingCurly() { 9872 void test_missingIdentifier_beforeClosingCurly() {
8925 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int}", [ 9873 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int}", [
8926 ParserErrorCode.MISSING_IDENTIFIER, 9874 ParserErrorCode.MISSING_IDENTIFIER,
8927 ParserErrorCode.EXPECTED_TOKEN]); 9875 ParserErrorCode.EXPECTED_TOKEN]);
8928 } 9876 }
9877
8929 void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() { 9878 void test_missingIdentifier_functionDeclaration_returnTypeWithoutName() {
8930 ParserTestCase.parse5("parseFunctionDeclarationStatement", "A<T> () {}", [Pa rserErrorCode.MISSING_IDENTIFIER]); 9879 ParserTestCase.parse5("parseFunctionDeclarationStatement", "A<T> () {}", [Pa rserErrorCode.MISSING_IDENTIFIER]);
8931 } 9880 }
9881
8932 void test_missingIdentifier_inSymbol_afterPeriod() { 9882 void test_missingIdentifier_inSymbol_afterPeriod() {
8933 ParserTestCase.parse5("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_ IDENTIFIER]); 9883 ParserTestCase.parse5("parseSymbolLiteral", "#a.", [ParserErrorCode.MISSING_ IDENTIFIER]);
8934 } 9884 }
9885
8935 void test_missingIdentifier_inSymbol_first() { 9886 void test_missingIdentifier_inSymbol_first() {
8936 ParserTestCase.parse5("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_ID ENTIFIER]); 9887 ParserTestCase.parse5("parseSymbolLiteral", "#", [ParserErrorCode.MISSING_ID ENTIFIER]);
8937 } 9888 }
9889
8938 void test_missingIdentifier_number() { 9890 void test_missingIdentifier_number() {
8939 SimpleIdentifier expression = ParserTestCase.parse5("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]); 9891 SimpleIdentifier expression = ParserTestCase.parse5("parseSimpleIdentifier", "1", [ParserErrorCode.MISSING_IDENTIFIER]);
8940 JUnitTestCase.assertTrue(expression.isSynthetic); 9892 JUnitTestCase.assertTrue(expression.isSynthetic);
8941 } 9893 }
9894
8942 void test_missingKeywordOperator() { 9895 void test_missingKeywordOperator() {
8943 ParserTestCase.parse4("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]); 9896 ParserTestCase.parse4("parseOperator", <Object> [emptyCommentAndMetadata(), null, null], "+(x) {}", [ParserErrorCode.MISSING_KEYWORD_OPERATOR]);
8944 } 9897 }
9898
8945 void test_missingKeywordOperator_parseClassMember() { 9899 void test_missingKeywordOperator_parseClassMember() {
8946 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "+() {}", [ParserE rrorCode.MISSING_KEYWORD_OPERATOR]); 9900 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "+() {}", [ParserE rrorCode.MISSING_KEYWORD_OPERATOR]);
8947 } 9901 }
9902
8948 void test_missingKeywordOperator_parseClassMember_afterTypeName() { 9903 void test_missingKeywordOperator_parseClassMember_afterTypeName() {
8949 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int +() {}", [Par serErrorCode.MISSING_KEYWORD_OPERATOR]); 9904 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "int +() {}", [Par serErrorCode.MISSING_KEYWORD_OPERATOR]);
8950 } 9905 }
9906
8951 void test_missingKeywordOperator_parseClassMember_afterVoid() { 9907 void test_missingKeywordOperator_parseClassMember_afterVoid() {
8952 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void +() {}", [Pa rserErrorCode.MISSING_KEYWORD_OPERATOR]); 9908 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void +() {}", [Pa rserErrorCode.MISSING_KEYWORD_OPERATOR]);
8953 } 9909 }
9910
8954 void test_missingNameInLibraryDirective() { 9911 void test_missingNameInLibraryDirective() {
8955 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [Pars erErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]); 9912 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library;", [Pars erErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
8956 JUnitTestCase.assertNotNull(unit); 9913 JUnitTestCase.assertNotNull(unit);
8957 } 9914 }
9915
8958 void test_missingNameInPartOfDirective() { 9916 void test_missingNameInPartOfDirective() {
8959 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [Pars erErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]); 9917 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of;", [Pars erErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE]);
8960 JUnitTestCase.assertNotNull(unit); 9918 JUnitTestCase.assertNotNull(unit);
8961 } 9919 }
9920
8962 void test_missingStatement() { 9921 void test_missingStatement() {
8963 ParserTestCase.parseStatement("is", [ParserErrorCode.MISSING_STATEMENT]); 9922 ParserTestCase.parseStatement("is", [ParserErrorCode.MISSING_STATEMENT]);
8964 } 9923 }
9924
8965 void test_missingStatement_afterVoid() { 9925 void test_missingStatement_afterVoid() {
8966 ParserTestCase.parseStatement("void;", [ParserErrorCode.MISSING_STATEMENT]); 9926 ParserTestCase.parseStatement("void;", [ParserErrorCode.MISSING_STATEMENT]);
8967 } 9927 }
9928
8968 void test_missingTerminatorForParameterGroup_named() { 9929 void test_missingTerminatorForParameterGroup_named() {
8969 ParserTestCase.parse5("parseFormalParameterList", "(a, {b: 0)", [ParserError Code.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]); 9930 ParserTestCase.parse5("parseFormalParameterList", "(a, {b: 0)", [ParserError Code.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
8970 } 9931 }
9932
8971 void test_missingTerminatorForParameterGroup_optional() { 9933 void test_missingTerminatorForParameterGroup_optional() {
8972 ParserTestCase.parse5("parseFormalParameterList", "(a, [b = 0)", [ParserErro rCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]); 9934 ParserTestCase.parse5("parseFormalParameterList", "(a, [b = 0)", [ParserErro rCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP]);
8973 } 9935 }
9936
8974 void test_missingTypedefParameters_nonVoid() { 9937 void test_missingTypedefParameters_nonVoid() {
8975 ParserTestCase.parseCompilationUnit("typedef int F;", [ParserErrorCode.MISSI NG_TYPEDEF_PARAMETERS]); 9938 ParserTestCase.parseCompilationUnit("typedef int F;", [ParserErrorCode.MISSI NG_TYPEDEF_PARAMETERS]);
8976 } 9939 }
9940
8977 void test_missingTypedefParameters_typeParameters() { 9941 void test_missingTypedefParameters_typeParameters() {
8978 ParserTestCase.parseCompilationUnit("typedef F<E>;", [ParserErrorCode.MISSIN G_TYPEDEF_PARAMETERS]); 9942 ParserTestCase.parseCompilationUnit("typedef F<E>;", [ParserErrorCode.MISSIN G_TYPEDEF_PARAMETERS]);
8979 } 9943 }
9944
8980 void test_missingTypedefParameters_void() { 9945 void test_missingTypedefParameters_void() {
8981 ParserTestCase.parseCompilationUnit("typedef void F;", [ParserErrorCode.MISS ING_TYPEDEF_PARAMETERS]); 9946 ParserTestCase.parseCompilationUnit("typedef void F;", [ParserErrorCode.MISS ING_TYPEDEF_PARAMETERS]);
8982 } 9947 }
9948
8983 void test_missingVariableInForEach() { 9949 void test_missingVariableInForEach() {
8984 ParserTestCase.parse5("parseForStatement", "for (a < b in foo) {}", [ParserE rrorCode.MISSING_VARIABLE_IN_FOR_EACH]); 9950 ParserTestCase.parse5("parseForStatement", "for (a < b in foo) {}", [ParserE rrorCode.MISSING_VARIABLE_IN_FOR_EACH]);
8985 } 9951 }
9952
8986 void test_mixedParameterGroups_namedPositional() { 9953 void test_mixedParameterGroups_namedPositional() {
8987 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, [c])", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]); 9954 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, [c])", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]);
8988 } 9955 }
9956
8989 void test_mixedParameterGroups_positionalNamed() { 9957 void test_mixedParameterGroups_positionalNamed() {
8990 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], {c})", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]); 9958 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], {c})", [ParserEr rorCode.MIXED_PARAMETER_GROUPS]);
8991 } 9959 }
9960
8992 void test_multipleExtendsClauses() { 9961 void test_multipleExtendsClauses() {
8993 ParserTestCase.parseCompilationUnit("class A extends B extends C {}", [Parse rErrorCode.MULTIPLE_EXTENDS_CLAUSES]); 9962 ParserTestCase.parseCompilationUnit("class A extends B extends C {}", [Parse rErrorCode.MULTIPLE_EXTENDS_CLAUSES]);
8994 } 9963 }
9964
8995 void test_multipleImplementsClauses() { 9965 void test_multipleImplementsClauses() {
8996 ParserTestCase.parseCompilationUnit("class A implements B implements C {}", [ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES]); 9966 ParserTestCase.parseCompilationUnit("class A implements B implements C {}", [ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES]);
8997 } 9967 }
9968
8998 void test_multipleLibraryDirectives() { 9969 void test_multipleLibraryDirectives() {
8999 ParserTestCase.parseCompilationUnit("library l; library m;", [ParserErrorCod e.MULTIPLE_LIBRARY_DIRECTIVES]); 9970 ParserTestCase.parseCompilationUnit("library l; library m;", [ParserErrorCod e.MULTIPLE_LIBRARY_DIRECTIVES]);
9000 } 9971 }
9972
9001 void test_multipleNamedParameterGroups() { 9973 void test_multipleNamedParameterGroups() {
9002 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, {c})", [ParserEr rorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]); 9974 ParserTestCase.parse5("parseFormalParameterList", "(a, {b}, {c})", [ParserEr rorCode.MULTIPLE_NAMED_PARAMETER_GROUPS]);
9003 } 9975 }
9976
9004 void test_multiplePartOfDirectives() { 9977 void test_multiplePartOfDirectives() {
9005 ParserTestCase.parseCompilationUnit("part of l; part of m;", [ParserErrorCod e.MULTIPLE_PART_OF_DIRECTIVES]); 9978 ParserTestCase.parseCompilationUnit("part of l; part of m;", [ParserErrorCod e.MULTIPLE_PART_OF_DIRECTIVES]);
9006 } 9979 }
9980
9007 void test_multiplePositionalParameterGroups() { 9981 void test_multiplePositionalParameterGroups() {
9008 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], [c])", [ParserEr rorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]); 9982 ParserTestCase.parse5("parseFormalParameterList", "(a, [b], [c])", [ParserEr rorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS]);
9009 } 9983 }
9984
9010 void test_multipleVariablesInForEach() { 9985 void test_multipleVariablesInForEach() {
9011 ParserTestCase.parse5("parseForStatement", "for (int a, b in foo) {}", [Pars erErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH]); 9986 ParserTestCase.parse5("parseForStatement", "for (int a, b in foo) {}", [Pars erErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH]);
9012 } 9987 }
9988
9013 void test_multipleWithClauses() { 9989 void test_multipleWithClauses() {
9014 ParserTestCase.parseCompilationUnit("class A extends B with C with D {}", [P arserErrorCode.MULTIPLE_WITH_CLAUSES]); 9990 ParserTestCase.parseCompilationUnit("class A extends B with C with D {}", [P arserErrorCode.MULTIPLE_WITH_CLAUSES]);
9015 } 9991 }
9992
9016 void test_namedParameterOutsideGroup() { 9993 void test_namedParameterOutsideGroup() {
9017 ParserTestCase.parse5("parseFormalParameterList", "(a, b : 0)", [ParserError Code.NAMED_PARAMETER_OUTSIDE_GROUP]); 9994 ParserTestCase.parse5("parseFormalParameterList", "(a, b : 0)", [ParserError Code.NAMED_PARAMETER_OUTSIDE_GROUP]);
9018 } 9995 }
9996
9019 void test_nonConstructorFactory_field() { 9997 void test_nonConstructorFactory_field() {
9020 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 9998 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int x;", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
9021 } 9999 }
10000
9022 void test_nonConstructorFactory_method() { 10001 void test_nonConstructorFactory_method() {
9023 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]); 10002 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "factory int m() { }", [ParserErrorCode.NON_CONSTRUCTOR_FACTORY]);
9024 } 10003 }
10004
9025 void test_nonIdentifierLibraryName_library() { 10005 void test_nonIdentifierLibraryName_library() {
9026 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 10006 CompilationUnit unit = ParserTestCase.parseCompilationUnit("library 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
9027 JUnitTestCase.assertNotNull(unit); 10007 JUnitTestCase.assertNotNull(unit);
9028 } 10008 }
10009
9029 void test_nonIdentifierLibraryName_partOf() { 10010 void test_nonIdentifierLibraryName_partOf() {
9030 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]); 10011 CompilationUnit unit = ParserTestCase.parseCompilationUnit("part of 'lib';", [ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME]);
9031 JUnitTestCase.assertNotNull(unit); 10012 JUnitTestCase.assertNotNull(unit);
9032 } 10013 }
10014
9033 void test_nonPartOfDirectiveInPart_after() { 10015 void test_nonPartOfDirectiveInPart_after() {
9034 ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]); 10016 ParserTestCase.parseCompilationUnit("part of l; part 'f.dart';", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
9035 } 10017 }
10018
9036 void test_nonPartOfDirectiveInPart_before() { 10019 void test_nonPartOfDirectiveInPart_before() {
9037 ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]); 10020 ParserTestCase.parseCompilationUnit("part 'f.dart'; part of m;", [ParserErro rCode.NON_PART_OF_DIRECTIVE_IN_PART]);
9038 } 10021 }
10022
9039 void test_nonUserDefinableOperator() { 10023 void test_nonUserDefinableOperator() {
9040 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]); 10024 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "operator +=(int x ) => x + 1;", [ParserErrorCode.NON_USER_DEFINABLE_OPERATOR]);
9041 } 10025 }
10026
9042 void test_optionalAfterNormalParameters_named() { 10027 void test_optionalAfterNormalParameters_named() {
9043 ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 10028 ParserTestCase.parseCompilationUnit("f({a}, b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
9044 } 10029 }
10030
9045 void test_optionalAfterNormalParameters_positional() { 10031 void test_optionalAfterNormalParameters_positional() {
9046 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]); 10032 ParserTestCase.parseCompilationUnit("f([a], b) {}", [ParserErrorCode.NORMAL_ BEFORE_OPTIONAL_PARAMETERS]);
9047 } 10033 }
10034
9048 void test_parseCascadeSection_missingIdentifier() { 10035 void test_parseCascadeSection_missingIdentifier() {
9049 MethodInvocation methodInvocation = ParserTestCase.parse5("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]); 10036 MethodInvocation methodInvocation = ParserTestCase.parse5("parseCascadeSecti on", "..()", [ParserErrorCode.MISSING_IDENTIFIER]);
9050 JUnitTestCase.assertNull(methodInvocation.target); 10037 JUnitTestCase.assertNull(methodInvocation.target);
9051 JUnitTestCase.assertEquals("", methodInvocation.methodName.name); 10038 JUnitTestCase.assertEquals("", methodInvocation.methodName.name);
9052 EngineTestCase.assertSize(0, methodInvocation.argumentList.arguments); 10039 EngineTestCase.assertSize(0, methodInvocation.argumentList.arguments);
9053 } 10040 }
10041
9054 void test_positionalAfterNamedArgument() { 10042 void test_positionalAfterNamedArgument() {
9055 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]); 10043 ParserTestCase.parse5("parseArgumentList", "(x: 1, 2)", [ParserErrorCode.POS ITIONAL_AFTER_NAMED_ARGUMENT]);
9056 } 10044 }
10045
9057 void test_positionalParameterOutsideGroup() { 10046 void test_positionalParameterOutsideGroup() {
9058 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]); 10047 ParserTestCase.parse5("parseFormalParameterList", "(a, b = 0)", [ParserError Code.POSITIONAL_PARAMETER_OUTSIDE_GROUP]);
9059 } 10048 }
10049
9060 void test_redirectionInNonFactoryConstructor() { 10050 void test_redirectionInNonFactoryConstructor() {
9061 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C() = D;", [Parse rErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]); 10051 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "C() = D;", [Parse rErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR]);
9062 } 10052 }
10053
9063 void test_setterInFunction_block() { 10054 void test_setterInFunction_block() {
9064 ParserTestCase.parseStatement("set x(v) {_x = v;}", [ParserErrorCode.SETTER_ IN_FUNCTION]); 10055 ParserTestCase.parseStatement("set x(v) {_x = v;}", [ParserErrorCode.SETTER_ IN_FUNCTION]);
9065 } 10056 }
10057
9066 void test_setterInFunction_expression() { 10058 void test_setterInFunction_expression() {
9067 ParserTestCase.parseStatement("set x(v) => _x = v;", [ParserErrorCode.SETTER _IN_FUNCTION]); 10059 ParserTestCase.parseStatement("set x(v) => _x = v;", [ParserErrorCode.SETTER _IN_FUNCTION]);
9068 } 10060 }
10061
9069 void test_staticAfterConst() { 10062 void test_staticAfterConst() {
9070 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]); 10063 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "final static int f;", [ParserErrorCode.STATIC_AFTER_FINAL]);
9071 } 10064 }
10065
9072 void test_staticAfterFinal() { 10066 void test_staticAfterFinal() {
9073 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]); 10067 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "const static int f;", [ParserErrorCode.STATIC_AFTER_CONST]);
9074 } 10068 }
10069
9075 void test_staticAfterVar() { 10070 void test_staticAfterVar() {
9076 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]); 10071 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var static f;", [ ParserErrorCode.STATIC_AFTER_VAR]);
9077 } 10072 }
10073
9078 void test_staticConstructor() { 10074 void test_staticConstructor() {
9079 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static C.m() {}", [ParserErrorCode.STATIC_CONSTRUCTOR]); 10075 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static C.m() {}", [ParserErrorCode.STATIC_CONSTRUCTOR]);
9080 } 10076 }
10077
9081 void test_staticGetterWithoutBody() { 10078 void test_staticGetterWithoutBody() {
9082 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static get m;", [ ParserErrorCode.STATIC_GETTER_WITHOUT_BODY]); 10079 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static get m;", [ ParserErrorCode.STATIC_GETTER_WITHOUT_BODY]);
9083 } 10080 }
10081
9084 void test_staticOperator_noReturnType() { 10082 void test_staticOperator_noReturnType() {
9085 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static operator + (int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]); 10083 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static operator + (int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]);
9086 } 10084 }
10085
9087 void test_staticOperator_returnType() { 10086 void test_staticOperator_returnType() {
9088 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static int operat or +(int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]); 10087 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static int operat or +(int x) => x + 1;", [ParserErrorCode.STATIC_OPERATOR]);
9089 } 10088 }
10089
9090 void test_staticSetterWithoutBody() { 10090 void test_staticSetterWithoutBody() {
9091 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static set m(x);" , [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]); 10091 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "static set m(x);" , [ParserErrorCode.STATIC_SETTER_WITHOUT_BODY]);
9092 } 10092 }
10093
9093 void test_staticTopLevelDeclaration_class() { 10094 void test_staticTopLevelDeclaration_class() {
9094 ParserTestCase.parseCompilationUnit("static class C {}", [ParserErrorCode.ST ATIC_TOP_LEVEL_DECLARATION]); 10095 ParserTestCase.parseCompilationUnit("static class C {}", [ParserErrorCode.ST ATIC_TOP_LEVEL_DECLARATION]);
9095 } 10096 }
10097
9096 void test_staticTopLevelDeclaration_function() { 10098 void test_staticTopLevelDeclaration_function() {
9097 ParserTestCase.parseCompilationUnit("static f() {}", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]); 10099 ParserTestCase.parseCompilationUnit("static f() {}", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]);
9098 } 10100 }
10101
9099 void test_staticTopLevelDeclaration_typedef() { 10102 void test_staticTopLevelDeclaration_typedef() {
9100 ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode. STATIC_TOP_LEVEL_DECLARATION]); 10103 ParserTestCase.parseCompilationUnit("static typedef F();", [ParserErrorCode. STATIC_TOP_LEVEL_DECLARATION]);
9101 } 10104 }
10105
9102 void test_staticTopLevelDeclaration_variable() { 10106 void test_staticTopLevelDeclaration_variable() {
9103 ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]); 10107 ParserTestCase.parseCompilationUnit("static var x;", [ParserErrorCode.STATIC _TOP_LEVEL_DECLARATION]);
9104 } 10108 }
10109
9105 void test_switchHasCaseAfterDefaultCase() { 10110 void test_switchHasCaseAfterDefaultCase() {
9106 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 10111 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1;}", [ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
9107 } 10112 }
10113
9108 void test_switchHasCaseAfterDefaultCase_repeated() { 10114 void test_switchHasCaseAfterDefaultCase_repeated() {
9109 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1; case 2: return 2;}", [ 10115 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; case 1: return 1; case 2: return 2;}", [
9110 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, 10116 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE,
9111 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]); 10117 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE]);
9112 } 10118 }
10119
9113 void test_switchHasMultipleDefaultCases() { 10120 void test_switchHasMultipleDefaultCases() {
9114 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]); 10121 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1;}", [ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
9115 } 10122 }
10123
9116 void test_switchHasMultipleDefaultCases_repeated() { 10124 void test_switchHasMultipleDefaultCases_repeated() {
9117 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1; default: return 2;}", [ 10125 ParserTestCase.parse5("parseSwitchStatement", "switch (a) {default: return 0 ; default: return 1; default: return 2;}", [
9118 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, 10126 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
9119 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]); 10127 ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES]);
9120 } 10128 }
10129
9121 void test_topLevelOperator_withoutType() { 10130 void test_topLevelOperator_withoutType() {
9122 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_LEVEL _OPERATOR]); 10131 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_LEVEL _OPERATOR]);
9123 } 10132 }
10133
9124 void test_topLevelOperator_withType() { 10134 void test_topLevelOperator_withType() {
9125 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "bool operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]); 10135 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "bool operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]);
9126 } 10136 }
10137
9127 void test_topLevelOperator_withVoid() { 10138 void test_topLevelOperator_withVoid() {
9128 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]); 10139 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void operator +(bool x, bool y) => x | y;", [ParserErrorCode.TOP_ LEVEL_OPERATOR]);
9129 } 10140 }
10141
9130 void test_unexpectedTerminatorForParameterGroup_named() { 10142 void test_unexpectedTerminatorForParameterGroup_named() {
9131 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 10143 ParserTestCase.parse5("parseFormalParameterList", "(a, b})", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
9132 } 10144 }
10145
9133 void test_unexpectedTerminatorForParameterGroup_optional() { 10146 void test_unexpectedTerminatorForParameterGroup_optional() {
9134 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]); 10147 ParserTestCase.parse5("parseFormalParameterList", "(a, b])", [ParserErrorCod e.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP]);
9135 } 10148 }
10149
9136 void test_unexpectedToken_semicolonBetweenClassMembers() { 10150 void test_unexpectedToken_semicolonBetweenClassMembers() {
9137 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ; 10151 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class C { int x; ; int y;}", [ParserErrorCode.UNEXPECTED_TOKEN]) ;
9138 } 10152 }
10153
9139 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() { 10154 void test_unexpectedToken_semicolonBetweenCompilationUnitMembers() {
9140 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]); 10155 ParserTestCase.parseCompilationUnit("int x; ; int y;", [ParserErrorCode.UNEX PECTED_TOKEN]);
9141 } 10156 }
10157
9142 void test_useOfUnaryPlusOperator() { 10158 void test_useOfUnaryPlusOperator() {
9143 SimpleIdentifier expression = ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]); 10159 SimpleIdentifier expression = ParserTestCase.parse5("parseUnaryExpression", "+x", [ParserErrorCode.MISSING_IDENTIFIER]);
9144 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression); 10160 EngineTestCase.assertInstanceOf(SimpleIdentifier, expression);
9145 JUnitTestCase.assertTrue(expression.isSynthetic); 10161 JUnitTestCase.assertTrue(expression.isSynthetic);
9146 } 10162 }
10163
9147 void test_varAndType_field() { 10164 void test_varAndType_field() {
9148 ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCo de.VAR_AND_TYPE]); 10165 ParserTestCase.parseCompilationUnit("class C { var int x; }", [ParserErrorCo de.VAR_AND_TYPE]);
9149 } 10166 }
10167
9150 void test_varAndType_topLevelVariable() { 10168 void test_varAndType_topLevelVariable() {
9151 ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_T YPE]); 10169 ParserTestCase.parseCompilationUnit("var int x;", [ParserErrorCode.VAR_AND_T YPE]);
9152 } 10170 }
10171
9153 void test_varAsTypeName_as() { 10172 void test_varAsTypeName_as() {
9154 ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME ]); 10173 ParserTestCase.parseExpression("x as var", [ParserErrorCode.VAR_AS_TYPE_NAME ]);
9155 } 10174 }
10175
9156 void test_varClass() { 10176 void test_varClass() {
9157 ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_C LASS]); 10177 ParserTestCase.parseCompilationUnit("var class C {}", [ParserErrorCode.VAR_C LASS]);
9158 } 10178 }
10179
9159 void test_varReturnType() { 10180 void test_varReturnType() {
9160 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]); 10181 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "var m() {}", [Par serErrorCode.VAR_RETURN_TYPE]);
9161 } 10182 }
10183
9162 void test_varTypedef() { 10184 void test_varTypedef() {
9163 ParserTestCase.parseCompilationUnit("var typedef F();", [ParserErrorCode.VAR _TYPEDEF]); 10185 ParserTestCase.parseCompilationUnit("var typedef F();", [ParserErrorCode.VAR _TYPEDEF]);
9164 } 10186 }
10187
9165 void test_voidParameter() { 10188 void test_voidParameter() {
9166 ParserTestCase.parse5("parseNormalFormalParameter", "void a)", [ParserErrorC ode.VOID_PARAMETER]); 10189 ParserTestCase.parse5("parseNormalFormalParameter", "void a)", [ParserErrorC ode.VOID_PARAMETER]);
9167 } 10190 }
10191
9168 void test_voidVariable_parseClassMember_initializer() { 10192 void test_voidVariable_parseClassMember_initializer() {
9169 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x = 0;", [Pa rserErrorCode.VOID_VARIABLE]); 10193 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x = 0;", [Pa rserErrorCode.VOID_VARIABLE]);
9170 } 10194 }
10195
9171 void test_voidVariable_parseClassMember_noInitializer() { 10196 void test_voidVariable_parseClassMember_noInitializer() {
9172 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x;", [Parser ErrorCode.VOID_VARIABLE]); 10197 ParserTestCase.parse4("parseClassMember", <Object> ["C"], "void x;", [Parser ErrorCode.VOID_VARIABLE]);
9173 } 10198 }
10199
9174 void test_voidVariable_parseCompilationUnit_initializer() { 10200 void test_voidVariable_parseCompilationUnit_initializer() {
9175 ParserTestCase.parseCompilationUnit("void x = 0;", [ParserErrorCode.VOID_VAR IABLE]); 10201 ParserTestCase.parseCompilationUnit("void x = 0;", [ParserErrorCode.VOID_VAR IABLE]);
9176 } 10202 }
10203
9177 void test_voidVariable_parseCompilationUnit_noInitializer() { 10204 void test_voidVariable_parseCompilationUnit_noInitializer() {
9178 ParserTestCase.parseCompilationUnit("void x;", [ParserErrorCode.VOID_VARIABL E]); 10205 ParserTestCase.parseCompilationUnit("void x;", [ParserErrorCode.VOID_VARIABL E]);
9179 } 10206 }
10207
9180 void test_voidVariable_parseCompilationUnitMember_initializer() { 10208 void test_voidVariable_parseCompilationUnitMember_initializer() {
9181 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void a = 0;", [ParserErrorCode.VOID_VARIABLE]); 10209 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void a = 0;", [ParserErrorCode.VOID_VARIABLE]);
9182 } 10210 }
10211
9183 void test_voidVariable_parseCompilationUnitMember_noInitializer() { 10212 void test_voidVariable_parseCompilationUnitMember_noInitializer() {
9184 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void a;", [ParserErrorCode.VOID_VARIABLE]); 10213 ParserTestCase.parse4("parseCompilationUnitMember", <Object> [emptyCommentAn dMetadata()], "void a;", [ParserErrorCode.VOID_VARIABLE]);
9185 } 10214 }
10215
9186 void test_voidVariable_statement_initializer() { 10216 void test_voidVariable_statement_initializer() {
9187 ParserTestCase.parseStatement("void x = 0;", [ 10217 ParserTestCase.parseStatement("void x = 0;", [
9188 ParserErrorCode.VOID_VARIABLE, 10218 ParserErrorCode.VOID_VARIABLE,
9189 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]); 10219 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
9190 } 10220 }
10221
9191 void test_voidVariable_statement_noInitializer() { 10222 void test_voidVariable_statement_noInitializer() {
9192 ParserTestCase.parseStatement("void x;", [ 10223 ParserTestCase.parseStatement("void x;", [
9193 ParserErrorCode.VOID_VARIABLE, 10224 ParserErrorCode.VOID_VARIABLE,
9194 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]); 10225 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE]);
9195 } 10226 }
10227
9196 void test_withBeforeExtends() { 10228 void test_withBeforeExtends() {
9197 ParserTestCase.parseCompilationUnit("class A with B extends C {}", [ParserEr rorCode.WITH_BEFORE_EXTENDS]); 10229 ParserTestCase.parseCompilationUnit("class A with B extends C {}", [ParserEr rorCode.WITH_BEFORE_EXTENDS]);
9198 } 10230 }
10231
9199 void test_withWithoutExtends() { 10232 void test_withWithoutExtends() {
9200 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]); 10233 ParserTestCase.parse4("parseClassDeclaration", <Object> [emptyCommentAndMeta data(), null], "class A with B, C {}", [ParserErrorCode.WITH_WITHOUT_EXTENDS]);
9201 } 10234 }
10235
9202 void test_wrongSeparatorForNamedParameter() { 10236 void test_wrongSeparatorForNamedParameter() {
9203 ParserTestCase.parse5("parseFormalParameterList", "(a, {b = 0})", [ParserErr orCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]); 10237 ParserTestCase.parse5("parseFormalParameterList", "(a, {b = 0})", [ParserErr orCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER]);
9204 } 10238 }
10239
9205 void test_wrongSeparatorForPositionalParameter() { 10240 void test_wrongSeparatorForPositionalParameter() {
9206 ParserTestCase.parse5("parseFormalParameterList", "(a, [b : 0])", [ParserErr orCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]); 10241 ParserTestCase.parse5("parseFormalParameterList", "(a, [b : 0])", [ParserErr orCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER]);
9207 } 10242 }
10243
9208 void test_wrongTerminatorForParameterGroup_named() { 10244 void test_wrongTerminatorForParameterGroup_named() {
9209 ParserTestCase.parse5("parseFormalParameterList", "(a, {b, c])", [ParserErro rCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]); 10245 ParserTestCase.parse5("parseFormalParameterList", "(a, {b, c])", [ParserErro rCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
9210 } 10246 }
10247
9211 void test_wrongTerminatorForParameterGroup_optional() { 10248 void test_wrongTerminatorForParameterGroup_optional() {
9212 ParserTestCase.parse5("parseFormalParameterList", "(a, [b, c})", [ParserErro rCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]); 10249 ParserTestCase.parse5("parseFormalParameterList", "(a, [b, c})", [ParserErro rCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP]);
9213 } 10250 }
10251
9214 static dartSuite() { 10252 static dartSuite() {
9215 _ut.group('ErrorParserTest', () { 10253 _ut.group('ErrorParserTest', () {
9216 _ut.test('test_abstractClassMember_constructor', () { 10254 _ut.test('test_abstractClassMember_constructor', () {
9217 final __test = new ErrorParserTest(); 10255 final __test = new ErrorParserTest();
9218 runJUnitTest(__test, __test.test_abstractClassMember_constructor); 10256 runJUnitTest(__test, __test.test_abstractClassMember_constructor);
9219 }); 10257 });
9220 _ut.test('test_abstractClassMember_field', () { 10258 _ut.test('test_abstractClassMember_field', () {
9221 final __test = new ErrorParserTest(); 10259 final __test = new ErrorParserTest();
9222 runJUnitTest(__test, __test.test_abstractClassMember_field); 10260 runJUnitTest(__test, __test.test_abstractClassMember_field);
9223 }); 10261 });
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
10161 final __test = new ErrorParserTest(); 11199 final __test = new ErrorParserTest();
10162 runJUnitTest(__test, __test.test_wrongTerminatorForParameterGroup_named) ; 11200 runJUnitTest(__test, __test.test_wrongTerminatorForParameterGroup_named) ;
10163 }); 11201 });
10164 _ut.test('test_wrongTerminatorForParameterGroup_optional', () { 11202 _ut.test('test_wrongTerminatorForParameterGroup_optional', () {
10165 final __test = new ErrorParserTest(); 11203 final __test = new ErrorParserTest();
10166 runJUnitTest(__test, __test.test_wrongTerminatorForParameterGroup_option al); 11204 runJUnitTest(__test, __test.test_wrongTerminatorForParameterGroup_option al);
10167 }); 11205 });
10168 }); 11206 });
10169 } 11207 }
10170 } 11208 }
11209
10171 main() { 11210 main() {
10172 ComplexParserTest.dartSuite(); 11211 ComplexParserTest.dartSuite();
10173 ErrorParserTest.dartSuite(); 11212 ErrorParserTest.dartSuite();
10174 IncrementalParserTest.dartSuite(); 11213 IncrementalParserTest.dartSuite();
10175 RecoveryParserTest.dartSuite(); 11214 RecoveryParserTest.dartSuite();
10176 ResolutionCopierTest.dartSuite(); 11215 ResolutionCopierTest.dartSuite();
10177 SimpleParserTest.dartSuite(); 11216 SimpleParserTest.dartSuite();
10178 } 11217 }
10179 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> { 11218 Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
10180 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)), 11219 'parseCompilationUnit_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.parseCompilationUnit(arg0)),
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
10319 'parseUnaryExpression_0': new MethodTrampoline(0, (Parser target) => target.pa rseUnaryExpression()), 11358 'parseUnaryExpression_0': new MethodTrampoline(0, (Parser target) => target.pa rseUnaryExpression()),
10320 'parseVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => targe t.parseVariableDeclaration()), 11359 'parseVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => targe t.parseVariableDeclaration()),
10321 'parseVariableDeclarationList_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.parseVariableDeclarationList(arg0)), 11360 'parseVariableDeclarationList_1': new MethodTrampoline(1, (Parser target, arg0 ) => target.parseVariableDeclarationList(arg0)),
10322 'parseVariableDeclarationList_3': new MethodTrampoline(3, (Parser target, arg0 , arg1, arg2) => target.parseVariableDeclarationList2(arg0, arg1, arg2)), 11361 'parseVariableDeclarationList_3': new MethodTrampoline(3, (Parser target, arg0 , arg1, arg2) => target.parseVariableDeclarationList2(arg0, arg1, arg2)),
10323 'parseVariableDeclarationStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseVariableDeclarationStatement(arg0)), 11362 'parseVariableDeclarationStatement_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseVariableDeclarationStatement(arg0)),
10324 'parseVariableDeclarationStatement_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.parseVariableDeclarationStatement2(arg0, arg1, arg2 )), 11363 'parseVariableDeclarationStatement_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.parseVariableDeclarationStatement2(arg0, arg1, arg2 )),
10325 'parseWhileStatement_0': new MethodTrampoline(0, (Parser target) => target.par seWhileStatement()), 11364 'parseWhileStatement_0': new MethodTrampoline(0, (Parser target) => target.par seWhileStatement()),
10326 'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()), 11365 'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()),
10327 'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)) , 11366 'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)) ,
10328 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)), 11367 'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)),
10329 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target .reportError8(arg0, arg1)), 11368 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target .reportError9(arg0, arg1)),
10330 'scrapeTodoComment_1': new MethodTrampoline(1, (Parser target, arg0) => target .scrapeTodoComment(arg0)), 11369 'scrapeTodoComment_1': new MethodTrampoline(1, (Parser target, arg0) => target .scrapeTodoComment(arg0)),
10331 'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)), 11370 'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)),
10332 'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)), 11371 'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)),
10333 'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipPastMatchingToken(arg0)), 11372 'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => ta rget.skipPastMatchingToken(arg0)),
10334 'skipPrefixedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => t arget.skipPrefixedIdentifier(arg0)), 11373 'skipPrefixedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => t arget.skipPrefixedIdentifier(arg0)),
10335 'skipReturnType_1': new MethodTrampoline(1, (Parser target, arg0) => target.sk ipReturnType(arg0)), 11374 'skipReturnType_1': new MethodTrampoline(1, (Parser target, arg0) => target.sk ipReturnType(arg0)),
10336 'skipSimpleIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipSimpleIdentifier(arg0)), 11375 'skipSimpleIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipSimpleIdentifier(arg0)),
10337 'skipStringInterpolation_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipStringInterpolation(arg0)), 11376 'skipStringInterpolation_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipStringInterpolation(arg0)),
10338 'skipStringLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => target .skipStringLiteral(arg0)), 11377 'skipStringLiteral_1': new MethodTrampoline(1, (Parser target, arg0) => target .skipStringLiteral(arg0)),
10339 'skipTypeArgumentList_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipTypeArgumentList(arg0)), 11378 'skipTypeArgumentList_1': new MethodTrampoline(1, (Parser target, arg0) => tar get.skipTypeArgumentList(arg0)),
(...skipping 11 matching lines...) Expand all
10351 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), 11390 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelFunction(arg0)),
10352 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), 11391 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ et, arg0) => target.validateModifiersForTopLevelVariable(arg0)),
10353 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),}; 11392 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0) => target.validateModifiersForTypedef(arg0)),};
10354 11393
10355 11394
10356 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) { 11395 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj ects, Token tokenStream) {
10357 parser.currentToken = tokenStream; 11396 parser.currentToken = tokenStream;
10358 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} ']; 11397 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length} '];
10359 return method.invoke(parser, objects); 11398 return method.invoke(parser, objects);
10360 } 11399 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698