Skip to content

Commit b614253

Browse files
johnniwinthercommit-bot@chromium.org
authored andcommitted
Test CFE constants in side-effects test
Change-Id: I720a4e1b574a19aebb93dfab17a372f987f2cb71 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99153 Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]>
1 parent 6839e0d commit b614253

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

pkg/compiler/lib/src/ir/visitors.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ class Stringifier extends ir.ExpressionVisitor<String> {
3636
}
3737
return sb.toString();
3838
}
39+
40+
@override
41+
String visitConstantExpression(ir.ConstantExpression node) {
42+
ir.Constant constant = node.constant;
43+
if (constant is ir.StringConstant) {
44+
return constant.value;
45+
}
46+
return null;
47+
}
3948
}
4049

4150
/// Visitor that converts a kernel constant expression into a

tests/compiler/dart2js/inference/side_effects/foreign.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,20 @@ jsBuiltin_rawRtiToJsConstructorName() {
2929
return JS_BUILTIN('String', JsBuiltin.rawRtiToJsConstructorName, null);
3030
}
3131

32-
/*member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
32+
/*strong.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
33+
/*omit.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
34+
// With CFE constant we no longer get the noise from the static get if GET_TYPE_FROM_NAME.
35+
/*strongConst.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads nothing; writes nothing)*/
36+
/*omitConst.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads nothing; writes nothing)*/
3337
jsEmbeddedGlobal_getTypeFromName() {
3438
return JS_EMBEDDED_GLOBAL('', GET_TYPE_FROM_NAME);
3539
}
3640

37-
/*member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
41+
/*strong.member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
42+
/*omit.member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
43+
// With CFE constant we no longer get the noise from the static get if LIBRARIES.
44+
/*strongConst.member: jsEmbeddedGlobal_libraries:SideEffects(reads nothing; writes nothing)*/
45+
/*omitConst.member: jsEmbeddedGlobal_libraries:SideEffects(reads nothing; writes nothing)*/
3846
jsEmbeddedGlobal_libraries() {
3947
return JS_EMBEDDED_GLOBAL('JSExtendableArray|Null', LIBRARIES);
4048
}

tests/compiler/dart2js/inference/side_effects_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ main(List<String> args) {
2121
Directory dataDir =
2222
new Directory.fromUri(Platform.script.resolve('side_effects'));
2323
await checkTests(dataDir, const SideEffectsDataComputer(),
24-
args: args, options: [stopAfterTypeInference]);
24+
args: args,
25+
options: [stopAfterTypeInference],
26+
testedConfigs: allInternalConfigs);
2527
});
2628
}
2729

0 commit comments

Comments
 (0)