| 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.testing.ast_factory; | 5 library engine.testing.ast_factory; |
| 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/scanner.dart'; | 9 import 'package:analyzer/src/generated/scanner.dart'; |
| 10 import 'package:analyzer/src/generated/testing/token_factory.dart'; | 10 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 arguments); | 39 arguments); |
| 40 | 40 |
| 41 static ArgumentList argumentList([List<Expression> arguments]) => | 41 static ArgumentList argumentList([List<Expression> arguments]) => |
| 42 new ArgumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 42 new ArgumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 43 arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); | 43 arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN)); |
| 44 | 44 |
| 45 static AsExpression asExpression(Expression expression, TypeName type) => | 45 static AsExpression asExpression(Expression expression, TypeName type) => |
| 46 new AsExpression( | 46 new AsExpression( |
| 47 expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); | 47 expression, TokenFactory.tokenFromKeyword(Keyword.AS), type); |
| 48 | 48 |
| 49 static AssertStatement assertStatement(Expression condition) => | 49 static AssertStatement assertStatement(Expression condition, |
| 50 new AssertStatement( | 50 [Expression message]) => |
| 51 new AssertStatement.withOptionalMessage( |
| 51 TokenFactory.tokenFromKeyword(Keyword.ASSERT), | 52 TokenFactory.tokenFromKeyword(Keyword.ASSERT), |
| 52 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), | 53 TokenFactory.tokenFromType(TokenType.OPEN_PAREN), |
| 53 condition, | 54 condition, |
| 55 message == null ? null : TokenFactory.tokenFromType(TokenType.COMMA), |
| 56 message, |
| 54 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), | 57 TokenFactory.tokenFromType(TokenType.CLOSE_PAREN), |
| 55 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 58 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 56 | 59 |
| 57 static AssignmentExpression assignmentExpression(Expression leftHandSide, | 60 static AssignmentExpression assignmentExpression(Expression leftHandSide, |
| 58 TokenType operator, Expression rightHandSide) => | 61 TokenType operator, Expression rightHandSide) => |
| 59 new AssignmentExpression( | 62 new AssignmentExpression( |
| 60 leftHandSide, TokenFactory.tokenFromType(operator), rightHandSide); | 63 leftHandSide, TokenFactory.tokenFromType(operator), rightHandSide); |
| 61 | 64 |
| 62 static BlockFunctionBody asyncBlockFunctionBody( | 65 static BlockFunctionBody asyncBlockFunctionBody( |
| 63 [List<Statement> statements]) => | 66 [List<Statement> statements]) => |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 expression, | 1249 expression, |
| 1247 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1250 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1248 | 1251 |
| 1249 static YieldStatement yieldStatement(Expression expression) => | 1252 static YieldStatement yieldStatement(Expression expression) => |
| 1250 new YieldStatement( | 1253 new YieldStatement( |
| 1251 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), | 1254 TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"), |
| 1252 null, | 1255 null, |
| 1253 expression, | 1256 expression, |
| 1254 TokenFactory.tokenFromType(TokenType.SEMICOLON)); | 1257 TokenFactory.tokenFromType(TokenType.SEMICOLON)); |
| 1255 } | 1258 } |
| OLD | NEW |