Skip to content

Commit 3300f32

Browse files
committed
Version 2.14.2
* Cherry-pick refs/changes/85/211085/1 to stable * Cherry-pick refs/changes/65/213265/1 to stable * Cherry-pick refs/changes/43/213043/1 to stable * Cherry-pick a6f97d1 to stable
2 parents 2102c6c + 80c2f1c commit 3300f32

File tree

42 files changed

+2431
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2431
-21
lines changed

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
## 2.14.0
1+
## 2.14.2 - 2021-09-16
2+
3+
This is a patch release that fixes:
4+
5+
- two dartdoc crashes (issues [dart-lang/dartdoc#2740][] and
6+
[dart-lang/dartdoc#2755][]).
7+
- error messages when using the `>>>` operator on older language versions
8+
(issue [#46886][]).
9+
- invalid `pubspec.lock` paths on Windows (issue [dart-lang/pub#3012][]).
10+
11+
[dart-lang/dartdoc#2740]: https://github.com/dart-lang/dartdoc/issues/2740
12+
[dart-lang/dartdoc#2755]: https://github.com/dart-lang/dartdoc/issues/2755
13+
[#46886]: https://github.com/dart-lang/sdk/issues/46886
14+
[#45767]: https://github.com/dart-lang/sdk/issues/45767
15+
[dart-lang/pub#3012]: https://github.com/dart-lang/pub/issues/3012
16+
17+
## 2.14.1 - 2021-09-09
18+
19+
- Fixed an issue specific to the macOS ARM64 (Apple Silicon) SDK, where the Dart
20+
commandline tools did not have the expected startup performance.
21+
22+
## 2.14.0 - 2021-09-09
223

324
### Language
425

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ vars = {
105105
# For more details, see https://github.com/dart-lang/sdk/issues/30164
106106
"dart_style_rev": "06bfd19593ed84dd288f67e02c6a753e6516288a",
107107

108-
"dartdoc_rev" : "c9621b92c738ec21a348cc2de032858276e9c774",
108+
"dartdoc_rev" : "a4ca86f9bf732d7adc4506f7373e0ed63251b646",
109109
"devtools_rev" : "64cffbed6366329ad05e44d48fa2298367643bb6",
110110
"jsshell_tag": "version:88.0",
111111
"ffi_rev": "4dd32429880a57b64edaf54c9d5af8a9fa9a4ffb",
@@ -140,7 +140,7 @@ vars = {
140140
"pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
141141
"process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
142142
"protobuf_rev": "c1eb6cb51af39ccbaa1a8e19349546586a5c8e31",
143-
"pub_rev": "70b1a4f9229a36bac6340ec7eae2b2068baac96c",
143+
"pub_rev": "214860e794076188869d586b047a4aaada1cb9a8",
144144
"pub_semver_rev": "f50d80ef10c4b2fa5f4c8878036a4d9342c0cc82",
145145
"resource_rev": "6b79867d0becf5395e5819a75720963b8298e9a7",
146146
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",

pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,6 +3844,18 @@ class Parser {
38443844
identical(operator.kind, BANG_EQ_EQ_TOKEN) ||
38453845
isUnaryMinus(operator)) {
38463846
isOperator = true;
3847+
if (optional(">>", operator) &&
3848+
optional(">", operator.next!) &&
3849+
operator.charEnd == operator.next!.charOffset) {
3850+
// Special case use of triple-shift in cases where it isn't enabled.
3851+
reportRecoverableErrorWithEnd(
3852+
operator,
3853+
operator.next!,
3854+
codes.templateExperimentNotEnabled
3855+
.withArguments("triple-shift", "2.14"));
3856+
operator = rewriter.replaceNextTokensWithSyntheticToken(
3857+
name, 2, TokenType.GT_GT_GT);
3858+
}
38473859
}
38483860
}
38493861

@@ -4418,9 +4430,7 @@ class Parser {
44184430
begin = next = token.next!;
44194431
// Fall through to parse the block.
44204432
} else {
4421-
token = ensureBlock(
4422-
token,
4423-
codes.templateExpectedFunctionBody,
4433+
token = ensureBlock(token, codes.templateExpectedFunctionBody,
44244434
/* missingBlockName = */ null);
44254435
listener.handleInvalidFunctionBody(token);
44264436
return token.endGroup!;
@@ -4883,6 +4893,19 @@ class Parser {
48834893
// Right associative, so we recurse at the same precedence
48844894
// level.
48854895
Token next = token.next!;
4896+
if (optional(">=", next.next!)) {
4897+
// Special case use of triple-shift in cases where it isn't
4898+
// enabled.
4899+
reportRecoverableErrorWithEnd(
4900+
next,
4901+
next.next!,
4902+
codes.templateExperimentNotEnabled
4903+
.withArguments("triple-shift", "2.14"));
4904+
assert(next == operator);
4905+
next = rewriter.replaceNextTokensWithSyntheticToken(
4906+
token, 2, TokenType.GT_GT_GT_EQ);
4907+
operator = next;
4908+
}
48864909
token = optional('throw', next.next!)
48874910
? parseThrowExpression(next, /* allowCascades = */ false)
48884911
: parsePrecedenceExpression(next, level, allowCascades);
@@ -4964,6 +4987,21 @@ class Parser {
49644987
lastBinaryExpressionLevel = level;
49654988
}
49664989
}
4990+
if (optional(">>", next) && next.charEnd == next.next!.charOffset) {
4991+
if (optional(">", next.next!)) {
4992+
// Special case use of triple-shift in cases where it isn't
4993+
// enabled.
4994+
reportRecoverableErrorWithEnd(
4995+
next,
4996+
next.next!,
4997+
codes.templateExperimentNotEnabled
4998+
.withArguments("triple-shift", "2.14"));
4999+
assert(next == operator);
5000+
next = rewriter.replaceNextTokensWithSyntheticToken(
5001+
token, 2, TokenType.GT_GT_GT);
5002+
operator = next;
5003+
}
5004+
}
49675005
listener.beginBinaryExpression(next);
49685006
// Left associative, so we recurse at the next higher
49695007
// precedence level.
@@ -5110,6 +5148,14 @@ class Parser {
51105148
return SELECTOR_PRECEDENCE;
51115149
}
51125150
return POSTFIX_PRECEDENCE;
5151+
} else if (identical(type, TokenType.GT_GT)) {
5152+
// ">>" followed by ">=" (without space between tokens) should for
5153+
// recovery be seen as ">>>=".
5154+
TokenType nextType = token.next!.type;
5155+
if (identical(nextType, TokenType.GT_EQ) &&
5156+
token.charEnd == token.next!.offset) {
5157+
return TokenType.GT_GT_GT_EQ.precedence;
5158+
}
51135159
} else if (identical(type, TokenType.QUESTION) &&
51145160
optional('[', token.next!)) {
51155161
// "?[" can be a null-aware bracket or a conditional. If it's a

pkg/_fe_analyzer_shared/lib/src/parser/token_stream_rewriter.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,34 @@ abstract class TokenStreamRewriter {
162162
return replacement;
163163
}
164164

165+
/// Insert a new simple synthetic token of [newTokenType] after
166+
/// [previousToken] instead of the [count] tokens actually coming after it and
167+
/// return the new token.
168+
/// The first old token will be linked from the new one (and the next ones can
169+
/// be found via the next pointer chain on it) though, so it's not totally
170+
/// gone.
171+
ReplacementToken replaceNextTokensWithSyntheticToken(
172+
Token previousToken, int count, TokenType newTokenType) {
173+
assert(newTokenType is! Keyword,
174+
'use an unwritten variation of insertSyntheticKeyword instead');
175+
176+
// [token] <--> [a_1] <--> ... <--> [a_n] <--> [b]
177+
ReplacementToken replacement =
178+
new ReplacementToken(newTokenType, previousToken.next!);
179+
insertToken(previousToken, replacement);
180+
// [token] <--> [replacement] <--> [a_1] <--> ... <--> [a_n] <--> [b]
181+
182+
Token end = replacement.next!;
183+
while (count > 0) {
184+
count--;
185+
end = end.next!;
186+
}
187+
_setNext(replacement, end);
188+
// [token] <--> [replacement] <--> [b]
189+
190+
return replacement;
191+
}
192+
165193
/// Insert a synthetic identifier after [token] and return the new identifier.
166194
Token insertSyntheticIdentifier(Token token, [String value = '']) {
167195
return insertToken(
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Foo {
2+
Foo operator >>>(_) => this;
3+
}
4+
5+
main() {
6+
Foo foo = new Foo();
7+
foo >>> 42;
8+
print(foo >>> 42);
9+
print(foo >>>= 42);
10+
if ((foo >>>= 42) == foo) {
11+
print("same");
12+
}
13+
}
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
Problems reported:
2+
3+
parser/no-triple-shift/define_triple_shift_method:2:16: This requires the 'triple-shift' language feature to be enabled.
4+
Foo operator >>>(_) => this;
5+
^^^
6+
7+
parser/no-triple-shift/define_triple_shift_method:7:7: This requires the 'triple-shift' language feature to be enabled.
8+
foo >>> 42;
9+
^^^
10+
11+
parser/no-triple-shift/define_triple_shift_method:8:13: This requires the 'triple-shift' language feature to be enabled.
12+
print(foo >>> 42);
13+
^^^
14+
15+
parser/no-triple-shift/define_triple_shift_method:9:13: This requires the 'triple-shift' language feature to be enabled.
16+
print(foo >>>= 42);
17+
^^^^
18+
19+
parser/no-triple-shift/define_triple_shift_method:10:12: This requires the 'triple-shift' language feature to be enabled.
20+
if ((foo >>>= 42) == foo) {
21+
^^^^
22+
23+
beginCompilationUnit(class)
24+
beginMetadataStar(class)
25+
endMetadataStar(0)
26+
beginClassOrNamedMixinApplicationPrelude(class)
27+
handleIdentifier(Foo, classOrMixinDeclaration)
28+
handleNoTypeVariables({)
29+
beginClassDeclaration(class, null, Foo)
30+
handleNoType(Foo)
31+
handleClassExtends(null, 1)
32+
handleClassNoWithClause()
33+
handleClassOrMixinImplements(null, 0)
34+
handleClassHeader(class, class, null)
35+
beginClassOrMixinBody(DeclarationKind.Class, {)
36+
beginMetadataStar(Foo)
37+
endMetadataStar(0)
38+
beginMember()
39+
handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
40+
beginMethod(null, null, null, null, null, operator)
41+
handleIdentifier(Foo, typeReference)
42+
handleNoTypeArguments(operator)
43+
handleType(Foo, null)
44+
handleOperatorName(operator, >>>)
45+
handleNoTypeVariables(()
46+
beginFormalParameters((, MemberKind.NonStaticMethod)
47+
beginMetadataStar(_)
48+
endMetadataStar(0)
49+
beginFormalParameter(_, MemberKind.NonStaticMethod, null, null, null)
50+
handleNoType(()
51+
handleIdentifier(_, formalParameterDeclaration)
52+
handleFormalParameterWithoutValue())
53+
endFormalParameter(null, null, _, null, null, FormalParameterKind.mandatory, MemberKind.NonStaticMethod)
54+
endFormalParameters(1, (, ), MemberKind.NonStaticMethod)
55+
handleNoInitializers()
56+
handleAsyncModifier(null, null)
57+
handleThisExpression(this, expression)
58+
handleExpressionFunctionBody(=>, ;)
59+
endClassMethod(null, Foo, (, null, ;)
60+
endMember()
61+
endClassOrMixinBody(DeclarationKind.Class, 1, {, })
62+
endClassDeclaration(class, })
63+
endTopLevelDeclaration(main)
64+
beginMetadataStar(main)
65+
endMetadataStar(0)
66+
beginTopLevelMember(main)
67+
beginTopLevelMethod(}, null)
68+
handleNoType(})
69+
handleIdentifier(main, topLevelFunctionDeclaration)
70+
handleNoTypeVariables(()
71+
beginFormalParameters((, MemberKind.TopLevelMethod)
72+
endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
73+
handleAsyncModifier(null, null)
74+
beginBlockFunctionBody({)
75+
beginMetadataStar(Foo)
76+
endMetadataStar(0)
77+
handleIdentifier(Foo, typeReference)
78+
handleNoTypeArguments(foo)
79+
handleType(Foo, null)
80+
beginVariablesDeclaration(foo, null, null)
81+
handleIdentifier(foo, localVariableDeclaration)
82+
beginInitializedIdentifier(foo)
83+
beginVariableInitializer(=)
84+
beginNewExpression(new)
85+
handleIdentifier(Foo, constructorReference)
86+
beginConstructorReference(Foo)
87+
handleNoTypeArguments(()
88+
handleNoConstructorReferenceContinuationAfterTypeArguments(()
89+
endConstructorReference(Foo, null, ()
90+
beginArguments(()
91+
endArguments(0, (, ))
92+
endNewExpression(new)
93+
endVariableInitializer(=)
94+
endInitializedIdentifier(foo)
95+
endVariablesDeclaration(1, ;)
96+
handleIdentifier(foo, expression)
97+
handleNoTypeArguments(>>)
98+
handleNoArguments(>>)
99+
handleSend(foo, >>)
100+
handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
101+
beginBinaryExpression(>>>)
102+
handleLiteralInt(42)
103+
endBinaryExpression(>>>)
104+
handleExpressionStatement(;)
105+
handleIdentifier(print, expression)
106+
handleNoTypeArguments(()
107+
beginArguments(()
108+
handleIdentifier(foo, expression)
109+
handleNoTypeArguments(>>)
110+
handleNoArguments(>>)
111+
handleSend(foo, >>)
112+
handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >)
113+
beginBinaryExpression(>>>)
114+
handleLiteralInt(42)
115+
endBinaryExpression(>>>)
116+
endArguments(1, (, ))
117+
handleSend(print, ;)
118+
handleExpressionStatement(;)
119+
handleIdentifier(print, expression)
120+
handleNoTypeArguments(()
121+
beginArguments(()
122+
handleIdentifier(foo, expression)
123+
handleNoTypeArguments(>>)
124+
handleNoArguments(>>)
125+
handleSend(foo, >>)
126+
handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
127+
handleLiteralInt(42)
128+
handleAssignmentExpression(>>>=)
129+
endArguments(1, (, ))
130+
handleSend(print, ;)
131+
handleExpressionStatement(;)
132+
beginIfStatement(if)
133+
handleIdentifier(foo, expression)
134+
handleNoTypeArguments(>>)
135+
handleNoArguments(>>)
136+
handleSend(foo, >>)
137+
handleRecoverableError(Message[ExperimentNotEnabled, This requires the 'triple-shift' language feature to be enabled., Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'., {string: triple-shift, string2: 2.14}], >>, >=)
138+
handleLiteralInt(42)
139+
handleAssignmentExpression(>>>=)
140+
handleParenthesizedExpression(()
141+
beginBinaryExpression(==)
142+
handleIdentifier(foo, expression)
143+
handleNoTypeArguments())
144+
handleNoArguments())
145+
handleSend(foo, ))
146+
endBinaryExpression(==)
147+
handleParenthesizedCondition(()
148+
beginThenStatement({)
149+
beginBlock({, BlockKind(statement))
150+
handleIdentifier(print, expression)
151+
handleNoTypeArguments(()
152+
beginArguments(()
153+
beginLiteralString("same")
154+
endLiteralString(0, ))
155+
endArguments(1, (, ))
156+
handleSend(print, ;)
157+
handleExpressionStatement(;)
158+
endBlock(1, {, }, BlockKind(statement))
159+
endThenStatement(})
160+
endIfStatement(if, null)
161+
endBlockFunctionBody(5, {, })
162+
endTopLevelMethod(main, null, })
163+
endTopLevelDeclaration()
164+
endCompilationUnit(2, )

0 commit comments

Comments
 (0)