Skip to content

Commit 05fc6bd

Browse files
mkustermannCommit Queue
authored andcommitted
[dart2wasm] Use unchecked entry if an InstanceInvocation has isInvariant flag set
The CFE marks nodes as invariant if it's guaranteed the covariance checks would succeed. It does so e.g. in this example final list = <int>[]; list.add(1); Change-Id: I2c9b0883e0c69e128c8014934a325ce8ef21a8d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416942 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Ömer Ağacan <[email protected]>
1 parent acd16c6 commit 05fc6bd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/dart2wasm/lib/translator.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ class Translator with KernelNodes {
14401440

14411441
bool canUseUncheckedEntry(Expression receiver, Expression node) {
14421442
if (receiver is ThisExpression) return true;
1443+
if (node is InstanceInvocation && node.isInvariant) return true;
14431444
return inferredTypeMetadata[node]?.skipCheck ?? false;
14441445
}
14451446

0 commit comments

Comments
 (0)