| 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 engine.parser_test; | 5 library engine.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3262 NodeList<VariableDeclaration> vars = | 3262 NodeList<VariableDeclaration> vars = |
| 3263 (fieldDecl as FieldDeclaration).fields.variables; | 3263 (fieldDecl as FieldDeclaration).fields.variables; |
| 3264 expect(vars, hasLength(1)); | 3264 expect(vars, hasLength(1)); |
| 3265 expect(vars[0].name.name, "v"); | 3265 expect(vars[0].name.name, "v"); |
| 3266 } | 3266 } |
| 3267 | 3267 |
| 3268 void test_functionExpression_named() { | 3268 void test_functionExpression_named() { |
| 3269 parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]); | 3269 parseExpression("m(f() => 0);", [ParserErrorCode.EXPECTED_TOKEN]); |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 void test_importDirectivePartial() { |
| 3273 CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
| 3274 "import 'b.dart' d as b;", |
| 3275 [ParserErrorCode.UNEXPECTED_TOKEN]); |
| 3276 ImportDirective importDirective = unit.childEntities.first; |
| 3277 expect(importDirective.asKeyword, isNotNull); |
| 3278 expect(unit.directives, hasLength(1)); |
| 3279 expect(unit.declarations, hasLength(0)); |
| 3280 } |
| 3281 |
| 3272 void test_incomplete_conditionalExpression() { | 3282 void test_incomplete_conditionalExpression() { |
| 3273 parseExpression("x ? 0", [ | 3283 parseExpression("x ? 0", [ |
| 3274 ParserErrorCode.EXPECTED_TOKEN, | 3284 ParserErrorCode.EXPECTED_TOKEN, |
| 3275 ParserErrorCode.MISSING_IDENTIFIER | 3285 ParserErrorCode.MISSING_IDENTIFIER |
| 3276 ]); | 3286 ]); |
| 3277 } | 3287 } |
| 3278 | 3288 |
| 3279 void test_incomplete_constructorInitializers_empty() { | 3289 void test_incomplete_constructorInitializers_empty() { |
| 3280 parse3("parseClassMember", ["C"], "C() : {}", | 3290 parse3("parseClassMember", ["C"], "C() : {}", |
| 3281 [ParserErrorCode.MISSING_INITIALIZER]); | 3291 [ParserErrorCode.MISSING_INITIALIZER]); |
| (...skipping 6929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10211 new Scanner(null, new CharSequenceReader(source), listener); | 10221 new Scanner(null, new CharSequenceReader(source), listener); |
| 10212 Token tokenStream = scanner.tokenize(); | 10222 Token tokenStream = scanner.tokenize(); |
| 10213 // | 10223 // |
| 10214 // Parse the source. | 10224 // Parse the source. |
| 10215 // | 10225 // |
| 10216 Parser parser = new Parser(null, listener); | 10226 Parser parser = new Parser(null, listener); |
| 10217 return invokeParserMethodImpl( | 10227 return invokeParserMethodImpl( |
| 10218 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 10228 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 10219 } | 10229 } |
| 10220 } | 10230 } |
| OLD | NEW |