mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[fasta] Add 'as' expressions to the Forest API
Change-Id: Id023f24c9e115e15ed81b93625e39230649b7822 Reviewed-on: https://dart-review.googlesource.com/53600 Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
16f6ce2fee
commit
0c839cf3f8
|
@ -2008,8 +2008,7 @@ class BodyBuilder<Arguments> extends ScopeListener<JumpTarget>
|
|||
push(deprecated_buildCompileTimeError(
|
||||
"Not a constant expression.", operator.charOffset));
|
||||
} else {
|
||||
push(new ShadowAsExpression(expression, type)
|
||||
..fileOffset = offsetForToken(operator));
|
||||
push(forest.asExpression(expression, type, operator));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import '../scanner.dart' show Token;
|
|||
import 'kernel_shadow_ast.dart'
|
||||
show
|
||||
ShadowArguments,
|
||||
ShadowAsExpression,
|
||||
ShadowBoolLiteral,
|
||||
ShadowCheckLibraryIsLoaded,
|
||||
ShadowDoubleLiteral,
|
||||
|
@ -154,6 +155,12 @@ class Fangorn extends Forest<Expression, Statement, Token, Arguments> {
|
|||
return new ShadowCheckLibraryIsLoaded(dependency);
|
||||
}
|
||||
|
||||
@override
|
||||
Expression asExpression(Expression expression, covariant type, Token token) {
|
||||
return new ShadowAsExpression(expression, type)
|
||||
..fileOffset = offsetForToken(token);
|
||||
}
|
||||
|
||||
@override
|
||||
bool isErroneousNode(TreeNode node) {
|
||||
if (node is ExpressionStatement) {
|
||||
|
|
|
@ -54,6 +54,9 @@ abstract class Forest<Expression, Statement, Location, Arguments> {
|
|||
|
||||
Expression checkLibraryIsLoaded(covariant dependency);
|
||||
|
||||
Expression asExpression(
|
||||
Expression expression, covariant type, Location location);
|
||||
|
||||
bool isErroneousNode(covariant node);
|
||||
|
||||
// TODO(ahe): Remove this method when all users are moved here.
|
||||
|
|
Loading…
Reference in a new issue