| 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:front_end/src/fasta/scanner.dart' show Token; | 5 import 'package:front_end/src/fasta/scanner.dart' show Token; |
| 6 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; | 6 import 'package:front_end/src/fasta/type_inference/type_promotion.dart'; |
| 7 import 'package:kernel/ast.dart'; | 7 import 'package:kernel/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<V> { | 37 abstract class AstFactory<V> { |
| 38 /// Creates a statement block. | 38 /// Creates a statement block. |
| 39 Block block(List<Statement> statements, Token beginToken); | 39 Block block(List<Statement> statements, Token beginToken); |
| 40 | 40 |
| 41 /// Creates a double literal. |
| 42 DoubleLiteral doubleLiteral(double value, Token token); |
| 43 |
| 41 /// Creates an expression statement. | 44 /// Creates an expression statement. |
| 42 ExpressionStatement expressionStatement(Expression expression); | 45 ExpressionStatement expressionStatement(Expression expression); |
| 43 | 46 |
| 44 /// Creates a function expression. | 47 /// Creates a function expression. |
| 45 FunctionExpression functionExpression(FunctionNode function, Token token); | 48 FunctionExpression functionExpression(FunctionNode function, Token token); |
| 46 | 49 |
| 47 /// Creates an `if` statement. | 50 /// Creates an `if` statement. |
| 48 Statement ifStatement( | 51 Statement ifStatement( |
| 49 Expression condition, Statement thenPart, Statement elsePart); | 52 Expression condition, Statement thenPart, Statement elsePart); |
| 50 | 53 |
| 51 /// Creates an integer literal. | 54 /// Creates an integer literal. |
| 52 IntLiteral intLiteral(value, Token token); | 55 IntLiteral intLiteral(int value, Token token); |
| 53 | 56 |
| 54 /// Creates an `is` expression. | 57 /// Creates an `is` expression. |
| 55 Expression isExpression( | 58 Expression isExpression( |
| 56 Expression expression, DartType type, Token token, bool isInverted); | 59 Expression expression, DartType type, Token token, bool isInverted); |
| 57 | 60 |
| 58 /// Creates a list literal expression. | 61 /// Creates a list literal expression. |
| 59 /// | 62 /// |
| 60 /// If the list literal did not have an explicitly declared type argument, | 63 /// If the list literal did not have an explicitly declared type argument, |
| 61 /// [typeArgument] should be `null`. | 64 /// [typeArgument] should be `null`. |
| 62 ListLiteral listLiteral(List<Expression> expressions, DartType typeArgument, | 65 ListLiteral listLiteral(List<Expression> expressions, DartType typeArgument, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 {DartType type, | 88 {DartType type, |
| 86 Expression initializer, | 89 Expression initializer, |
| 87 Token equalsToken, | 90 Token equalsToken, |
| 88 bool isFinal: false, | 91 bool isFinal: false, |
| 89 bool isConst: false}); | 92 bool isConst: false}); |
| 90 | 93 |
| 91 /// Creates a read of a local variable. | 94 /// Creates a read of a local variable. |
| 92 variableGet(VariableDeclaration variable, TypePromotionFact<V> fact, | 95 variableGet(VariableDeclaration variable, TypePromotionFact<V> fact, |
| 93 TypePromotionScope scope, Token token); | 96 TypePromotionScope scope, Token token); |
| 94 } | 97 } |
| OLD | NEW |