| OLD | NEW |
| 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 |
| 4 library engine.parser_test; | 4 library engine.parser_test; |
| 5 | 5 |
| 6 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 7 import 'package:analyzer/src/generated/java_junit.dart'; | 7 import 'package:analyzer/src/generated/java_junit.dart'; |
| 8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart' show Source; | 9 import 'package:analyzer/src/generated/source.dart' show Source; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| (...skipping 4386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4397 /** | 4397 /** |
| 4398 * Invoke the method [Parser#computeStringValue] with the given argument. | 4398 * Invoke the method [Parser#computeStringValue] with the given argument. |
| 4399 * | 4399 * |
| 4400 * @param lexeme the argument to the method | 4400 * @param lexeme the argument to the method |
| 4401 * @param first `true` if this is the first token in a string literal | 4401 * @param first `true` if this is the first token in a string literal |
| 4402 * @param last `true` if this is the last token in a string literal | 4402 * @param last `true` if this is the last token in a string literal |
| 4403 * @return the result of invoking the method | 4403 * @return the result of invoking the method |
| 4404 * @throws Exception if the method could not be invoked or throws an exception | 4404 * @throws Exception if the method could not be invoked or throws an exception |
| 4405 */ | 4405 */ |
| 4406 String computeStringValue(String lexeme, bool first, bool last) { | 4406 String computeStringValue(String lexeme, bool first, bool last) { |
| 4407 AnalysisErrorListener listener = new AnalysisErrorListener_26(); | 4407 AnalysisErrorListener listener = new AnalysisErrorListener_27(); |
| 4408 Parser parser = new Parser(null, listener); | 4408 Parser parser = new Parser(null, listener); |
| 4409 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
, first, last], null) as String; | 4409 return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme
, first, last], null) as String; |
| 4410 } | 4410 } |
| 4411 | 4411 |
| 4412 /** | 4412 /** |
| 4413 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token | 4413 * Invoke the method [Parser#createSyntheticIdentifier] with the parser set to
the token |
| 4414 * stream produced by scanning the given source. | 4414 * stream produced by scanning the given source. |
| 4415 * | 4415 * |
| 4416 * @param source the source to be scanned to produce the token stream being te
sted | 4416 * @param source the source to be scanned to produce the token stream being te
sted |
| 4417 * @return the result of invoking the method | 4417 * @return the result of invoking the method |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6667 runJUnitTest(__test, __test.test_skipTypeName_parameterized); | 6667 runJUnitTest(__test, __test.test_skipTypeName_parameterized); |
| 6668 }); | 6668 }); |
| 6669 _ut.test('test_skipTypeName_simple', () { | 6669 _ut.test('test_skipTypeName_simple', () { |
| 6670 final __test = new SimpleParserTest(); | 6670 final __test = new SimpleParserTest(); |
| 6671 runJUnitTest(__test, __test.test_skipTypeName_simple); | 6671 runJUnitTest(__test, __test.test_skipTypeName_simple); |
| 6672 }); | 6672 }); |
| 6673 }); | 6673 }); |
| 6674 } | 6674 } |
| 6675 } | 6675 } |
| 6676 | 6676 |
| 6677 class AnalysisErrorListener_26 implements AnalysisErrorListener { | 6677 class AnalysisErrorListener_27 implements AnalysisErrorListener { |
| 6678 void onError(AnalysisError event) { | 6678 void onError(AnalysisError event) { |
| 6679 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); | 6679 JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.
offset}, ${event.length})"); |
| 6680 } | 6680 } |
| 6681 } | 6681 } |
| 6682 | 6682 |
| 6683 class NonErrorParserTest extends ParserTestCase { | 6683 class NonErrorParserTest extends ParserTestCase { |
| 6684 void test_constFactory_external() { | 6684 void test_constFactory_external() { |
| 6685 ParserTestCase.parse("parseClassMember", <Object> ["C"], "external const fac
tory C();"); | 6685 ParserTestCase.parse("parseClassMember", <Object> ["C"], "external const fac
tory C();"); |
| 6686 } | 6686 } |
| 6687 | 6687 |
| (...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9136 }); | 9136 }); |
| 9137 _ut.test('test_typedef_eof', () { | 9137 _ut.test('test_typedef_eof', () { |
| 9138 final __test = new RecoveryParserTest(); | 9138 final __test = new RecoveryParserTest(); |
| 9139 runJUnitTest(__test, __test.test_typedef_eof); | 9139 runJUnitTest(__test, __test.test_typedef_eof); |
| 9140 }); | 9140 }); |
| 9141 }); | 9141 }); |
| 9142 } | 9142 } |
| 9143 } | 9143 } |
| 9144 | 9144 |
| 9145 class IncrementalParserTest extends EngineTestCase { | 9145 class IncrementalParserTest extends EngineTestCase { |
| 9146 void fail_delete_everything() { | 9146 void test_delete_everything() { |
| 9147 assertParse("", "f() => a + b;", "", ""); | 9147 assertParse("", "f() => a + b;", "", ""); |
| 9148 } | 9148 } |
| 9149 | 9149 |
| 9150 void test_delete_identifier_beginning() { | 9150 void test_delete_identifier_beginning() { |
| 9151 assertParse("f() => ", "ab", "", "s + b;"); | 9151 assertParse("f() => ", "ab", "", "s + b;"); |
| 9152 } | 9152 } |
| 9153 | 9153 |
| 9154 void test_delete_identifier_end() { | 9154 void test_delete_identifier_end() { |
| 9155 assertParse("f() => a", "bs", "", " + b;"); | 9155 assertParse("f() => a", "bs", "", " + b;"); |
| 9156 } | 9156 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9192 } | 9192 } |
| 9193 | 9193 |
| 9194 void test_insert_newIdentifier1() { | 9194 void test_insert_newIdentifier1() { |
| 9195 assertParse("f() => a;", "", " b", " c;"); | 9195 assertParse("f() => a;", "", " b", " c;"); |
| 9196 } | 9196 } |
| 9197 | 9197 |
| 9198 void test_insert_newIdentifier2() { | 9198 void test_insert_newIdentifier2() { |
| 9199 assertParse("f() => a;", "", "b", " c;"); | 9199 assertParse("f() => a;", "", "b", " c;"); |
| 9200 } | 9200 } |
| 9201 | 9201 |
| 9202 void test_insert_newIdentifier3() { |
| 9203 assertParse("/** A simple function. */ f() => a;", "", " b", " c;"); |
| 9204 } |
| 9205 |
| 9206 void test_insert_newIdentifier4() { |
| 9207 assertParse("/** An [A]. */ class A {} class B { m() { return 1", "", " + 2"
, "; } }"); |
| 9208 } |
| 9209 |
| 9202 void test_insert_period() { | 9210 void test_insert_period() { |
| 9203 assertParse("f() => a + b", "", ".", ";"); | 9211 assertParse("f() => a + b", "", ".", ";"); |
| 9204 } | 9212 } |
| 9205 | 9213 |
| 9206 void test_insert_period_betweenIdentifiers1() { | 9214 void test_insert_period_betweenIdentifiers1() { |
| 9207 assertParse("f() => a", "", ".", " b;"); | 9215 assertParse("f() => a", "", ".", " b;"); |
| 9208 } | 9216 } |
| 9209 | 9217 |
| 9210 void test_insert_period_betweenIdentifiers2() { | 9218 void test_insert_period_betweenIdentifiers2() { |
| 9211 assertParse("f() => a ", "", ".", "b;"); | 9219 assertParse("f() => a ", "", ".", "b;"); |
| 9212 } | 9220 } |
| 9213 | 9221 |
| 9214 void test_insert_period_betweenIdentifiers3() { | 9222 void test_insert_period_betweenIdentifiers3() { |
| 9215 assertParse("f() => a ", "", ".", " b;"); | 9223 assertParse("f() => a ", "", ".", " b;"); |
| 9216 } | 9224 } |
| 9217 | 9225 |
| 9218 void test_insert_period_insideExistingIdentifier() { | 9226 void test_insert_period_insideExistingIdentifier() { |
| 9219 assertParse("f() => a", "", ".", "b;"); | 9227 assertParse("f() => a", "", ".", "b;"); |
| 9220 } | 9228 } |
| 9221 | 9229 |
| 9222 void test_insert_periodAndIdentifier() { | 9230 void test_insert_periodAndIdentifier() { |
| 9223 assertParse("f() => a + b", "", ".x", ";"); | 9231 assertParse("f() => a + b", "", ".x", ";"); |
| 9224 } | 9232 } |
| 9225 | 9233 |
| 9234 void test_insert_simpleToComplexExression() { |
| 9235 assertParse("/** An [A]. */ class A {} class B { m() => 1", "", " + 2", "; }
"); |
| 9236 } |
| 9237 |
| 9226 void test_insert_whitespace_end() { | 9238 void test_insert_whitespace_end() { |
| 9227 assertParse("f() => a + b;", "", " ", ""); | 9239 assertParse("f() => a + b;", "", " ", ""); |
| 9228 } | 9240 } |
| 9229 | 9241 |
| 9230 void test_insert_whitespace_end_multiple() { | 9242 void test_insert_whitespace_end_multiple() { |
| 9231 assertParse("f() => a + b;", "", " ", ""); | 9243 assertParse("f() => a + b;", "", " ", ""); |
| 9232 } | 9244 } |
| 9233 | 9245 |
| 9234 void test_insert_whitespace_middle() { | 9246 void test_insert_whitespace_middle() { |
| 9235 assertParse("f() => a", "", " ", " + b;"); | 9247 assertParse("f() => a", "", " ", " + b;"); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9292 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS
tart, removed.length, added.length); | 9304 Token incrementalTokens = incrementalScanner.rescan(originalTokens, replaceS
tart, removed.length, added.length); |
| 9293 JUnitTestCase.assertNotNull(incrementalTokens); | 9305 JUnitTestCase.assertNotNull(incrementalTokens); |
| 9294 IncrementalParser incrementalParser = new IncrementalParser(source, incremen
talScanner.tokenMap, incrementalListener); | 9306 IncrementalParser incrementalParser = new IncrementalParser(source, incremen
talScanner.tokenMap, incrementalListener); |
| 9295 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in
crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix.
length + removed.length); | 9307 CompilationUnit incrementalUnit = incrementalParser.reparse(originalUnit, in
crementalScanner.leftToken, incrementalScanner.rightToken, replaceStart, prefix.
length + removed.length); |
| 9296 JUnitTestCase.assertNotNull(incrementalUnit); | 9308 JUnitTestCase.assertNotNull(incrementalUnit); |
| 9297 JUnitTestCase.assertTrue(ASTComparator.equals4(modifiedUnit, incrementalUnit
)); | 9309 JUnitTestCase.assertTrue(ASTComparator.equals4(modifiedUnit, incrementalUnit
)); |
| 9298 } | 9310 } |
| 9299 | 9311 |
| 9300 static dartSuite() { | 9312 static dartSuite() { |
| 9301 _ut.group('IncrementalParserTest', () { | 9313 _ut.group('IncrementalParserTest', () { |
| 9314 _ut.test('test_delete_everything', () { |
| 9315 final __test = new IncrementalParserTest(); |
| 9316 runJUnitTest(__test, __test.test_delete_everything); |
| 9317 }); |
| 9302 _ut.test('test_delete_identifier_beginning', () { | 9318 _ut.test('test_delete_identifier_beginning', () { |
| 9303 final __test = new IncrementalParserTest(); | 9319 final __test = new IncrementalParserTest(); |
| 9304 runJUnitTest(__test, __test.test_delete_identifier_beginning); | 9320 runJUnitTest(__test, __test.test_delete_identifier_beginning); |
| 9305 }); | 9321 }); |
| 9306 _ut.test('test_delete_identifier_end', () { | 9322 _ut.test('test_delete_identifier_end', () { |
| 9307 final __test = new IncrementalParserTest(); | 9323 final __test = new IncrementalParserTest(); |
| 9308 runJUnitTest(__test, __test.test_delete_identifier_end); | 9324 runJUnitTest(__test, __test.test_delete_identifier_end); |
| 9309 }); | 9325 }); |
| 9310 _ut.test('test_delete_identifier_middle', () { | 9326 _ut.test('test_delete_identifier_middle', () { |
| 9311 final __test = new IncrementalParserTest(); | 9327 final __test = new IncrementalParserTest(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9344 runJUnitTest(__test, __test.test_insert_insideIdentifier); | 9360 runJUnitTest(__test, __test.test_insert_insideIdentifier); |
| 9345 }); | 9361 }); |
| 9346 _ut.test('test_insert_newIdentifier1', () { | 9362 _ut.test('test_insert_newIdentifier1', () { |
| 9347 final __test = new IncrementalParserTest(); | 9363 final __test = new IncrementalParserTest(); |
| 9348 runJUnitTest(__test, __test.test_insert_newIdentifier1); | 9364 runJUnitTest(__test, __test.test_insert_newIdentifier1); |
| 9349 }); | 9365 }); |
| 9350 _ut.test('test_insert_newIdentifier2', () { | 9366 _ut.test('test_insert_newIdentifier2', () { |
| 9351 final __test = new IncrementalParserTest(); | 9367 final __test = new IncrementalParserTest(); |
| 9352 runJUnitTest(__test, __test.test_insert_newIdentifier2); | 9368 runJUnitTest(__test, __test.test_insert_newIdentifier2); |
| 9353 }); | 9369 }); |
| 9370 _ut.test('test_insert_newIdentifier3', () { |
| 9371 final __test = new IncrementalParserTest(); |
| 9372 runJUnitTest(__test, __test.test_insert_newIdentifier3); |
| 9373 }); |
| 9374 _ut.test('test_insert_newIdentifier4', () { |
| 9375 final __test = new IncrementalParserTest(); |
| 9376 runJUnitTest(__test, __test.test_insert_newIdentifier4); |
| 9377 }); |
| 9354 _ut.test('test_insert_period', () { | 9378 _ut.test('test_insert_period', () { |
| 9355 final __test = new IncrementalParserTest(); | 9379 final __test = new IncrementalParserTest(); |
| 9356 runJUnitTest(__test, __test.test_insert_period); | 9380 runJUnitTest(__test, __test.test_insert_period); |
| 9357 }); | 9381 }); |
| 9358 _ut.test('test_insert_periodAndIdentifier', () { | 9382 _ut.test('test_insert_periodAndIdentifier', () { |
| 9359 final __test = new IncrementalParserTest(); | 9383 final __test = new IncrementalParserTest(); |
| 9360 runJUnitTest(__test, __test.test_insert_periodAndIdentifier); | 9384 runJUnitTest(__test, __test.test_insert_periodAndIdentifier); |
| 9361 }); | 9385 }); |
| 9362 _ut.test('test_insert_period_betweenIdentifiers1', () { | 9386 _ut.test('test_insert_period_betweenIdentifiers1', () { |
| 9363 final __test = new IncrementalParserTest(); | 9387 final __test = new IncrementalParserTest(); |
| 9364 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers1); | 9388 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers1); |
| 9365 }); | 9389 }); |
| 9366 _ut.test('test_insert_period_betweenIdentifiers2', () { | 9390 _ut.test('test_insert_period_betweenIdentifiers2', () { |
| 9367 final __test = new IncrementalParserTest(); | 9391 final __test = new IncrementalParserTest(); |
| 9368 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers2); | 9392 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers2); |
| 9369 }); | 9393 }); |
| 9370 _ut.test('test_insert_period_betweenIdentifiers3', () { | 9394 _ut.test('test_insert_period_betweenIdentifiers3', () { |
| 9371 final __test = new IncrementalParserTest(); | 9395 final __test = new IncrementalParserTest(); |
| 9372 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers3); | 9396 runJUnitTest(__test, __test.test_insert_period_betweenIdentifiers3); |
| 9373 }); | 9397 }); |
| 9374 _ut.test('test_insert_period_insideExistingIdentifier', () { | 9398 _ut.test('test_insert_period_insideExistingIdentifier', () { |
| 9375 final __test = new IncrementalParserTest(); | 9399 final __test = new IncrementalParserTest(); |
| 9376 runJUnitTest(__test, __test.test_insert_period_insideExistingIdentifier)
; | 9400 runJUnitTest(__test, __test.test_insert_period_insideExistingIdentifier)
; |
| 9377 }); | 9401 }); |
| 9402 _ut.test('test_insert_simpleToComplexExression', () { |
| 9403 final __test = new IncrementalParserTest(); |
| 9404 runJUnitTest(__test, __test.test_insert_simpleToComplexExression); |
| 9405 }); |
| 9378 _ut.test('test_insert_whitespace_end', () { | 9406 _ut.test('test_insert_whitespace_end', () { |
| 9379 final __test = new IncrementalParserTest(); | 9407 final __test = new IncrementalParserTest(); |
| 9380 runJUnitTest(__test, __test.test_insert_whitespace_end); | 9408 runJUnitTest(__test, __test.test_insert_whitespace_end); |
| 9381 }); | 9409 }); |
| 9382 _ut.test('test_insert_whitespace_end_multiple', () { | 9410 _ut.test('test_insert_whitespace_end_multiple', () { |
| 9383 final __test = new IncrementalParserTest(); | 9411 final __test = new IncrementalParserTest(); |
| 9384 runJUnitTest(__test, __test.test_insert_whitespace_end_multiple); | 9412 runJUnitTest(__test, __test.test_insert_whitespace_end_multiple); |
| 9385 }); | 9413 }); |
| 9386 _ut.test('test_insert_whitespace_middle', () { | 9414 _ut.test('test_insert_whitespace_middle', () { |
| 9387 final __test = new IncrementalParserTest(); | 9415 final __test = new IncrementalParserTest(); |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11604 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), | 11632 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelFunction(arg0)), |
| 11605 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), | 11633 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, (Parser targ
et, arg0) => target.validateModifiersForTopLevelVariable(arg0)), |
| 11606 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; | 11634 'validateModifiersForTypedef_1': new MethodTrampoline(1, (Parser target, arg0)
=> target.validateModifiersForTypedef(arg0)),}; |
| 11607 | 11635 |
| 11608 | 11636 |
| 11609 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { | 11637 Object invokeParserMethodImpl(Parser parser, String methodName, List<Object> obj
ects, Token tokenStream) { |
| 11610 parser.currentToken = tokenStream; | 11638 parser.currentToken = tokenStream; |
| 11611 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; | 11639 MethodTrampoline method = _methodTable_Parser['${methodName}_${objects.length}
']; |
| 11612 return method.invoke(parser, objects); | 11640 return method.invoke(parser, objects); |
| 11613 } | 11641 } |
| OLD | NEW |