@@ -1129,9 +1129,10 @@ int main() {
1129
1129
var k = Key('t');
1130
1130
MyClass c = MyClass(0);
1131
1131
int p = 1;
1132
+ const t = 1;
1132
1133
1133
1134
/* evaluation placeholder */
1134
- print('\$ c, \$ k');
1135
+ print('\$ c, \$ k, \$ t ');
1135
1136
}
1136
1137
''' ;
1137
1138
@@ -1158,7 +1159,7 @@ int main() {
1158
1159
''' );
1159
1160
});
1160
1161
1161
- test ('evaluate const expression' , () async {
1162
+ test ('evaluate new const expression' , () async {
1162
1163
await driver.check (
1163
1164
scope: < String , String > {'p' : '1' },
1164
1165
expression: 'const MyClass(1)' ,
@@ -1171,6 +1172,20 @@ int main() {
1171
1172
''' );
1172
1173
});
1173
1174
1175
+ test ('evaluate optimized const expression' , () async {
1176
+ await driver.check (
1177
+ scope: < String , String > {},
1178
+ expression: 't' ,
1179
+ expectedResult: '''
1180
+ (function() {
1181
+ return 1;
1182
+ }(
1183
+ ))
1184
+ ''' );
1185
+ },
1186
+ skip:
1187
+ 'Cannot compile constants optimized away by the frontend' ); // https://github.com/dart-lang/sdk/issues/41999
1188
+
1174
1189
test ('evaluate factory constructor call' , () async {
1175
1190
await driver.check (
1176
1191
scope: < String , String > {'p' : '1' },
@@ -1182,24 +1197,20 @@ int main() {
1182
1197
1
1183
1198
))
1184
1199
''' );
1185
- },
1186
- skip:
1187
- 'Incorrect kernel for factory constructor call' ); // https://github.com/dart-lang/sdk/issues/41976
1200
+ });
1188
1201
1189
1202
test ('evaluate const factory constructor call' , () async {
1190
1203
await driver.check (
1191
1204
scope: < String , String > {'p' : '1' },
1192
1205
expression: "const Key('t')" ,
1193
1206
expectedResult: '''
1194
1207
(function(p) {
1195
- return dart.const(new foo.ValueKey.new("t")) ;
1208
+ return C0 || CT.C0 ;
1196
1209
}(
1197
1210
1
1198
1211
))
1199
1212
''' );
1200
- },
1201
- skip:
1202
- 'Incorrect kernel for factory constructor call' ); // https://github.com/dart-lang/sdk/issues/41976
1213
+ });
1203
1214
});
1204
1215
1205
1216
return 0 ;
0 commit comments