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

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: 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
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 2559d8971ba154c8c2dd95973d901d244039fa78..ad404ecd04ede207f177a2aa456d7187a139a3f8 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/token.dart' show Token;
ahe 2017/04/26 08:34:36 If you import package:front_end/src/fasta/scanner.
Paul Berry 2017/04/26 20:20:52 Done.
import 'package:kernel/ast.dart';
/// An abstract class containing factory methods that create AST objects.
@@ -34,29 +35,29 @@ import 'package:kernel/ast.dart';
/// exact tokens that were used to specify a type.
abstract class AstFactory {
/// Creates a statement block.
- Block block(List<Statement> statements, int charOffset);
+ Block block(List<Statement> statements, Token beginToken);
/// Creates a field.
Field field(Name name, int charOffset, {String fileUri});
Paul Berry 2017/04/25 12:37:52 Note: I realized as I was going through this exerc
/// Creates an integer literal.
- IntLiteral intLiteral(value, int charOffset);
+ IntLiteral intLiteral(value, Token token);
/// 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.
///
@@ -67,10 +68,10 @@ abstract class AstFactory {
///
/// If the variable declaration did not have an explicitly declared type,
/// [type] should be `null`.
- VariableDeclaration variableDeclaration(String name, int charOffset,
+ VariableDeclaration variableDeclaration(String name, Token token,
{DartType type,
Expression initializer,
- int equalsCharOffset = TreeNode.noOffset,
+ Token equalsToken,
bool isFinal: false,
bool isConst: false});
}

Powered by Google App Engine
This is Rietveld 408576698