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

Commit 962cd6e

Browse files
author
Dart CI
committed
Version 2.19.0-430.0.dev
Merge 8b12c0c into dev
2 parents eddf73d + 8b12c0c commit 962cd6e

File tree

132 files changed

+3351
-653
lines changed

Some content is hidden

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

132 files changed

+3351
-653
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
library-level documentation comments, and with this new feature, you don't
5151
have to provide a unique name for each library directive. Instead, a name can
5252
simply be omitted (see [#1073][]).
53-
53+
5454
[#1073]: https://github.com/dart-lang/language/issues/1073
5555

5656
### Libraries
@@ -71,6 +71,8 @@
7171
- Deprecated `RangeError.checkValidIndex` in favor of `IndexError.check`.
7272
- Deprecated `IndexError` constructor in favor of `IndexError.withLength`
7373
constructor.
74+
- Deprecated `NullThrownError` and `CyclicInitializationError`.
75+
Neither error is thrown by null safe code.
7476

7577
[#49529]: https://github.com/dart-lang/sdk/issues/49529
7678
[#24644]: https://github.com/dart-lang/sdk/issues/24644

pkg/dart2wasm/dart2wasm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Running dart2wasm
22

3-
You don't need to build the Dart SDK to run dart2wasm, as long as you have a Dart SDK installed.
3+
You don't need to build the Dart SDK to run dart2wasm, as long as you have a Dart SDK installed and have the [Dart SDK repository checked out](https://github.com/dart-lang/sdk/wiki/Building#getting-the-source).
44

5-
To compile a Dart file to Wasm, run:
5+
To compile a Dart file to Wasm, in a checkout of the Dart SDK repository, run:
66

77
`dart --enable-asserts pkg/dart2wasm/bin/dart2wasm.dart` *options* *infile*`.dart` *outfile*`.wasm`
88

pkg/dart2wasm/lib/dispatch_table.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class SelectorInfo {
5959
/// Number of non-abstract references in [targets].
6060
late final int targetCount;
6161

62-
/// Whether this selector's member is invoked in a dynamic invocation.
63-
bool _calledDynamically = false;
64-
6562
/// When [targetCount] is 1, this holds the only non-abstract target of the
6663
/// selector.
6764
late final Reference? singularTarget;
@@ -304,7 +301,6 @@ class DispatchTable {
304301
_selectorMetadata[selectorId].callCount, paramInfo, returnCount));
305302
selector.paramInfo.merge(paramInfo);
306303
selector._returnCount = max(selector._returnCount, returnCount);
307-
selector._calledDynamically |= calledDynamically;
308304
if (calledDynamically) {
309305
if (isGetter) {
310306
(_dynamicGets[member.name.text] ??= []).add(selector);
@@ -412,7 +408,7 @@ class DispatchTable {
412408

413409
// Assign selector offsets
414410

415-
/// Whether the selector will be used in a dynamic or instance invocation.
411+
/// Whether the selector will be used in an instance invocation.
416412
///
417413
/// If not, then we don't add the selector to the dispatch table and don't
418414
/// assign it a dispatch table offset.
@@ -421,7 +417,6 @@ class DispatchTable {
421417
/// invocations of `objectNoSuchMethod` in dynamic calls, so keep it alive
422418
/// even if there was no references to it from the Dart code.
423419
bool needsDispatch(SelectorInfo selector) =>
424-
(selector._calledDynamically && selector.targetCount > 0) ||
425420
(selector.callCount > 0 && selector.targetCount > 1) ||
426421
(selector.paramInfo.member! == translator.objectNoSuchMethod);
427422

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,19 +2616,32 @@ class BodyBuilder extends StackListenerImpl
26162616
reportIfNotEnabled(
26172617
libraryFeatures.patterns, token.charOffset, token.charCount);
26182618
// ignore: unused_local_variable
2619-
Pattern left = toPattern(pop());
2620-
// ignore: unused_local_variable
26212619
Pattern right = toPattern(pop());
2620+
// ignore: unused_local_variable
2621+
Pattern left = toPattern(pop());
26222622
// TODO(johnniwinther): Create a binary pattern.
26232623

26242624
String operator = token.lexeme;
2625-
BinaryPatternKind kind;
26262625
switch (operator) {
26272626
case '&':
2628-
kind = BinaryPatternKind.and;
2627+
push(new AndPattern(left, right, token.charOffset));
26292628
break;
26302629
case '|':
2631-
kind = BinaryPatternKind.or;
2630+
Map<String, VariableDeclaration> leftVariablesByName = {
2631+
for (VariableDeclaration leftVariable in left.declaredVariables)
2632+
leftVariable.name!: leftVariable
2633+
};
2634+
if (!leftVariablesByName.keys.toSet().containsAll(
2635+
right.declaredVariables.map((variable) => variable.name!)) &&
2636+
leftVariablesByName.length == right.declaredVariables.length) {
2637+
// TODO(cstefantsova): Report a compile-time error.
2638+
}
2639+
push(new OrPattern(left, right, token.charOffset,
2640+
orPatternJointVariables: [
2641+
for (VariableDeclaration leftVariable in left.declaredVariables)
2642+
forest.createVariableDeclaration(
2643+
leftVariable.fileOffset, leftVariable.name)
2644+
]));
26322645
break;
26332646
default:
26342647
internalProblem(
@@ -2637,7 +2650,6 @@ class BodyBuilder extends StackListenerImpl
26372650
token.charOffset,
26382651
uri);
26392652
}
2640-
push(new BinaryPattern(left, kind, right, token.charOffset));
26412653
}
26422654

26432655
void doBinaryExpression(Token token) {
@@ -4408,8 +4420,8 @@ class BodyBuilder extends StackListenerImpl
44084420
ValueKinds.Pattern,
44094421
])
44104422
]));
4411-
Pattern key = toPattern(pop());
44124423
Pattern value = toPattern(pop());
4424+
Pattern key = toPattern(pop());
44134425
push(new MapPatternEntry(key, value, colon.charOffset));
44144426
}
44154427

@@ -7615,16 +7627,7 @@ class BodyBuilder extends StackListenerImpl
76157627
Message message, String className,
76167628
[int charOffset = -1]) {
76177629
addProblemErrorIfConst(message, charOffset, className.length);
7618-
// TODO(ahe): The following doesn't make sense to Analyzer AST.
7619-
MemberBuilder constructor =
7620-
libraryBuilder.loader.getAbstractClassInstantiationError();
7621-
Expression invocation = buildStaticInvocation(
7622-
constructor.member,
7623-
forest.createArguments(charOffset,
7624-
<Expression>[forest.createStringLiteral(charOffset, className)]),
7625-
constness: Constness.explicitNew,
7626-
charOffset: charOffset);
7627-
return forest.createThrow(charOffset, invocation);
7630+
return new InvalidExpression(message.problemMessage);
76287631
}
76297632

76307633
Statement buildProblemStatement(Message message, int charOffset,

pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
15661566
// ignore: unnecessary_null_comparison
15671567
assert(named != null);
15681568

1569-
return new RecordConstant(positional, named, node.recordType);
1569+
return canonicalize(new RecordConstant(positional, named, node.recordType));
15701570
}
15711571

15721572
@override
@@ -3634,6 +3634,24 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
36343634

36353635
bool hasPrimitiveEqual(Constant constant) {
36363636
if (intFolder.isInt(constant)) return true;
3637+
if (constant is RecordConstant) {
3638+
bool nonPrimitiveEqualsFound = false;
3639+
for (Constant field in constant.positional) {
3640+
if (!hasPrimitiveEqual(field)) {
3641+
nonPrimitiveEqualsFound = true;
3642+
break;
3643+
}
3644+
}
3645+
for (Constant field in constant.named.values) {
3646+
if (!hasPrimitiveEqual(field)) {
3647+
nonPrimitiveEqualsFound = true;
3648+
break;
3649+
}
3650+
}
3651+
if (nonPrimitiveEqualsFound) {
3652+
return false;
3653+
}
3654+
}
36373655
DartType type = constant.getType(_staticTypeContext!);
36383656
return !(type is InterfaceType && !classHasPrimitiveEqual(type.classNode));
36393657
}

pkg/front_end/lib/src/fasta/kernel/forest.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,11 @@ class Forest {
413413
/// [fileOffset]. The [condition] is the expression preceding the question
414414
/// mark. The [thenExpression] is the expression following the question mark.
415415
/// The [elseExpression] is the expression following the colon.
416-
Expression createConditionalExpression(int fileOffset, Expression condition,
417-
Expression thenExpression, Expression elseExpression) {
416+
ConditionalExpression createConditionalExpression(
417+
int fileOffset,
418+
Expression condition,
419+
Expression thenExpression,
420+
Expression elseExpression) {
418421
return new ConditionalExpression(
419422
condition, thenExpression, elseExpression, const UnknownType())
420423
..fileOffset = fileOffset;

0 commit comments

Comments
 (0)