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

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

Issue 2850783002: Dart SDK Spelling b, c, and d. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test to see if a Dart class name is confused with dispatch tag. Both class A 5 // Test to see if a Dart class name is confused with dispatch tag. Both class A
6 // and class Z have a JavaScript constuctor named "A". The dynamic native class 6 // and class Z have a JavaScript constructor named "A". The dynamic native
7 // dispatch hook on Object.prototype should avoid patching the Dart class A. 7 // class dispatch hook on Object.prototype should avoid patching the Dart class
8 // This could be done by renaming the Dart constructor or by being able to check 8 // A. This could be done by renaming the Dart constructor or by being able to
9 // that objects are Dart classes. 9 // check that objects are Dart classes.
10 10
11 import "native_testing.dart"; 11 import "native_testing.dart";
12 12
13 class A {} 13 class A {}
14 14
15 @Native("A") 15 @Native("A")
16 class Z { 16 class Z {
17 foo() => 100; 17 foo() => 100;
18 } 18 }
19 19
20 makeZ() native; 20 makeZ() native;
21 21
22 void setup() native """ 22 void setup() native """
23 function A(){} 23 function A(){}
24 makeZ = function(){return new A}; 24 makeZ = function(){return new A};
25 self.nativeConstructor(A); 25 self.nativeConstructor(A);
26 """; 26 """;
27 27
28 main() { 28 main() {
29 nativeTesting(); 29 nativeTesting();
30 setup(); 30 setup();
31 31
32 var a = new A(); 32 var a = new A();
33 var z = makeZ(); 33 var z = makeZ();
34 34
35 Expect.equals(100, z.foo()); 35 Expect.equals(100, z.foo());
36 36
37 Expect.throws(() => a.foo(), (ex) => ex is NoSuchMethodError); 37 Expect.throws(() => a.foo(), (ex) => ex is NoSuchMethodError);
38 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698