| 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/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 3998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4009 | 4009 |
| 4010 void test_missingIdentifier_afterAnnotation() { | 4010 void test_missingIdentifier_afterAnnotation() { |
| 4011 MethodDeclaration method = parse3("parseClassMember", <Object>["C"], | 4011 MethodDeclaration method = parse3("parseClassMember", <Object>["C"], |
| 4012 "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]); | 4012 "@override }", [ParserErrorCode.EXPECTED_CLASS_MEMBER]); |
| 4013 expect(method.documentationComment, isNull); | 4013 expect(method.documentationComment, isNull); |
| 4014 NodeList<Annotation> metadata = method.metadata; | 4014 NodeList<Annotation> metadata = method.metadata; |
| 4015 expect(metadata, hasLength(1)); | 4015 expect(metadata, hasLength(1)); |
| 4016 expect(metadata[0].name.name, "override"); | 4016 expect(metadata[0].name.name, "override"); |
| 4017 } | 4017 } |
| 4018 | 4018 |
| 4019 void test_missingSemicolon_varialeDeclarationList() { |
| 4020 void verify(CompilationUnitMember member, String expectedTypeName, |
| 4021 String expectedName, String expectedSemicolon) { |
| 4022 expect(member, new isInstanceOf<TopLevelVariableDeclaration>()); |
| 4023 TopLevelVariableDeclaration declaration = member; |
| 4024 VariableDeclarationList variableList = declaration.variables; |
| 4025 expect(variableList, isNotNull); |
| 4026 NodeList<VariableDeclaration> variables = variableList.variables; |
| 4027 expect(variables, hasLength(1)); |
| 4028 VariableDeclaration variable = variables[0]; |
| 4029 expect(variableList.type.toString(), expectedTypeName); |
| 4030 expect(variable.name.name, expectedName); |
| 4031 expect(declaration.semicolon.lexeme, expectedSemicolon); |
| 4032 } |
| 4033 |
| 4034 CompilationUnit unit = ParserTestCase.parseCompilationUnit( |
| 4035 'String n x = "";', [ |
| 4036 ParserErrorCode.EXPECTED_TOKEN, |
| 4037 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE |
| 4038 ]); |
| 4039 expect(unit, isNotNull); |
| 4040 NodeList<CompilationUnitMember> declarations = unit.declarations; |
| 4041 expect(declarations, hasLength(2)); |
| 4042 verify(declarations[0], 'String', 'n', ''); |
| 4043 verify(declarations[1], 'null', 'x', ';'); |
| 4044 } |
| 4045 |
| 4019 void test_multiplicativeExpression_missing_LHS() { | 4046 void test_multiplicativeExpression_missing_LHS() { |
| 4020 BinaryExpression expression = | 4047 BinaryExpression expression = |
| 4021 parseExpression("* y", [ParserErrorCode.MISSING_IDENTIFIER]); | 4048 parseExpression("* y", [ParserErrorCode.MISSING_IDENTIFIER]); |
| 4022 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, | 4049 EngineTestCase.assertInstanceOf((obj) => obj is SimpleIdentifier, |
| 4023 SimpleIdentifier, expression.leftOperand); | 4050 SimpleIdentifier, expression.leftOperand); |
| 4024 expect(expression.leftOperand.isSynthetic, isTrue); | 4051 expect(expression.leftOperand.isSynthetic, isTrue); |
| 4025 } | 4052 } |
| 4026 | 4053 |
| 4027 void test_multiplicativeExpression_missing_LHS_RHS() { | 4054 void test_multiplicativeExpression_missing_LHS_RHS() { |
| 4028 BinaryExpression expression = parseExpression("*", [ | 4055 BinaryExpression expression = parseExpression("*", [ |
| (...skipping 7563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11592 new Scanner(null, new CharSequenceReader(source), listener); | 11619 new Scanner(null, new CharSequenceReader(source), listener); |
| 11593 Token tokenStream = scanner.tokenize(); | 11620 Token tokenStream = scanner.tokenize(); |
| 11594 // | 11621 // |
| 11595 // Parse the source. | 11622 // Parse the source. |
| 11596 // | 11623 // |
| 11597 Parser parser = new Parser(null, listener); | 11624 Parser parser = new Parser(null, listener); |
| 11598 return invokeParserMethodImpl( | 11625 return invokeParserMethodImpl( |
| 11599 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11626 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 11600 } | 11627 } |
| 11601 } | 11628 } |
| OLD | NEW |