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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tool/input_sdk/private/foreign_helper.dart
diff --git a/tool/input_sdk/private/foreign_helper.dart b/tool/input_sdk/private/foreign_helper.dart
index 468e640bcc465022f9e8fb907c5cf75c78cca4b2..4595d16081a936aa60009600866a2c6963ac7217 100644
--- a/tool/input_sdk/private/foreign_helper.dart
+++ b/tool/input_sdk/private/foreign_helper.dart
@@ -110,6 +110,15 @@ JS(String typeDescription, String codeTemplate,
[arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11])
{}
+/// Annotates the compiled Js name for fields and methods.
+/// Similar behaviour to `JS` from `package:js/js.dart` (but usable from runtime
+/// files), and not to be confused with `JSName` from `js_helper` (which deals
+/// with names of externs).
+class JsName {
+ final String name;
+ const JsName(this.name);
+}
+
/**
* Returns the isolate in which this code is running.
*/
@@ -272,3 +281,28 @@ String JS_STRING_CONCAT(String a, String b) {
// This body is unused, only here for type analysis.
return JS('String', '# + #', a, b);
}
+
+/// Same `@rest` annotation and `spread` function as in
+/// `package:js/src/varargs.dart`.
+///
+/// Runtime files cannot import packages, which is why we have an ad-hoc copy.
+
+class _Rest {
+ const _Rest();
+}
+
+const _Rest rest = const _Rest();
+
+dynamic spread(args) {
+ throw new StateError(
+ 'The spread function cannot be called, '
+ 'it should be compiled away.');
+}
+
+/// This is a compiler intrinsic that gets expanded to the provided type's
+/// generic constructor (`genericTypeConstructor(Foo)` gives `foolib.Foo$`).
+genericTypeConstructor(type) {
+ throw new StateError(
+ 'This function cannot be called, '
+ 'it should be compiled away.');
+}

Powered by Google App Engine
This is Rietveld 408576698