| Index: tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart
|
| diff --git a/tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart b/tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart
|
| index e1ce39f22081da0ba70a2200c2981041d9a61c6b..8fa4b67565d9fb08379f3e51265af839088d1e11 100644
|
| --- a/tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart
|
| +++ b/tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart
|
| @@ -30,40 +30,43 @@ makeB() native;
|
| makeC() native;
|
| makeD() 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 A(){}
|
| -function B(){}
|
| -inherits(B, A);
|
| -function C(){}
|
| -inherits(C, B);
|
| -function D(){}
|
| -inherits(D, C);
|
| -
|
| -A.prototype.foo = function(a){return 'A.foo(' + a + ')';}
|
| -C.prototype.foo = function(z){return 'C.foo(' + z + ')';}
|
| -
|
| -makeA = function(){return new A};
|
| -makeB = function(){return new B};
|
| -makeC = function(){return new C};
|
| -makeD = function(){return new D};
|
| -
|
| -self.nativeConstructor(A);
|
| -self.nativeConstructor(B);
|
| -self.nativeConstructor(C);
|
| -self.nativeConstructor(D);
|
| -""";
|
| + function A(){}
|
| + function B(){}
|
| + inherits(B, A);
|
| + function C(){}
|
| + inherits(C, B);
|
| + function D(){}
|
| + inherits(D, C);
|
| +
|
| + A.prototype.foo = function(a){return 'A.foo(' + a + ')'};
|
| + C.prototype.foo = function(z){return 'C.foo(' + z + ')'};
|
| +
|
| + makeA = function(){return new A()};
|
| + makeB = function(){return new B()};
|
| + makeC = function(){return new C()};
|
| + makeD = function(){return new D()};
|
| +
|
| + self.nativeConstructor(A);
|
| + self.nativeConstructor(B);
|
| + self.nativeConstructor(C);
|
| + self.nativeConstructor(D);
|
| +})()""");
|
| +}
|
|
|
| main() {
|
| nativeTesting();
|
|
|