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

Side by Side Diff: tool/input_sdk/private/foreign_helper.dart

Issue 1530563003: Generate all runtime files from dart. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Reverted to new .dart files in input_sdk: please compare them against previous patchset Created 5 years 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) 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 * types, or including effects to allow the compiler to perform more 103 * types, or including effects to allow the compiler to perform more
104 * optimizations around the code. This might be an extension of [JS] or a new 104 * optimizations around the code. This might be an extension of [JS] or a new
105 * function similar to [JS] with additional arguments for the new information. 105 * function similar to [JS] with additional arguments for the new information.
106 */ 106 */
107 // Add additional optional arguments if needed. The method is treated internally 107 // Add additional optional arguments if needed. The method is treated internally
108 // as a variable argument method. 108 // as a variable argument method.
109 JS(String typeDescription, String codeTemplate, 109 JS(String typeDescription, String codeTemplate,
110 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11]) 110 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11])
111 {} 111 {}
112 112
113 /// Annotates the compiled Js name for fields and methods.
114 /// Similar behaviour to `JS` from `package:js/js.dart` (but usable from runtime
115 /// files), and not to be confused with `JSName` from `js_helper` (which deals
116 /// with names of externs).
117 class JsName {
118 final String name;
119 const JsName(this.name);
120 }
121
113 /** 122 /**
114 * Returns the isolate in which this code is running. 123 * Returns the isolate in which this code is running.
115 */ 124 */
116 IsolateContext JS_CURRENT_ISOLATE_CONTEXT() {} 125 IsolateContext JS_CURRENT_ISOLATE_CONTEXT() {}
117 126
118 abstract class IsolateContext { 127 abstract class IsolateContext {
119 /// Holds a (native) JavaScript instance of Isolate, see 128 /// Holds a (native) JavaScript instance of Isolate, see
120 /// finishIsolateConstructorFunction in emitter.dart. 129 /// finishIsolateConstructorFunction in emitter.dart.
121 get isolateStatics; 130 get isolateStatics;
122 } 131 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 274 }
266 275
267 /** 276 /**
268 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the 277 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the
269 * HStringConcat SSA instruction and may be constant-folded. 278 * HStringConcat SSA instruction and may be constant-folded.
270 */ 279 */
271 String JS_STRING_CONCAT(String a, String b) { 280 String JS_STRING_CONCAT(String a, String b) {
272 // This body is unused, only here for type analysis. 281 // This body is unused, only here for type analysis.
273 return JS('String', '# + #', a, b); 282 return JS('String', '# + #', a, b);
274 } 283 }
284
285 /// Same `@rest` annotation and `spread` function as in
286 /// `package:js/src/varargs.dart`.
287 ///
288 /// Runtime files cannot import packages, which is why we have an ad-hoc copy.
289
290 class _Rest {
291 const _Rest();
292 }
293
294 const _Rest rest = const _Rest();
295
296 dynamic spread(args) {
297 throw new StateError(
298 'The spread function cannot be called, '
299 'it should be compiled away.');
300 }
301
302 /// This is a compiler intrinsic that gets expanded to the provided type's
303 /// generic constructor (`genericTypeConstructor(Foo)` gives `foolib.Foo$`).
304 genericTypeConstructor(type) {
305 throw new StateError(
306 'This function cannot be called, '
307 'it should be compiled away.');
308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698