| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | 8 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 8001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8012 {AnalysisErrorListener listener}) { | 8012 {AnalysisErrorListener listener}) { |
| 8013 listener ??= AnalysisErrorListener.NULL_LISTENER; | 8013 listener ??= AnalysisErrorListener.NULL_LISTENER; |
| 8014 Scanner scanner = new Scanner(null, new CharSequenceReader(code), listener); | 8014 Scanner scanner = new Scanner(null, new CharSequenceReader(code), listener); |
| 8015 Token token = scanner.tokenize(); | 8015 Token token = scanner.tokenize(); |
| 8016 Parser parser = new Parser(null, listener); | 8016 Parser parser = new Parser(null, listener); |
| 8017 CompilationUnit unit = parser.parseCompilationUnit(token); | 8017 CompilationUnit unit = parser.parseCompilationUnit(token); |
| 8018 unit.lineInfo = new LineInfo(scanner.lineStarts); | 8018 unit.lineInfo = new LineInfo(scanner.lineStarts); |
| 8019 return unit; | 8019 return unit; |
| 8020 } | 8020 } |
| 8021 | 8021 |
| 8022 /** | |
| 8023 * Parse the given [source] as a compilation unit. Throw an exception if the | |
| 8024 * source could not be parsed, if the compilation errors in the source do not | |
| 8025 * match those that are expected, or if the result would have been `null`. | |
| 8026 */ | |
| 8027 CompilationUnit parseCompilationUnitWithOptions(String source, | |
| 8028 [List<ErrorCode> errorCodes = const <ErrorCode>[]]) { | |
| 8029 createParser(source); | |
| 8030 CompilationUnit unit = parser.parseCompilationUnit2(); | |
| 8031 expect(unit, isNotNull); | |
| 8032 listener.assertErrorsWithCodes(errorCodes); | |
| 8033 return unit; | |
| 8034 } | |
| 8035 | |
| 8036 @override | 8022 @override |
| 8037 ConditionalExpression parseConditionalExpression(String code) { | 8023 ConditionalExpression parseConditionalExpression(String code) { |
| 8038 createParser(code); | 8024 createParser(code); |
| 8039 return parser.parseConditionalExpression(); | 8025 return parser.parseConditionalExpression(); |
| 8040 } | 8026 } |
| 8041 | 8027 |
| 8042 @override | 8028 @override |
| 8043 Expression parseConstExpression(String code) { | 8029 Expression parseConstExpression(String code) { |
| 8044 createParser(code); | 8030 createParser(code); |
| 8045 return parser.parseConstExpression(); | 8031 return parser.parseConstExpression(); |
| (...skipping 6727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14773 expectCommentText(typeVariable.documentationComment, '/// Doc'); | 14759 expectCommentText(typeVariable.documentationComment, '/// Doc'); |
| 14774 } | 14760 } |
| 14775 | 14761 |
| 14776 /** | 14762 /** |
| 14777 * Assert that the given [name] is in declaration context. | 14763 * Assert that the given [name] is in declaration context. |
| 14778 */ | 14764 */ |
| 14779 void _assertIsDeclarationName(SimpleIdentifier name) { | 14765 void _assertIsDeclarationName(SimpleIdentifier name) { |
| 14780 expect(name.inDeclarationContext(), isTrue); | 14766 expect(name.inDeclarationContext(), isTrue); |
| 14781 } | 14767 } |
| 14782 } | 14768 } |
| OLD | NEW |