| Index: dart/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart
|
| diff --git a/dart/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart b/dart/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart
|
| deleted file mode 100644
|
| index a7b7f51100e9c7f84c48487a34099764bf3bff4a..0000000000000000000000000000000000000000
|
| --- a/dart/tests/compiler/dart2js_foreign/native_field_rename_1_test.dart
|
| +++ /dev/null
|
| @@ -1,85 +0,0 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -
|
| -// A native method prevents other members from having that name, including
|
| -// fields. However, native fields keep their name. The implication: a getter
|
| -// for the field must be based on the field's name, not the field's jsname.
|
| -
|
| -import "package:expect/expect.dart";
|
| -import 'native_metadata.dart';
|
| -
|
| -@Native("*A")
|
| -class A {
|
| - int key; // jsname is 'key'
|
| - int getKey() => key;
|
| -}
|
| -
|
| -class B {
|
| - int key; // jsname is not 'key'
|
| - B([this.key = 222]);
|
| - int getKey() => key;
|
| -}
|
| -
|
| -@Native("*X")
|
| -class X {
|
| - @Native('key') int native_key_method();
|
| - // This should cause B.key to be renamed, but not A.key.
|
| -
|
| - @natve('key') int key();
|
| -}
|
| -
|
| -@native A makeA();
|
| -@native X makeX();
|
| -
|
| -
|
| -@Native("""
|
| -// This code is all inside 'setup' and so not accesible from the global scope.
|
| -function A(){ this.key = 111; }
|
| -A.prototype.getKey = function(){return this.key;};
|
| -
|
| -function X(){}
|
| -X.prototype.key = function(){return 666;};
|
| -
|
| -makeA = function(){return new A};
|
| -makeX = function(){return new X};
|
| -""")
|
| -void setup();
|
| -
|
| -testDynamic() {
|
| - var things = [makeA(), new B(), makeX()];
|
| - var a = things[0];
|
| - var b = things[1];
|
| - var x = things[2];
|
| -
|
| - Expect.equals(111, a.key);
|
| - Expect.equals(222, b.key);
|
| - Expect.equals(111, a.getKey());
|
| - Expect.equals(222, b.getKey());
|
| -
|
| -
|
| - Expect.equals(666, x.native_key_method());
|
| - Expect.equals(666, x.key());
|
| - // The getter for the closurized member must also have the right name.
|
| - var fn = x.key;
|
| - Expect.equals(666, fn());
|
| -}
|
| -
|
| -testTyped() {
|
| - A a = makeA();
|
| - B b = new B();
|
| - X x = makeX();
|
| -
|
| - Expect.equals(666, x.native_key_method());
|
| - Expect.equals(111, a.key);
|
| - Expect.equals(222, b.key);
|
| - Expect.equals(111, a.getKey());
|
| - Expect.equals(222, b.getKey());
|
| -}
|
| -
|
| -main() {
|
| - setup();
|
| -
|
| - testTyped();
|
| - testDynamic();
|
| -}
|
|
|