mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[cfe] Implement RecordLiteral.transformOrRemoveChildren
Closes #50004 Change-Id: Iaea68b563bd59bb3280bd6ffb86f18d50f3d2a4b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260105 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
9f75d4426e
commit
281a8a5d2b
7
pkg/front_end/testcases/records/issue50004.dart
Normal file
7
pkg/front_end/testcases/records/issue50004.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
main() {
|
||||
var r1 = (1, const [42]);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → dynamic {
|
||||
(core::int, core::List<core::int>) r1 = (1, #C2);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 42
|
||||
#C2 = <core::int>[#C1]
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → dynamic {
|
||||
(core::int, core::List<core::int>) r1 = (1, #C2);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 42
|
||||
#C2 = <core::int>[#C1]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
main() {}
|
|
@ -0,0 +1 @@
|
|||
main() {}
|
12
pkg/front_end/testcases/records/issue50004.dart.weak.expect
Normal file
12
pkg/front_end/testcases/records/issue50004.dart.weak.expect
Normal file
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → dynamic {
|
||||
(core::int, core::List<core::int>) r1 = (1, #C2);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 42
|
||||
#C2 = <core::int*>[#C1]
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → dynamic {
|
||||
(core::int, core::List<core::int>) r1 = (1, #C2);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 42
|
||||
#C2 = <core::int*>[#C1]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,12 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
static method main() → dynamic {
|
||||
(core::int, core::List<core::int>) r1 = (1, #C2);
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = 42
|
||||
#C2 = <core::int*>[#C1]
|
||||
}
|
|
@ -26,7 +26,7 @@ static method method() → dynamic {
|
|||
(0, {b: 1});
|
||||
({a: 0, b: 1});
|
||||
let final core::int #t1 = 0 in (1, {a: #t1});
|
||||
(core::int, core::String);
|
||||
(#C1, #C2);
|
||||
}
|
||||
static method sorting() → dynamic {
|
||||
({a: 0, b: 1, c: 2, d: 3});
|
||||
|
@ -40,3 +40,8 @@ static method sorting() → dynamic {
|
|||
let final core::int #t23 = 0 in let final core::int #t24 = 1 in let final core::int #t25 = 2 in (#t23, #t25, 3, {a: #t24, b: 4, c: 5});
|
||||
let final core::int #t26 = 0 in let final core::int #t27 = 1 in let final core::int #t28 = 2 in (#t27, #t28, 3, {a: #t26, b: 4, c: 5});
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = TypeLiteralConstant(core::int)
|
||||
#C2 = TypeLiteralConstant(core::String)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static method method() → dynamic {
|
|||
(0, {b: 1});
|
||||
({a: 0, b: 1});
|
||||
let final core::int #t1 = 0 in (1, {a: #t1});
|
||||
(core::int, core::String);
|
||||
(#C1, #C2);
|
||||
}
|
||||
static method sorting() → dynamic {
|
||||
({a: 0, b: 1, c: 2, d: 3});
|
||||
|
@ -41,11 +41,13 @@ static method sorting() → dynamic {
|
|||
let final core::int #t26 = 0 in let final core::int #t27 = 1 in let final core::int #t28 = 2 in (#t27, #t28, 3, {a: #t26, b: 4, c: 5});
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = TypeLiteralConstant(core::int)
|
||||
#C2 = TypeLiteralConstant(core::String)
|
||||
}
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:10:7 -> IntConstant(0)
|
||||
Evaluated: TypeLiteral @ org-dartlang-testcase:///record_literal.dart:11:4 -> TypeLiteralConstant(int)
|
||||
Evaluated: TypeLiteral @ org-dartlang-testcase:///record_literal.dart:11:9 -> TypeLiteralConstant(String)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:7 -> IntConstant(0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:13 -> IntConstant(1)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:19 -> IntConstant(2)
|
||||
|
@ -73,4 +75,4 @@ Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:23:10 -> I
|
|||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:10 -> IntConstant(1)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:13 -> IntConstant(2)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:7 -> IntConstant(0)
|
||||
Extra constant evaluation: evaluated: 75, effectively constant: 30
|
||||
Extra constant evaluation: evaluated: 73, effectively constant: 28
|
||||
|
|
|
@ -26,7 +26,7 @@ static method method() → dynamic {
|
|||
(0, {b: 1});
|
||||
({a: 0, b: 1});
|
||||
let final core::int #t1 = 0 in (1, {a: #t1});
|
||||
(core::int, core::String);
|
||||
(#C1, #C2);
|
||||
}
|
||||
static method sorting() → dynamic {
|
||||
({a: 0, b: 1, c: 2, d: 3});
|
||||
|
@ -40,3 +40,8 @@ static method sorting() → dynamic {
|
|||
let final core::int #t23 = 0 in let final core::int #t24 = 1 in let final core::int #t25 = 2 in (#t23, #t25, 3, {a: #t24, b: 4, c: 5});
|
||||
let final core::int #t26 = 0 in let final core::int #t27 = 1 in let final core::int #t28 = 2 in (#t27, #t28, 3, {a: #t26, b: 4, c: 5});
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = TypeLiteralConstant(core::int*)
|
||||
#C2 = TypeLiteralConstant(core::String*)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static method method() → dynamic {
|
|||
(0, {b: 1});
|
||||
({a: 0, b: 1});
|
||||
let final core::int #t1 = 0 in (1, {a: #t1});
|
||||
(core::int, core::String);
|
||||
(#C1, #C2);
|
||||
}
|
||||
static method sorting() → dynamic {
|
||||
({a: 0, b: 1, c: 2, d: 3});
|
||||
|
@ -40,3 +40,8 @@ static method sorting() → dynamic {
|
|||
let final core::int #t23 = 0 in let final core::int #t24 = 1 in let final core::int #t25 = 2 in (#t23, #t25, 3, {a: #t24, b: 4, c: 5});
|
||||
let final core::int #t26 = 0 in let final core::int #t27 = 1 in let final core::int #t28 = 2 in (#t27, #t28, 3, {a: #t26, b: 4, c: 5});
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = TypeLiteralConstant(core::int*)
|
||||
#C2 = TypeLiteralConstant(core::String*)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ static method method() → dynamic {
|
|||
(0, {b: 1});
|
||||
({a: 0, b: 1});
|
||||
let final core::int #t1 = 0 in (1, {a: #t1});
|
||||
(core::int, core::String);
|
||||
(#C1, #C2);
|
||||
}
|
||||
static method sorting() → dynamic {
|
||||
({a: 0, b: 1, c: 2, d: 3});
|
||||
|
@ -41,11 +41,13 @@ static method sorting() → dynamic {
|
|||
let final core::int #t26 = 0 in let final core::int #t27 = 1 in let final core::int #t28 = 2 in (#t27, #t28, 3, {a: #t26, b: 4, c: 5});
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = TypeLiteralConstant(core::int*)
|
||||
#C2 = TypeLiteralConstant(core::String*)
|
||||
}
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:10:7 -> IntConstant(0)
|
||||
Evaluated: TypeLiteral @ org-dartlang-testcase:///record_literal.dart:11:4 -> TypeLiteralConstant(int*)
|
||||
Evaluated: TypeLiteral @ org-dartlang-testcase:///record_literal.dart:11:9 -> TypeLiteralConstant(String*)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:7 -> IntConstant(0)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:13 -> IntConstant(1)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:16:19 -> IntConstant(2)
|
||||
|
@ -73,4 +75,4 @@ Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:23:10 -> I
|
|||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:10 -> IntConstant(1)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:13 -> IntConstant(2)
|
||||
Evaluated: VariableGet @ org-dartlang-testcase:///record_literal.dart:24:7 -> IntConstant(0)
|
||||
Extra constant evaluation: evaluated: 75, effectively constant: 30
|
||||
Extra constant evaluation: evaluated: 73, effectively constant: 28
|
||||
|
|
|
@ -8728,7 +8728,12 @@ class RecordLiteral extends Expression {
|
|||
}
|
||||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {}
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
v.transformExpressionList(positional, this);
|
||||
v.transformNamedExpressionList(named, this);
|
||||
recordType =
|
||||
v.visitDartType(recordType, cannotRemoveSentinel) as RecordType;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
|
Loading…
Reference in a new issue