mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Clean up Forest.literalList and Forest.literalMap
Change-Id: Iba64ae132a98297466962f0ed8e4bfbe8535611b Reviewed-on: https://dart-review.googlesource.com/54161 Reviewed-by: Dan Rubel <danrubel@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
2ccafe7a54
commit
c9cd32fb58
4 changed files with 17 additions and 23 deletions
|
@ -116,8 +116,7 @@ class AstBuildingForest
|
|||
Object typeArguments,
|
||||
Token leftBracket,
|
||||
List<Expression> expressions,
|
||||
Token rightBracket,
|
||||
Token location) =>
|
||||
Token rightBracket) =>
|
||||
astFactory.listLiteral(
|
||||
constKeyword, typeArguments, leftBracket, expressions, rightBracket);
|
||||
|
||||
|
@ -130,8 +129,7 @@ class AstBuildingForest
|
|||
Object typeArguments,
|
||||
Token leftBracket,
|
||||
covariant List entries,
|
||||
Token rightBracket,
|
||||
Token location) =>
|
||||
Token rightBracket) =>
|
||||
astFactory.mapLiteral(
|
||||
constKeyword, typeArguments, leftBracket, entries, rightBracket);
|
||||
|
||||
|
|
|
@ -1857,10 +1857,9 @@ class BodyBuilder<Arguments> extends ScopeListener<JumpTarget>
|
|||
constKeyword != null || constantContext == ConstantContext.inferred,
|
||||
typeArgument,
|
||||
typeArguments,
|
||||
null,
|
||||
beginToken,
|
||||
expressions,
|
||||
endToken,
|
||||
constKeyword ?? beginToken));
|
||||
endToken));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1916,8 +1915,7 @@ class BodyBuilder<Arguments> extends ScopeListener<JumpTarget>
|
|||
typeArguments,
|
||||
beginToken,
|
||||
entries,
|
||||
endToken,
|
||||
constKeyword ?? beginToken));
|
||||
endToken));
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -111,11 +111,12 @@ class Fangorn extends Forest<Expression, Statement, Token, Arguments> {
|
|||
Object typeArguments,
|
||||
Token leftBracket,
|
||||
List<Expression> expressions,
|
||||
Token rightBracket,
|
||||
Token location) {
|
||||
Token rightBracket) {
|
||||
// TODO(brianwilkerson): The file offset computed below will not be correct
|
||||
// if there are type arguments but no `const` keyword.
|
||||
return new ShadowListLiteral(expressions,
|
||||
typeArgument: typeArgument, isConst: isConst)
|
||||
..fileOffset = offsetForToken(location);
|
||||
..fileOffset = offsetForToken(constKeyword ?? leftBracket);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -127,11 +128,12 @@ class Fangorn extends Forest<Expression, Statement, Token, Arguments> {
|
|||
Object typeArguments,
|
||||
Token leftBracket,
|
||||
List<MapEntry> entries,
|
||||
Token rightBracket,
|
||||
Token token) {
|
||||
Token rightBracket) {
|
||||
// TODO(brianwilkerson): The file offset computed below will not be correct
|
||||
// if there are type arguments but no `const` keyword.
|
||||
return new ShadowMapLiteral(entries,
|
||||
keyType: keyType, valueType: valueType, isConst: isConst)
|
||||
..fileOffset = offsetForToken(token);
|
||||
..fileOffset = offsetForToken(constKeyword ?? leftBracket);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -50,8 +50,7 @@ abstract class Forest<Expression, Statement, Location, Arguments> {
|
|||
/// preceding the list literal, or `null` if there are no type arguments. The
|
||||
/// [leftBracket] is the location of the `[`. The list of [expressions] is a
|
||||
/// list of the representations of the list elements. The [rightBracket] is
|
||||
/// the location of the `]`. The [location] is the location of the first token
|
||||
/// in the list literal.
|
||||
/// the location of the `]`.
|
||||
Expression literalList(
|
||||
Location constKeyword,
|
||||
bool isConst,
|
||||
|
@ -59,8 +58,7 @@ abstract class Forest<Expression, Statement, Location, Arguments> {
|
|||
Object typeArguments,
|
||||
Location leftBracket,
|
||||
List<Expression> expressions,
|
||||
Location rightBracket,
|
||||
Location location);
|
||||
Location rightBracket);
|
||||
|
||||
/// Return a representation of a map literal. The [constKeyword] is the
|
||||
/// location of the `const` keyword, or `null` if there is no keyword. The
|
||||
|
@ -75,8 +73,7 @@ abstract class Forest<Expression, Statement, Location, Arguments> {
|
|||
/// preceding the map literal, or `null` if there are no type arguments. The
|
||||
/// [leftBracket] is the location of the `{`. The list of [entries] is a
|
||||
/// list of the representations of the map entries. The [rightBracket] is
|
||||
/// the location of the `}`. The [location] is the location of the first token
|
||||
/// in the map literal.
|
||||
/// the location of the `}`.
|
||||
Expression literalMap(
|
||||
Location constKeyword,
|
||||
bool isConst,
|
||||
|
@ -85,8 +82,7 @@ abstract class Forest<Expression, Statement, Location, Arguments> {
|
|||
Object typeArguments,
|
||||
Location leftBracket,
|
||||
covariant List entries,
|
||||
Location rightBracket,
|
||||
Location location);
|
||||
Location rightBracket);
|
||||
|
||||
/// Return a representation of a null literal at the given [location].
|
||||
Expression literalNull(Location location);
|
||||
|
|
Loading…
Reference in a new issue