| 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/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/incremental_scanner.dart'; | 10 import 'package:analyzer/src/generated/incremental_scanner.dart'; |
| (...skipping 7136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7147 void test_parseFormalParameterList_positional_single() { | 7147 void test_parseFormalParameterList_positional_single() { |
| 7148 FormalParameterList parameterList = | 7148 FormalParameterList parameterList = |
| 7149 parse4("parseFormalParameterList", "([A a = null])"); | 7149 parse4("parseFormalParameterList", "([A a = null])"); |
| 7150 expect(parameterList.leftParenthesis, isNotNull); | 7150 expect(parameterList.leftParenthesis, isNotNull); |
| 7151 expect(parameterList.leftDelimiter, isNotNull); | 7151 expect(parameterList.leftDelimiter, isNotNull); |
| 7152 expect(parameterList.parameters, hasLength(1)); | 7152 expect(parameterList.parameters, hasLength(1)); |
| 7153 expect(parameterList.rightDelimiter, isNotNull); | 7153 expect(parameterList.rightDelimiter, isNotNull); |
| 7154 expect(parameterList.rightParenthesis, isNotNull); | 7154 expect(parameterList.rightParenthesis, isNotNull); |
| 7155 } | 7155 } |
| 7156 | 7156 |
| 7157 void test_parseFormalParameterList_prefixedType() { |
| 7158 FormalParameterList parameterList = |
| 7159 parse4("parseFormalParameterList", "(io.File f)"); |
| 7160 expect(parameterList.leftParenthesis, isNotNull); |
| 7161 expect(parameterList.leftDelimiter, isNull); |
| 7162 expect(parameterList.parameters, hasLength(1)); |
| 7163 expect(parameterList.parameters[0].toSource(), 'io.File f'); |
| 7164 expect(parameterList.rightDelimiter, isNull); |
| 7165 expect(parameterList.rightParenthesis, isNotNull); |
| 7166 } |
| 7167 |
| 7168 void test_parseFormalParameterList_prefixedType_partial() { |
| 7169 FormalParameterList parameterList = |
| 7170 parse4("parseFormalParameterList", "(io.)", [ |
| 7171 ParserErrorCode.MISSING_IDENTIFIER, |
| 7172 ParserErrorCode.MISSING_IDENTIFIER]); |
| 7173 expect(parameterList.leftParenthesis, isNotNull); |
| 7174 expect(parameterList.leftDelimiter, isNull); |
| 7175 expect(parameterList.parameters, hasLength(1)); |
| 7176 expect(parameterList.parameters[0].toSource(), 'io. '); |
| 7177 expect(parameterList.rightDelimiter, isNull); |
| 7178 expect(parameterList.rightParenthesis, isNotNull); |
| 7179 } |
| 7180 |
| 7181 void test_parseFormalParameterList_prefixedType_partial2() { |
| 7182 FormalParameterList parameterList = |
| 7183 parse4("parseFormalParameterList", "(io.,a)", [ |
| 7184 ParserErrorCode.MISSING_IDENTIFIER, |
| 7185 ParserErrorCode.MISSING_IDENTIFIER]); |
| 7186 expect(parameterList.leftParenthesis, isNotNull); |
| 7187 expect(parameterList.leftDelimiter, isNull); |
| 7188 expect(parameterList.parameters, hasLength(2)); |
| 7189 expect(parameterList.parameters[0].toSource(), 'io. '); |
| 7190 expect(parameterList.parameters[1].toSource(), 'a'); |
| 7191 expect(parameterList.rightDelimiter, isNull); |
| 7192 expect(parameterList.rightParenthesis, isNotNull); |
| 7193 } |
| 7194 |
| 7157 void test_parseForStatement_each_await() { | 7195 void test_parseForStatement_each_await() { |
| 7158 ForEachStatement statement = | 7196 ForEachStatement statement = |
| 7159 parse4("parseForStatement", "await for (element in list) {}"); | 7197 parse4("parseForStatement", "await for (element in list) {}"); |
| 7160 expect(statement.awaitKeyword, isNotNull); | 7198 expect(statement.awaitKeyword, isNotNull); |
| 7161 expect(statement.forKeyword, isNotNull); | 7199 expect(statement.forKeyword, isNotNull); |
| 7162 expect(statement.leftParenthesis, isNotNull); | 7200 expect(statement.leftParenthesis, isNotNull); |
| 7163 expect(statement.loopVariable, isNull); | 7201 expect(statement.loopVariable, isNull); |
| 7164 expect(statement.identifier, isNotNull); | 7202 expect(statement.identifier, isNotNull); |
| 7165 expect(statement.inKeyword, isNotNull); | 7203 expect(statement.inKeyword, isNotNull); |
| 7166 expect(statement.iterable, isNotNull); | 7204 expect(statement.iterable, isNotNull); |
| (...skipping 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9901 new Scanner(null, new CharSequenceReader(source), listener); | 9939 new Scanner(null, new CharSequenceReader(source), listener); |
| 9902 Token tokenStream = scanner.tokenize(); | 9940 Token tokenStream = scanner.tokenize(); |
| 9903 // | 9941 // |
| 9904 // Parse the source. | 9942 // Parse the source. |
| 9905 // | 9943 // |
| 9906 Parser parser = new Parser(null, listener); | 9944 Parser parser = new Parser(null, listener); |
| 9907 return invokeParserMethodImpl( | 9945 return invokeParserMethodImpl( |
| 9908 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 9946 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 9909 } | 9947 } |
| 9910 } | 9948 } |
| OLD | NEW |