| Index: tool/input_sdk/private/utils.dart
|
| diff --git a/tool/input_sdk/private/utils.dart b/tool/input_sdk/private/utils.dart
|
| index 0fa80f2bc62630331b28ed75600638141e076453..0921d19e61a9343170faefcea86e4365f7611dc2 100644
|
| --- a/tool/input_sdk/private/utils.dart
|
| +++ b/tool/input_sdk/private/utils.dart
|
| @@ -4,7 +4,7 @@
|
|
|
| library dart._utils;
|
|
|
| -import 'dart:_foreign_helper' show JS;
|
| +import 'dart:_foreign_helper' show JS, JsName;
|
|
|
| /// This library defines a set of general javascript utilities for us
|
| /// by the Dart runtime.
|
| @@ -29,7 +29,7 @@ final StrongModeError = JS('', '''(function() {
|
|
|
| /// This error indicates a strong mode specific failure.
|
| void throwStrongModeError(String message) => JS('', '''(() => {
|
| - throw new StrongModeError($message);
|
| + throw new $StrongModeError($message);
|
| })()''');
|
|
|
| /// This error indicates a bug in the runtime or the compiler.
|
| @@ -37,18 +37,17 @@ void throwInternalError(String message) => JS('', '''(() => {
|
| throw Error($message);
|
| })()''');
|
|
|
| -// TODO(ochafik): Re-introduce a @JS annotation in the SDK (same as package:js)
|
| -// so that this is named 'assert' in JavaScript.
|
| +@JsName('assert')
|
| void assert_(bool condition) => JS('', '''(() => {
|
| - if (!condition) throwInternalError("The compiler is broken: failed assert");
|
| + if (!$condition) $throwInternalError("The compiler is broken: failed assert");
|
| })()''');
|
|
|
| getOwnNamesAndSymbols(obj) => JS('', '''(() => {
|
| - return getOwnPropertyNames(obj).concat(getOwnPropertySymbols(obj));
|
| + return $getOwnPropertyNames($obj).concat($getOwnPropertySymbols($obj));
|
| })()''');
|
|
|
| safeGetOwnProperty(obj, String name) => JS('', '''(() => {
|
| - let desc = getOwnPropertyDescriptor($obj, $name);
|
| + let desc = $getOwnPropertyDescriptor($obj, $name);
|
| if (desc) return desc.value;
|
| })()''');
|
|
|
| @@ -65,7 +64,7 @@ defineLazyProperty(to, name, desc) => JS('', '''(() => {
|
| value = x;
|
| }
|
| function circularInitError() {
|
| - throwInternalError('circular initialization for field ' + $name);
|
| + $throwInternalError('circular initialization for field ' + $name);
|
| }
|
| function lazyGetter() {
|
| if (init == null) return value;
|
| @@ -79,26 +78,26 @@ defineLazyProperty(to, name, desc) => JS('', '''(() => {
|
| $desc.get = lazyGetter;
|
| $desc.configurable = true;
|
| if ($desc.set) $desc.set = lazySetter;
|
| - return defineProperty($to, $name, $desc);
|
| + return $defineProperty($to, $name, $desc);
|
| })()''');
|
|
|
| void defineLazy(to, from) => JS('', '''(() => {
|
| - for (let name of getOwnNamesAndSymbols($from)) {
|
| - defineLazyProperty($to, name, getOwnPropertyDescriptor($from, name));
|
| + for (let name of $getOwnNamesAndSymbols($from)) {
|
| + $defineLazyProperty($to, name, $getOwnPropertyDescriptor($from, name));
|
| }
|
| })()''');
|
|
|
| defineMemoizedGetter(obj, String name, getter) => JS('', '''(() => {
|
| - return defineLazyProperty($obj, $name, {get: $getter});
|
| + return $defineLazyProperty($obj, $name, {get: $getter});
|
| })()''');
|
|
|
| copyTheseProperties(to, from, names) => JS('', '''(() => {
|
| for (let name of $names) {
|
| var desc = $getOwnPropertyDescriptor($from, name);
|
| if (desc != void 0) {
|
| - defineProperty($to, name, desc);
|
| + $defineProperty($to, name, desc);
|
| } else {
|
| - defineLazyProperty($to, name, () => $from[name]);
|
| + $defineLazyProperty($to, name, () => $from[name]);
|
| }
|
| }
|
| return $to;
|
| @@ -107,12 +106,11 @@ copyTheseProperties(to, from, names) => JS('', '''(() => {
|
| /// Copy properties from source to destination object.
|
| /// This operation is commonly called `mixin` in JS.
|
| copyProperties(to, from) => JS('', '''(() => {
|
| - return $copyTheseProperties($to, $from, $getOwnNamesAndSymbols(from));
|
| + return $copyTheseProperties($to, $from, $getOwnNamesAndSymbols($from));
|
| })()''');
|
|
|
| /// Exports from one Dart module to another.
|
| -// TODO(ochafik): Re-introduce a @JS annotation in the SDK (same as package:js)
|
| -// so that this is named 'export' in JavaScript.
|
| +@JsName('export')
|
| export_(to, from, show, hide) => JS('', '''(() => {
|
| if ($show == void 0 || $show.length == 0) {
|
| $show = $getOwnNamesAndSymbols($from);
|
|
|