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

Side by Side Diff: tests/compiler/dart2js_native/native_field_invocation6_test.dart

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:_js_helper";
5 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
6 7
7 makeA() native; 8 makeA() native;
8 nativeFirst(x, y) native; 9 nativeFirst(x, y) native;
9 10
10 void setup() native """ 11 void setup() native """
11 nativeFirst = function(x, y) { return x; } 12 nativeFirst = function(x, y) { return x; }
12 13
13 function A() {} 14 function A() {}
14 makeA = function() { return new A; } 15 makeA = function() { return new A; }
15 """; 16 """;
16 17
17 18
18 class A native "A" { 19 @Native("A")
20 class A {
19 var _foo; 21 var _foo;
20 22
21 get foo => _foo; 23 get foo => _foo;
22 24
23 init() { 25 init() {
24 _foo = () => 42; 26 _foo = () => 42;
25 } 27 }
26 } 28 }
27 29
28 class B { 30 class B {
(...skipping 15 matching lines...) Expand all
44 var b = new B(); 46 var b = new B();
45 var c = new C(); 47 var c = new C();
46 var d = new D(); 48 var d = new D();
47 a = nativeFirst(a, b); 49 a = nativeFirst(a, b);
48 a = nativeFirst(a, c); 50 a = nativeFirst(a, c);
49 a = nativeFirst(a, d); 51 a = nativeFirst(a, d);
50 // The variable a is still an instance of class A, but dart2js can't infer 52 // The variable a is still an instance of class A, but dart2js can't infer
51 // that anymore. 53 // that anymore.
52 Expect.equals(42, a.foo()); 54 Expect.equals(42, a.foo());
53 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698