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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_primitives.dart

Issue 1212513002: sdk files reorganization to make dart2js a proper package (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: renamed Created 5 years, 6 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: sdk/lib/_internal/compiler/js_lib/js_primitives.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_primitives.dart b/sdk/lib/_internal/compiler/js_lib/js_primitives.dart
deleted file mode 100644
index 389471dc3ec0c4ff5dc99219d678a8a78aa0ff6a..0000000000000000000000000000000000000000
--- a/sdk/lib/_internal/compiler/js_lib/js_primitives.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// dart2js "primitives", that is, features that cannot be implemented without
-/// access to JavaScript features.
-library dart2js._js_primitives;
-
-import 'dart:_foreign_helper' show
- JS;
-
-/**
- * This is the low-level method that is used to implement [print]. It is
- * possible to override this function from JavaScript by defining a function in
- * JavaScript called "dartPrint".
- *
- * Notice that it is also possible to intercept calls to [print] from within a
- * Dart program using zones. This means that there is no guarantee that a call
- * to print ends in this method.
- */
-void printString(String string) {
- if (JS('bool', r'typeof dartPrint == "function"')) {
- // Support overriding print from JavaScript.
- JS('void', r'dartPrint(#)', string);
- return;
- }
-
- // Inside browser or nodejs.
- if (JS('bool', r'typeof console == "object"') &&
- JS('bool', r'typeof console.log != "undefined"')) {
- JS('void', r'console.log(#)', string);
- return;
- }
-
- // Don't throw inside IE, the console is only defined if dev tools is open.
- if (JS('bool', r'typeof window == "object"')) {
- return;
- }
-
- // Running in d8, the V8 developer shell, or in Firefox' js-shell.
- if (JS('bool', r'typeof print == "function"')) {
- JS('void', r'print(#)', string);
- return;
- }
-
- // This is somewhat nasty, but we don't want to drag in a bunch of
- // dependencies to handle a situation that cannot happen. So we
- // avoid using Dart [:throw:] and Dart [toString].
- JS('void', 'throw "Unable to print message: " + String(#)', string);
-}

Powered by Google App Engine
This is Rietveld 408576698