Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f774b9a

Browse files
author
Dart CI
committed
Version 2.19.0-420.0.dev
Merge 3d625df into dev
2 parents f28da08 + 3d625df commit f774b9a

File tree

325 files changed

+4959
-1975
lines changed

Some content is hidden

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

325 files changed

+4959
-1975
lines changed

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
# issue created for it.
2525
#
2626
# Stats:
27-
# - 717 "needsEvaluation"
28-
# - 220 for ParserErrorCodes.
29-
# - 72 "needsFix"
30-
# - 296 "hasFix"
31-
# - 57 "noFix"
27+
# - 710 "needsEvaluation"
28+
# - 282 for CompileTimeErrorCodes
29+
# - 220 for ParserErrorCodes
30+
# - 70 "needsFix"
31+
# - 298 "hasFix"
32+
# - 64 "noFix"
3233

3334
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
3435
status: noFix
@@ -146,19 +147,34 @@ CompileTimeErrorCode.BODY_MIGHT_COMPLETE_NORMALLY:
146147
CompileTimeErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER:
147148
status: needsEvaluation
148149
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME:
149-
status: needsEvaluation
150+
status: noFix
151+
notes: |-
152+
The correction is to change the name.
150153
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME:
151-
status: needsEvaluation
154+
status: noFix
155+
notes: |-
156+
The correction is to change the name.
152157
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE:
153-
status: needsEvaluation
158+
status: noFix
159+
notes: |-
160+
The correction is to change the name.
154161
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME:
155-
status: needsEvaluation
162+
status: noFix
163+
notes: |-
164+
The correction is to change the name.
156165
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME:
157-
status: needsEvaluation
166+
status: noFix
167+
notes: |-
168+
The correction is to change the name.
158169
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME:
159-
status: needsEvaluation
170+
status: noFix
171+
notes: |-
172+
The correction is to change the name.
160173
CompileTimeErrorCode.CASE_BLOCK_NOT_TERMINATED:
161-
status: needsEvaluation
174+
status: needsFix
175+
notes: |-
176+
The typical fix, when someone thought a termination was not needed, is to
177+
add a break.
162178
CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS:
163179
status: needsEvaluation
164180
CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE:
@@ -363,9 +379,13 @@ CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING:
363379
notes: |-
364380
The fix is to rename one of the two, but we can't know what name to use.
365381
CompileTimeErrorCode.ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR:
366-
status: needsFix
382+
status: noFix
367383
since: 2.17
368-
notes: Use AddConst.new
384+
notes: |-
385+
This is only reported on enum constant declarations calling a factory
386+
constructor. No enum factory constructor can be const. The correction is to
387+
call a different constructor, or refactor the factory constructor to be
388+
const and generative.
369389
CompileTimeErrorCode.ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED:
370390
status: noFix
371391
since: 2.17

