OLD | NEW |
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 part of dart._js_helper; | 5 part of dart._js_helper; |
6 | 6 |
7 /// Tells the optimizing compiler that the annotated method cannot throw. | 7 /// Tells the optimizing compiler that the annotated method cannot throw. |
8 /// Requires @NoInline() to function correctly. | 8 /// Requires @NoInline() to function correctly. |
9 class NoThrows { | 9 class NoThrows { |
10 const NoThrows(); | 10 const NoThrows(); |
11 } | 11 } |
12 | 12 |
13 /// Tells the optimizing compiler to not inline the annotated method. | 13 /// Tells the optimizing compiler to not inline the annotated method. |
14 class NoInline { | 14 class NoInline { |
15 const NoInline(); | 15 const NoInline(); |
16 } | 16 } |
17 | 17 |
18 /// Marks a class as native and defines its JavaScript name(s). | 18 /// Marks a class as native and defines its JavaScript name(s). |
19 class Native { | 19 class Native { |
20 final String name; | 20 final String name; |
21 const Native(this.name); | 21 const Native(this.name); |
22 } | 22 } |
23 | 23 |
24 // TODO(jmesserly): move these somewhere else, e.g. package:js or dart:js | |
25 | |
26 class JsName { | |
27 /// The JavaScript name. | |
28 /// Used for classes and libraries. | |
29 /// Note that this could be an expression, e.g. `lib.TypeName` in JS, but it | |
30 /// should be kept simple, as it will be generated directly into the code. | |
31 final String name; | |
32 const JsName({this.name}); | |
33 } | |
34 | |
35 class JsPeerInterface { | 24 class JsPeerInterface { |
36 /// The JavaScript type that we should match the API of. | 25 /// The JavaScript type that we should match the API of. |
37 /// Used for classes where Dart subclasses should be callable from JavaScript | 26 /// Used for classes where Dart subclasses should be callable from JavaScript |
38 /// matching the JavaScript calling conventions. | 27 /// matching the JavaScript calling conventions. |
39 final String name; | 28 final String name; |
40 const JsPeerInterface({this.name}); | 29 const JsPeerInterface({this.name}); |
41 } | 30 } |
42 | 31 |
43 /// A Dart interface may only be implemented by a native JavaScript object | 32 /// A Dart interface may only be implemented by a native JavaScript object |
44 /// if it is marked with this annotation. | 33 /// if it is marked with this annotation. |
45 class SupportJsExtensionMethods { | 34 class SupportJsExtensionMethods { |
46 const SupportJsExtensionMethods(); | 35 const SupportJsExtensionMethods(); |
47 } | 36 } |
OLD | NEW |