Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: tests/compiler/dart2js_native/native_method_inlining_test.dart

Issue 2990083002: dart2js_native tests: Migrate 'native STRING' to JS-calls - part 2/2 (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js_native/native_method_inlining_test.dart
diff --git a/tests/compiler/dart2js_native/native_method_inlining_test.dart b/tests/compiler/dart2js_native/native_method_inlining_test.dart
index 269f3a02330a715319d3a98ec9c45341d38db557..ac3be9598f3416b3d289d8a66954014fbcb0becc 100644
--- a/tests/compiler/dart2js_native/native_method_inlining_test.dart
+++ b/tests/compiler/dart2js_native/native_method_inlining_test.dart
@@ -53,26 +53,29 @@ A makeA() native;
String findMethodTextContaining(instance, string) native;
-void setup() native r"""
-function A() {}
-A.prototype.foo = function () { return arguments.length; };
-A.prototype.callFun = function (fn) { return fn ? fn(123) : 1; };
-
-makeA = function(){return new A;};
-
-findMethodTextContaining = function (instance, string) {
- var proto = Object.getPrototypeOf(instance);
- var keys = Object.keys(proto);
- for (var i = 0; i < keys.length; i++) {
- var name = keys[i];
- var member = proto[name];
- var s = String(member);
- if (s.indexOf(string)>0) return s;
- }
-};
-
-self.nativeConstructor(A);
-""";
+void setup() {
+ JS('', r"""
+(function(){
+ function A() {}
+ A.prototype.foo = function () { return arguments.length; };
+ A.prototype.callFun = function (fn) { return fn ? fn(123) : 1; };
+
+ makeA = function(){return new A()};
+
+ findMethodTextContaining = function (instance, string) {
+ var proto = Object.getPrototypeOf(instance);
+ var keys = Object.keys(proto);
+ for (var i = 0; i < keys.length; i++) {
+ var name = keys[i];
+ var member = proto[name];
+ var s = String(member);
+ if (s.indexOf(string)>0) return s;
+ }
+ };
+
+ self.nativeConstructor(A);
+})()""");
+}
bool get isCheckedMode {
int i = 0;

Powered by Google App Engine
This is Rietveld 408576698