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

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: simplify diff in js_codegen.dart Created 4 years, 11 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 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 a8314089c3adbe027cf91615759c59e08d966917..7b15a8da094b6c3023adb66652265f26efeec67f 100644
--- a/tool/input_sdk/private/foreign_helper.dart
+++ b/tool/input_sdk/private/foreign_helper.dart
@@ -281,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