Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: pkg/front_end/lib/src/fasta/builder/ast_factory.dart

Issue 2841863002: Change accessors and AstFactory to use tokens rather than file offsets. (Closed)
Patch Set: Address code review comments, rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/builder/ast_factory.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/ast_factory.dart b/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
index 959b16bb49624ce06eefef71bfe00a9bac9d72a6..5f138b18869c4de55886e35fcdba7415674858bc 100644
--- a/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
+++ b/pkg/front_end/lib/src/fasta/builder/ast_factory.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:front_end/src/fasta/scanner.dart' show Token;
import 'package:front_end/src/fasta/type_inference/type_promotion.dart';
import 'package:kernel/ast.dart';
@@ -35,7 +36,7 @@ import 'package:kernel/ast.dart';
/// exact tokens that were used to specify a type.
abstract class AstFactory<V> {
/// Creates a statement block.
- Block block(List<Statement> statements, int charOffset);
+ Block block(List<Statement> statements, Token beginToken);
/// Creates an expression statement.
ExpressionStatement expressionStatement(Expression expression);
@@ -44,34 +45,34 @@ abstract class AstFactory<V> {
Field field(Name name, int charOffset, {String fileUri});
/// Creates a function expression.
- FunctionExpression functionExpression(FunctionNode function, int charOffset);
+ FunctionExpression functionExpression(FunctionNode function, Token token);
/// Creates an `if` statement.
Statement ifStatement(
Expression condition, Statement thenPart, Statement elsePart);
/// Creates an integer literal.
- IntLiteral intLiteral(value, int charOffset);
+ IntLiteral intLiteral(value, Token token);
/// Creates an `is` expression.
Expression isExpression(
- Expression expression, DartType type, int charOffset, bool isInverted);
+ Expression expression, DartType type, Token token, bool isInverted);
/// Creates a list literal expression.
///
/// If the list literal did not have an explicitly declared type argument,
/// [typeArgument] should be `null`.
ListLiteral listLiteral(List<Expression> expressions, DartType typeArgument,
- bool isConst, int charOffset);
+ bool isConst, Token token);
/// Creates a null literal expression.
- NullLiteral nullLiteral(int charOffset);
+ NullLiteral nullLiteral(Token token);
/// Creates a return statement.
- Statement returnStatement(Expression expression, int charOffset);
+ Statement returnStatement(Expression expression, Token token);
/// Creates a read of a static variable.
- StaticGet staticGet(Member readTarget, int offset);
+ StaticGet staticGet(Member readTarget, Token token);
/// Creates a variable declaration statement declaring one variable.
///
@@ -83,14 +84,14 @@ abstract class AstFactory<V> {
/// If the variable declaration did not have an explicitly declared type,
/// [type] should be `null`.
VariableDeclaration variableDeclaration(
- String name, int charOffset, int functionNestingLevel,
+ String name, Token token, int functionNestingLevel,
{DartType type,
Expression initializer,
- int equalsCharOffset = TreeNode.noOffset,
+ Token equalsToken,
bool isFinal: false,
bool isConst: false});
/// Creates a read of a local variable.
variableGet(VariableDeclaration variable, TypePromotionFact<V> fact,
- TypePromotionScope scope, int charOffset);
+ TypePromotionScope scope, Token token);
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/body_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698