| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' show DartType, TreeNode; | 5 import 'package:kernel/ast.dart' show DartType, TreeNode; |
| 6 | 6 |
| 7 import 'shadow_ast.dart'; | 7 import 'shadow_ast.dart'; |
| 8 | 8 |
| 9 /// An abstract class containing factory methods that create AST objects. | 9 /// An abstract class containing factory methods that create AST objects. |
| 10 /// | 10 /// |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 /// having a `toLocation` method on AstFactory that changes tokens to an | 31 /// having a `toLocation` method on AstFactory that changes tokens to an |
| 32 /// abstract type (`int` for kernel, `Token` for analyzer). | 32 /// abstract type (`int` for kernel, `Token` for analyzer). |
| 33 /// | 33 /// |
| 34 /// TODO(paulberry): in order to interface with analyzer, we'll need to | 34 /// TODO(paulberry): in order to interface with analyzer, we'll need to |
| 35 /// shadow-ify [DartType], since analyzer ASTs need to be able to record the | 35 /// shadow-ify [DartType], since analyzer ASTs need to be able to record the |
| 36 /// exact tokens that were used to specify a type. | 36 /// exact tokens that were used to specify a type. |
| 37 abstract class AstFactory { | 37 abstract class AstFactory { |
| 38 /// Creates a statement block. | 38 /// Creates a statement block. |
| 39 ShadowBlock block(List<ShadowStatement> statements, int charOffset); | 39 ShadowBlock block(List<ShadowStatement> statements, int charOffset); |
| 40 | 40 |
| 41 /// Note: needed because some kernel constructors require us to pass in a |
| 42 /// List<Expression>. |
| 43 List<ShadowExpression> expressionList(int length); |
| 44 |
| 41 /// Creates an integer literal. | 45 /// Creates an integer literal. |
| 42 ShadowIntLiteral intLiteral(value, int charOffset); | 46 ShadowIntLiteral intLiteral(value, int charOffset); |
| 43 | 47 |
| 44 /// Creates a list literal expression. | 48 /// Creates a list literal expression. |
| 45 /// | 49 /// |
| 46 /// If the list literal did not have an explicitly declared type argument, | 50 /// If the list literal did not have an explicitly declared type argument, |
| 47 /// [typeArgument] should be `null`. | 51 /// [typeArgument] should be `null`. |
| 48 ShadowListLiteral listLiteral(List<ShadowExpression> expressions, | 52 ShadowListLiteral listLiteral(List<ShadowExpression> expressions, |
| 49 DartType typeArgument, bool isConst, int charOffset); | 53 DartType typeArgument, bool isConst, int charOffset); |
| 50 | 54 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 /// | 67 /// |
| 64 /// If the variable declaration did not have an explicitly declared type, | 68 /// If the variable declaration did not have an explicitly declared type, |
| 65 /// [type] should be `null`. | 69 /// [type] should be `null`. |
| 66 ShadowVariableDeclaration variableDeclaration(String name, | 70 ShadowVariableDeclaration variableDeclaration(String name, |
| 67 {DartType type, | 71 {DartType type, |
| 68 ShadowExpression initializer, | 72 ShadowExpression initializer, |
| 69 int charOffset: TreeNode.noOffset, | 73 int charOffset: TreeNode.noOffset, |
| 70 bool isFinal: false, | 74 bool isFinal: false, |
| 71 bool isConst: false}); | 75 bool isConst: false}); |
| 72 } | 76 } |
| OLD | NEW |