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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files 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_class_inheritance3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart b/tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart
index 8f900ef97dc53212a5571af6c9f73cf4cb6e412d..af5a8e3df43c5a00d9209c2f4d1fe61924dfcfe5 100644
--- a/tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart
+++ b/tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart
@@ -30,40 +30,43 @@ makeB2() native;
makeObject() native;
-void setup() native """
-// This code is all inside 'setup' and so not accessible from the global scope.
-function inherits(child, parent) {
- if (child.prototype.__proto__) {
- child.prototype.__proto__ = parent.prototype;
- } else {
- function tmp() {};
- tmp.prototype = parent.prototype;
- child.prototype = new tmp();
- child.prototype.constructor = child;
+void setup() {
+ JS('', r"""
+(function(){
+ // This code is inside 'setup' and so not accessible from the global scope.
+ function inherits(child, parent) {
+ if (child.prototype.__proto__) {
+ child.prototype.__proto__ = parent.prototype;
+ } else {
+ function tmp() {};
+ tmp.prototype = parent.prototype;
+ child.prototype = new tmp();
+ child.prototype.constructor = child;
+ }
}
-}
-function A1(){}
-function B1(){}
-inherits(B1, A1);
+ function A1(){}
+ function B1(){}
+ inherits(B1, A1);
-makeA1 = function(){return new A1};
-makeB1 = function(){return new B1};
+ makeA1 = function(){return new A1()};
+ makeB1 = function(){return new B1()};
-function A2(){}
-function B2(){}
-inherits(B2, A2);
-A2.prototype.foo = function(a){return 'A2.foo(' + a + ')';}
+ function A2(){}
+ function B2(){}
+ inherits(B2, A2);
+ A2.prototype.foo = function(a){return 'A2.foo(' + a + ')';};
-makeA2 = function(){return new A2};
-makeB2 = function(){return new B2};
+ makeA2 = function(){return new A2()};
+ makeB2 = function(){return new B2()};
-makeObject = function(){return new Object};
+ makeObject = function(){return new Object()};
-self.nativeConstructor(A1);
-self.nativeConstructor(A2);
-self.nativeConstructor(B1);
-self.nativeConstructor(B2);
-""";
+ self.nativeConstructor(A1);
+ self.nativeConstructor(A2);
+ self.nativeConstructor(B1);
+ self.nativeConstructor(B2);
+})()""");
+}
main() {
nativeTesting();

Powered by Google App Engine
This is Rietveld 408576698