Skip to content

Commit

Permalink
Test CFE constants in side-effects test
Browse files Browse the repository at this point in the history
Change-Id: I720a4e1b574a19aebb93dfab17a372f987f2cb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99153
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
  • Loading branch information
johnniwinther authored and commit-bot@chromium.org committed Aug 9, 2019
1 parent 6839e0d commit b614253
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pkg/compiler/lib/src/ir/visitors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ class Stringifier extends ir.ExpressionVisitor<String> {
}
return sb.toString();
}

@override
String visitConstantExpression(ir.ConstantExpression node) {
ir.Constant constant = node.constant;
if (constant is ir.StringConstant) {
return constant.value;
}
return null;
}
}

/// Visitor that converts a kernel constant expression into a
Expand Down
12 changes: 10 additions & 2 deletions tests/compiler/dart2js/inference/side_effects/foreign.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ jsBuiltin_rawRtiToJsConstructorName() {
return JS_BUILTIN('String', JsBuiltin.rawRtiToJsConstructorName, null);
}

/*member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
/*strong.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
/*omit.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads static; writes nothing)*/
// With CFE constant we no longer get the noise from the static get if GET_TYPE_FROM_NAME.
/*strongConst.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads nothing; writes nothing)*/
/*omitConst.member: jsEmbeddedGlobal_getTypeFromName:SideEffects(reads nothing; writes nothing)*/
jsEmbeddedGlobal_getTypeFromName() {
return JS_EMBEDDED_GLOBAL('', GET_TYPE_FROM_NAME);
}

/*member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
/*strong.member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
/*omit.member: jsEmbeddedGlobal_libraries:SideEffects(reads static; writes nothing)*/
// With CFE constant we no longer get the noise from the static get if LIBRARIES.
/*strongConst.member: jsEmbeddedGlobal_libraries:SideEffects(reads nothing; writes nothing)*/
/*omitConst.member: jsEmbeddedGlobal_libraries:SideEffects(reads nothing; writes nothing)*/
jsEmbeddedGlobal_libraries() {
return JS_EMBEDDED_GLOBAL('JSExtendableArray|Null', LIBRARIES);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/compiler/dart2js/inference/side_effects_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ main(List<String> args) {
Directory dataDir =
new Directory.fromUri(Platform.script.resolve('side_effects'));
await checkTests(dataDir, const SideEffectsDataComputer(),
args: args, options: [stopAfterTypeInference]);
args: args,
options: [stopAfterTypeInference],
testedConfigs: allInternalConfigs);
});
}

Expand Down

0 comments on commit b614253

Please sign in to comment.