OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart._foreign_helper; | 5 library dart._foreign_helper; |
6 | 6 |
7 /** | 7 /** |
8 * Emits a JavaScript code fragment parameterized by arguments. | 8 * Emits a JavaScript code fragment parameterized by arguments. |
9 * | 9 * |
10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order | 10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 /// finishIsolateConstructorFunction in emitter.dart. | 120 /// finishIsolateConstructorFunction in emitter.dart. |
121 get isolateStatics; | 121 get isolateStatics; |
122 } | 122 } |
123 | 123 |
124 /** | 124 /** |
125 * Invokes [function] in the context of [isolate]. | 125 * Invokes [function] in the context of [isolate]. |
126 */ | 126 */ |
127 JS_CALL_IN_ISOLATE(isolate, Function function) {} | 127 JS_CALL_IN_ISOLATE(isolate, Function function) {} |
128 | 128 |
129 /** | 129 /** |
130 * Converts the Dart closure [function] into a JavaScript closure. | |
131 * | |
132 * Warning: This is no different from [RAW_DART_FUNCTION_REF] which means care | |
133 * must be taken to store the current isolate. | |
134 */ | |
135 DART_CLOSURE_TO_JS(Function function) {} | |
136 | |
137 /** | |
138 * Returns a raw reference to the JavaScript function which implements | |
139 * [function]. | |
140 * | |
141 * Warning: this is dangerous, you should probably use | |
142 * [DART_CLOSURE_TO_JS] instead. The returned object is not a valid | |
143 * Dart closure, does not store the isolate context or arity. | |
144 * | |
145 * A valid example of where this can be used is as the second argument | |
146 * to V8's Error.captureStackTrace. See | |
147 * https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi. | |
148 */ | |
149 RAW_DART_FUNCTION_REF(Function function) {} | |
150 | |
151 /** | |
152 * Sets the current isolate to [isolate]. | 130 * Sets the current isolate to [isolate]. |
153 */ | 131 */ |
154 void JS_SET_CURRENT_ISOLATE(isolate) {} | 132 void JS_SET_CURRENT_ISOLATE(isolate) {} |
155 | 133 |
156 /** | 134 /** |
157 * Creates an isolate and returns it. | 135 * Creates an isolate and returns it. |
158 */ | 136 */ |
159 JS_CREATE_ISOLATE() {} | 137 JS_CREATE_ISOLATE() {} |
160 | 138 |
161 /** | 139 /** |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 265 } |
288 | 266 |
289 /** | 267 /** |
290 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the | 268 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the |
291 * HStringConcat SSA instruction and may be constant-folded. | 269 * HStringConcat SSA instruction and may be constant-folded. |
292 */ | 270 */ |
293 String JS_STRING_CONCAT(String a, String b) { | 271 String JS_STRING_CONCAT(String a, String b) { |
294 // This body is unused, only here for type analysis. | 272 // This body is unused, only here for type analysis. |
295 return JS('String', '# + #', a, b); | 273 return JS('String', '# + #', a, b); |
296 } | 274 } |
OLD | NEW |