Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/scanner/token.dart |
| diff --git a/pkg/front_end/lib/src/fasta/scanner/token.dart b/pkg/front_end/lib/src/fasta/scanner/token.dart |
| index a3e91fa9126044ce5f53578a6f33148b0f8e9b19..b458cbf6208b438d732e302a2ca9db845819dad6 100644 |
| --- a/pkg/front_end/lib/src/fasta/scanner/token.dart |
| +++ b/pkg/front_end/lib/src/fasta/scanner/token.dart |
| @@ -7,6 +7,8 @@ library fasta.scanner.token; |
| import '../../scanner/token.dart' as analyzer; |
| import '../../scanner/token.dart' show TokenType; |
| +import 'package:kernel/ast.dart' show TreeNode; |
|
ahe
2017/04/25 17:39:59
It feels a bit much to import package:kernel here
Paul Berry
2017/04/25 22:00:55
What's bothering you, the import of kernel or the
ahe
2017/04/26 08:34:36
Both, I think.
|
| + |
| import 'precedence.dart' |
| show AS_INFO, BAD_INPUT_INFO, EOF_INFO, IS_INFO, KEYWORD_INFO; |
| @@ -14,6 +16,11 @@ import 'token_constants.dart' show IDENTIFIER_TOKEN; |
| import 'string_canonicalizer.dart'; |
| +/// A null-aware alternative to `token.offset`. If [token] is `null`, returns |
| +/// `TreeNode.noOffset`. |
| +int offsetForToken(Token token) => |
| + token == null ? TreeNode.noOffset : token.offset; |
| + |
| /** |
| * A token that doubles as a linked list. |
| */ |