Skip to content

Commit ed32d24

Browse files
fishythefishCommit Queue
authored andcommitted
[js_ast] Update pubspec to 3.7 and reformat.
Change-Id: I6d7d21b2d02f1f6cbaff81f75f900790f0e8c715 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400780 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Mayank Patke <[email protected]> Auto-Submit: Mayank Patke <[email protected]>
1 parent ecd468a commit ed32d24

14 files changed

+940
-530
lines changed

pkg/js_ast/lib/src/builder.dart

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ class JsBuilder {
288288
}
289289

290290
Iterable<Literal> joinLiterals(
291-
Iterable<Literal> items, Literal separator) sync* {
291+
Iterable<Literal> items,
292+
Literal separator,
293+
) sync* {
292294
bool first = true;
293295
for (final item in items) {
294296
if (!first) yield separator;
@@ -314,7 +316,10 @@ class JsBuilder {
314316
Comment comment(String text) => Comment(text);
315317

316318
Call propertyCall(
317-
Expression receiver, Expression fieldName, List<Expression> arguments) {
319+
Expression receiver,
320+
Expression fieldName,
321+
List<Expression> arguments,
322+
) {
318323
return Call(PropertyAccess(receiver, fieldName), arguments);
319324
}
320325

@@ -347,7 +352,10 @@ LiteralNumber number(num value) => js.number(value);
347352
ArrayInitializer numArray(Iterable<int> list) => js.numArray(list);
348353
ArrayInitializer stringArray(Iterable<String> list) => js.stringArray(list);
349354
Call propertyCall(
350-
Expression receiver, Expression fieldName, List<Expression> arguments) {
355+
Expression receiver,
356+
Expression fieldName,
357+
List<Expression> arguments,
358+
) {
351359
return js.propertyCall(receiver, fieldName, arguments);
352360
}
353361

@@ -404,8 +412,7 @@ enum _Category {
404412
arrow,
405413
hash,
406414
whitespace,
407-
other,
408-
;
415+
other;
409416

410417
static const _asciiTable = <_Category>[
411418
other, other, other, other, other, other, other, other, // 0-7
@@ -528,7 +535,7 @@ class MiniJsParser {
528535
'typeof',
529536
'void',
530537
'delete',
531-
'await'
538+
'await',
532539
};
533540

534541
static final OPERATORS_THAT_LOOK_LIKE_IDENTIFIERS = {
@@ -537,7 +544,7 @@ class MiniJsParser {
537544
'delete',
538545
'in',
539546
'instanceof',
540-
'await'
547+
'await',
541548
};
542549

543550
static _Category _category(int code) {
@@ -678,11 +685,12 @@ class MiniJsParser {
678685
// Special code to disallow !, ~ and / in non-first position in token,
679686
// so that !! and ~~ parse as two tokens and != parses as one, while =/
680687
// parses as a an equals token followed by a regexp literal start.
681-
newCat = (code == char_codes.$BANG ||
682-
code == char_codes.$SLASH ||
683-
code == char_codes.$TILDE)
684-
? _Category.none
685-
: _category(code);
688+
newCat =
689+
(code == char_codes.$BANG ||
690+
code == char_codes.$SLASH ||
691+
code == char_codes.$TILDE)
692+
? _Category.none
693+
: _category(code);
686694
} while (!_singleCharCategory(cat) &&
687695
(cat == newCat ||
688696
(cat == _Category.alpha &&
@@ -819,8 +827,9 @@ class MiniJsParser {
819827
return expression;
820828
} else if (_acceptCategory(_Category.hash)) {
821829
var nameOrPosition = parseHash();
822-
InterpolatedExpression expression =
823-
InterpolatedExpression(nameOrPosition);
830+
InterpolatedExpression expression = InterpolatedExpression(
831+
nameOrPosition,
832+
);
824833
interpolatedValues.add(expression);
825834
return expression;
826835
} else {
@@ -843,8 +852,9 @@ class MiniJsParser {
843852
for (;;) {
844853
if (_acceptCategory(_Category.hash)) {
845854
var nameOrPosition = parseHash();
846-
InterpolatedParameter parameter =
847-
InterpolatedParameter(nameOrPosition);
855+
InterpolatedParameter parameter = InterpolatedParameter(
856+
nameOrPosition,
857+
);
848858
interpolatedValues.add(parameter);
849859
params.add(parameter);
850860
} else {
@@ -899,8 +909,9 @@ class MiniJsParser {
899909
propertyName = LiteralString(identifier);
900910
} else if (_acceptCategory(_Category.hash)) {
901911
var nameOrPosition = parseHash();
902-
InterpolatedLiteral interpolatedLiteral =
903-
InterpolatedLiteral(nameOrPosition);
912+
InterpolatedLiteral interpolatedLiteral = InterpolatedLiteral(
913+
nameOrPosition,
914+
);
904915
interpolatedValues.add(interpolatedLiteral);
905916
propertyName = interpolatedLiteral;
906917
} else {
@@ -1070,8 +1081,10 @@ class MiniJsParser {
10701081
return Assignment(lhs, rhs);
10711082
} else {
10721083
// Handle +=, -=, etc.
1073-
String operator =
1074-
assignmentOperator.substring(0, assignmentOperator.length - 1);
1084+
String operator = assignmentOperator.substring(
1085+
0,
1086+
assignmentOperator.length - 1,
1087+
);
10751088
return Assignment.compound(lhs, operator, rhs);
10761089
}
10771090
}
@@ -1111,7 +1124,8 @@ class MiniJsParser {
11111124
return parseArrowFunctionBody(params);
11121125
}
11131126
return expressions.reduce(
1114-
(Expression value, Expression element) => Binary(',', value, element));
1127+
(Expression value, Expression element) => Binary(',', value, element),
1128+
);
11151129
}
11161130

11171131
Expression parseArrowFunctionBody(List<Parameter> params) {
@@ -1130,7 +1144,8 @@ class MiniJsParser {
11301144
}
11311145

11321146
VariableDeclarationList finishVariableDeclarationList(
1133-
Declaration firstVariable) {
1147+
Declaration firstVariable,
1148+
) {
11341149
var initialization = <VariableInitialization>[];
11351150

11361151
void declare(Declaration declaration) {
@@ -1248,8 +1263,9 @@ class MiniJsParser {
12481263
// statement.
12491264
if (expression is InterpolatedExpression) {
12501265
assert(identical(interpolatedValues.last, expression));
1251-
InterpolatedStatement statement =
1252-
InterpolatedStatement(expression.nameOrPosition);
1266+
InterpolatedStatement statement = InterpolatedStatement(
1267+
expression.nameOrPosition,
1268+
);
12531269
interpolatedValues[interpolatedValues.length - 1] = statement;
12541270
return statement;
12551271
}
@@ -1337,10 +1353,10 @@ class MiniJsParser {
13371353
_expectCategory(_Category.rparen);
13381354
Statement body = parseStatement();
13391355
return ForIn(
1340-
VariableDeclarationList(
1341-
[VariableInitialization(declaration, null)]),
1342-
objectExpression,
1343-
body);
1356+
VariableDeclarationList([VariableInitialization(declaration, null)]),
1357+
objectExpression,
1358+
body,
1359+
);
13441360
}
13451361
Expression declarations = finishVariableDeclarationList(declaration);
13461362
_expectCategory(_Category.semicolon);
@@ -1355,8 +1371,9 @@ class MiniJsParser {
13551371
Declaration parseVariableDeclaration() {
13561372
if (_acceptCategory(_Category.hash)) {
13571373
var nameOrPosition = parseHash();
1358-
InterpolatedDeclaration declaration =
1359-
InterpolatedDeclaration(nameOrPosition);
1374+
InterpolatedDeclaration declaration = InterpolatedDeclaration(
1375+
nameOrPosition,
1376+
);
13601377
interpolatedValues.add(declaration);
13611378
return declaration;
13621379
} else {

0 commit comments

Comments
 (0)