pkg/analyzer/lib/dart/ast/ast.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4134,7 +4134,7 @@ abstract class PatternAssignmentStatement implements Statement {
41344134
///
41354135
/// Clients may not extend, implement or mix-in this class.
41364136
@experimental
4137-
abstract class PatternVariableDeclaration implements AstNode {
4137+
abstract class PatternVariableDeclaration implements AnnotatedNode {
41384138
/// Return the equal sign separating the pattern from the expression.
41394139
Token get equals;
41404140

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9898,7 +9898,7 @@ class PatternAssignmentStatementImpl extends StatementImpl
98989898
/// patternDeclaration ::=
98999899
/// ( 'final' | 'var' ) [DartPattern] '=' [Expression]
99009900
@experimental
9901-
class PatternVariableDeclarationImpl extends AstNodeImpl
9901+
class PatternVariableDeclarationImpl extends AnnotatedNodeImpl
99029902
implements PatternVariableDeclaration {
99039903
@override
99049904
final Token equals;
@@ -9917,16 +9917,18 @@ class PatternVariableDeclarationImpl extends AstNodeImpl
99179917
required this.pattern,
99189918
required this.equals,
99199919
required this.expression,
9920+
required super.comment,
9921+
required super.metadata,
99209922
}) {
99219923
_becomeParentOf(pattern);
99229924
_becomeParentOf(expression);
99239925
}
99249926

99259927
@override
9926-
Token get beginToken => keyword;
9928+
Token get endToken => expression.endToken;
99279929

99289930
@override
9929-
Token get endToken => expression.endToken;
9931+
Token get firstTokenAfterCommentAndMetadata => keyword;
99309932

99319933
@override
99329934
ChildEntities get _childEntities => super._childEntities
@@ -9941,6 +9943,7 @@ class PatternVariableDeclarationImpl extends AstNodeImpl
99419943

99429944
@override
99439945
void visitChildren(AstVisitor visitor) {
9946+
super.visitChildren(visitor);
99449947
pattern.accept(visitor);
99459948
expression.accept(visitor);
99469949
}

pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ class ToSourceVisitor implements AstVisitor<void> {
960960

961961
@override
962962
void visitPatternVariableDeclaration(PatternVariableDeclaration node) {
963+
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
963964
sink.write(node.keyword.lexeme);
964965
sink.write(' ');
965966
_visitNode(node.pattern);

pkg/analyzer/lib/src/dart/ast/utilities.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,9 @@ class AstComparator implements AstVisitor<bool> {
11091109
@override
11101110
bool visitPatternVariableDeclaration(PatternVariableDeclaration node) {
11111111
var other = _other as PatternVariableDeclaration;
1112-
return isEqualTokens(node.keyword, other.keyword) &&
1112+
return isEqualNodes(
1113+
node.documentationComment, other.documentationComment) &&
1114+
isEqualTokens(node.keyword, other.keyword) &&
11131115
isEqualNodes(node.pattern, other.pattern) &&
11141116
isEqualTokens(node.equals, other.equals) &&
11151117
isEqualNodes(node.expression, other.expression);

pkg/analyzer/lib/src/fasta/ast_builder.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4770,15 +4770,16 @@ class AstBuilder extends StackListener {
47704770
Token keyword, Token equals, Token semicolon) {
47714771
var expression = pop() as ExpressionImpl;
47724772
var pattern = pop() as DartPatternImpl;
4773-
// TODO(paulberry): make use of metadata
4774-
// ignore: unused_local_variable
47754773
var metadata = pop() as List<AnnotationImpl>?;
4774+
var comment = _findComment(metadata, keyword);
47764775
push(PatternVariableDeclarationStatementImpl(
47774776
declaration: PatternVariableDeclarationImpl(
47784777
keyword: keyword,
47794778
pattern: pattern,
47804779
equals: equals,
4781-
expression: expression),
4780+
expression: expression,
4781+
comment: comment,
4782+
metadata: metadata),
47824783
semicolon: semicolon));
47834784
}
47844785

pkg/analyzer/test/generated/patterns_parser_test.dart

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5692,6 +5692,11 @@ f(x) {
56925692
assertParsedNodeText(node, r'''
56935693
PatternVariableDeclarationStatement
56945694
declaration: PatternVariableDeclaration
5695+
metadata
5696+
Annotation
5697+
atSign: @
5698+
name: SimpleIdentifier
5699+
token: annotation
56955700
keyword: final
56965701
pattern: ObjectPattern
56975702
type: NamedType
@@ -5724,6 +5729,11 @@ f(x) {
57245729
assertParsedNodeText(node, r'''
57255730
PatternVariableDeclarationStatement
57265731
declaration: PatternVariableDeclaration
5732+
metadata
5733+
Annotation
5734+
atSign: @
5735+
name: SimpleIdentifier
5736+
token: annotation
57275737
keyword: final
57285738
pattern: ListPattern
57295739
leftBracket: [
@@ -5749,6 +5759,11 @@ f(x) {
57495759
assertParsedNodeText(node, r'''
57505760
PatternVariableDeclarationStatement
57515761
declaration: PatternVariableDeclaration
5762+
metadata
5763+
Annotation
5764+
atSign: @
5765+
name: SimpleIdentifier
5766+
token: annotation
57525767
keyword: final
57535768
pattern: MapPattern
57545769
leftBracket: {
@@ -5778,6 +5793,11 @@ f(x) {
57785793
assertParsedNodeText(node, r'''
57795794
PatternVariableDeclarationStatement
57805795
declaration: PatternVariableDeclaration
5796+
metadata
5797+
Annotation
5798+
atSign: @
5799+
name: SimpleIdentifier
5800+
token: annotation
57815801
keyword: final
57825802
pattern: ParenthesizedPattern
57835803
leftParenthesis: (
@@ -5802,6 +5822,11 @@ f(x) {
58025822
assertParsedNodeText(node, r'''
58035823
PatternVariableDeclarationStatement
58045824
declaration: PatternVariableDeclaration
5825+
metadata
5826+
Annotation
5827+
atSign: @
5828+
name: SimpleIdentifier
5829+
token: annotation
58055830
keyword: final
58065831
pattern: RecordPattern
58075832
leftParenthesis: (
@@ -5828,6 +5853,11 @@ f(x) {
58285853
assertParsedNodeText(node, r'''
58295854
PatternVariableDeclarationStatement
58305855
declaration: PatternVariableDeclaration
5856+
metadata
5857+
Annotation
5858+
atSign: @
5859+
name: SimpleIdentifier
5860+
token: annotation
58315861
keyword: var
58325862
pattern: ObjectPattern
58335863
type: NamedType
@@ -5860,6 +5890,11 @@ f(x) {
58605890
assertParsedNodeText(node, r'''
58615891
PatternVariableDeclarationStatement
58625892
declaration: PatternVariableDeclaration
5893+
metadata
5894+
Annotation
5895+
atSign: @
5896+
name: SimpleIdentifier
5897+
token: annotation
58635898
keyword: var
58645899
pattern: ListPattern
58655900
leftBracket: [
@@ -5885,6 +5920,11 @@ f(x) {
58855920
assertParsedNodeText(node, r'''
58865921
PatternVariableDeclarationStatement
58875922
declaration: PatternVariableDeclaration
5923+
metadata
5924+
Annotation
5925+
atSign: @
5926+
name: SimpleIdentifier
5927+
token: annotation
58885928
keyword: var
58895929
pattern: MapPattern
58905930
leftBracket: {
@@ -5914,6 +5954,11 @@ f(x) {
59145954
assertParsedNodeText(node, r'''
59155955
PatternVariableDeclarationStatement
59165956
declaration: PatternVariableDeclaration
5957+
metadata
5958+
Annotation
5959+
atSign: @
5960+
name: SimpleIdentifier
5961+
token: annotation
59175962
keyword: var
59185963
pattern: ParenthesizedPattern
59195964
leftParenthesis: (
@@ -5938,6 +5983,11 @@ f(x) {
59385983
assertParsedNodeText(node, r'''
59395984
PatternVariableDeclarationStatement
59405985
declaration: PatternVariableDeclaration
5986+
metadata
5987+
Annotation
5988+
atSign: @
5989+
name: SimpleIdentifier
5990+
token: annotation
59415991
keyword: var
59425992
pattern: RecordPattern
59435993
leftParenthesis: (

pkg/dart2wasm/bin/dart2wasm.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ final List<Option> options = [
3535
defaultsTo: _d.translatorOptions.printKernel),
3636
Flag("print-wasm", (o, value) => o.translatorOptions.printWasm = value,
3737
defaultsTo: _d.translatorOptions.printWasm),
38-
Flag("string-data-segments",
39-
(o, value) => o.translatorOptions.stringDataSegments = value,
40-
defaultsTo: _d.translatorOptions.stringDataSegments),
4138
IntOption(
4239
"inlining-limit", (o, value) => o.translatorOptions.inliningLimit = value,
4340
defaultsTo: "${_d.translatorOptions.inliningLimit}"),

pkg/dart2wasm/dart2wasm.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ where *options* include:
2020
| `--`[`no-`]`print-kernel` | no | Print IR for each function before compiling it.
2121
| `--`[`no-`]`print-wasm` | no | Print Wasm instructions of each compiled function.
2222
| `--shared-memory-max-pages` *pagecount* | | Max size of the imported memory buffer. If `--shared-import-memory` is specified, this must also be specified.
23-
| `--`[`no-`]`string-data-segments` | no | Use experimental array init from data segment for string constants.
2423
| `--watch` *offset* | | Print stack trace leading to the byte at offset *offset* in the `.wasm` output file. Can be specified multiple times.
2524

2625
The resulting `.wasm` file can be run with:

pkg/dart2wasm/lib/class_info.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class FieldIndex {
2121
static const boxValue = 1;
2222
static const identityHash = 1;
2323
static const stringArray = 2;
24+
static const listArray = 4;
2425
static const hashBaseIndex = 2;
2526
static const hashBaseData = 4;
2627
static const closureContext = 2;
@@ -54,6 +55,7 @@ class FieldIndex {
5455
check(translator.boxedDoubleClass, "value", FieldIndex.boxValue);
5556
check(translator.oneByteStringClass, "_array", FieldIndex.stringArray);
5657
check(translator.twoByteStringClass, "_array", FieldIndex.stringArray);
58+
check(translator.listBaseClass, "_data", FieldIndex.listArray);
5759
check(translator.hashFieldBaseClass, "_index", FieldIndex.hashBaseIndex);
5860
check(translator.hashFieldBaseClass, "_data", FieldIndex.hashBaseData);
5961
check(translator.functionClass, "context", FieldIndex.closureContext);

pkg/dart2wasm/lib/code_generator.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,8 +2401,7 @@ class CodeGenerator extends ExpressionVisitor1<w.ValueType, w.ValueType>
24012401
: translator.fixedLengthListClass;
24022402
ClassInfo info = translator.classInfo[cls]!;
24032403
translator.functions.allocateClass(info.classId);
2404-
w.RefType refType = info.struct.fields.last.type.unpacked as w.RefType;
2405-
w.ArrayType arrayType = refType.heapType as w.ArrayType;
2404+
w.ArrayType arrayType = translator.listArrayType;
24062405
w.ValueType elementType = arrayType.elementType.type.unpacked;
24072406

24082407
b.i32_const(info.classId);
@@ -2414,7 +2413,8 @@ class CodeGenerator extends ExpressionVisitor1<w.ValueType, w.ValueType>
24142413
b.i32_const(length);
24152414
b.array_new_default(arrayType);
24162415
if (length > 0) {
2417-
w.Local arrayLocal = addLocal(refType.withNullability(false));
2416+
w.Local arrayLocal =
2417+
addLocal(w.RefType.def(arrayType, nullable: false));
24182418
b.local_set(arrayLocal);
24192419
for (int i = 0; i < length; i++) {
24202420
b.local_get(arrayLocal);

0 commit comments

Comments
 (0)