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

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

Issue 1424133007: Compile package:js.{rest, spread} helpers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Use freshly released version 0.6.0-beta.6 of package:js ran formatter Created 5 years, 1 month 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
« no previous file with comments | « test/codegen/varargs.dart ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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._js_helper; 5 library dart._js_helper;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'dart:_foreign_helper' show 9 import 'dart:_foreign_helper' show
10 JS, 10 JS,
11 JS_STRING_CONCAT; 11 JS_STRING_CONCAT;
12 12
13 import 'dart:_interceptors'; 13 import 'dart:_interceptors';
14 14
15 part 'annotations.dart'; 15 part 'annotations.dart';
16 part 'native_helper.dart'; 16 part 'native_helper.dart';
17 part 'regexp_helper.dart'; 17 part 'regexp_helper.dart';
18 part 'string_helper.dart'; 18 part 'string_helper.dart';
19 part 'js_rti.dart'; 19 part 'js_rti.dart';
20 20
21 class _Patch { 21 class _Patch {
22 const _Patch(); 22 const _Patch();
23 } 23 }
24 24
25 const _Patch patch = const _Patch(); 25 const _Patch patch = const _Patch();
26 26
27
28 /// Marks the internal map in dart2js, so that internal libraries can is-check 27 /// Marks the internal map in dart2js, so that internal libraries can is-check
29 // them. 28 // them.
30 abstract class InternalMap { 29 abstract class InternalMap {
31 } 30 }
32 31
33 class Primitives { 32 class Primitives {
34 /// Isolate-unique ID for caching [JsClosureMirror.function]. 33 /// Isolate-unique ID for caching [JsClosureMirror.function].
35 /// Note the initial value is used by the first isolate (or if there are no 34 /// Note the initial value is used by the first isolate (or if there are no
36 /// isolates), new isolates will update this value to avoid conflicts by 35 /// isolates), new isolates will update this value to avoid conflicts by
37 /// calling [initializeStatics]. 36 /// calling [initializeStatics].
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 /// Returns the type of [object] as a string (including type arguments). 168 /// Returns the type of [object] as a string (including type arguments).
170 /// 169 ///
171 /// In minified mode, uses the unminified names if available. 170 /// In minified mode, uses the unminified names if available.
172 static String objectTypeName(Object object) { 171 static String objectTypeName(Object object) {
173 return getRuntimeType(object).toString(); 172 return getRuntimeType(object).toString();
174 } 173 }
175 174
176 /// In minified mode, uses the unminified names if available. 175 /// In minified mode, uses the unminified names if available.
177 static String objectToString(Object object) { 176 static String objectToString(Object object) {
178 // String name = objectTypeName(object); 177 // String name = objectTypeName(object);
179 String name = JS('String', 'dart.typeName(dart.realRuntimeType(#))', object) ; 178 String name = JS('String', 'dart.typeName(dart.realRuntimeType(#))', object) ;
180 return "Instance of '$name'"; 179 return "Instance of '$name'";
181 } 180 }
182 181
183 static int dateNow() => JS('int', r'Date.now()'); 182 static int dateNow() => JS('int', r'Date.now()');
184 183
185 static void initTicker() { 184 static void initTicker() {
186 if (timerFrequency != null) return; 185 if (timerFrequency != null) return;
187 // Start with low-resolution. We overwrite the fields if we find better. 186 // Start with low-resolution. We overwrite the fields if we find better.
188 timerFrequency = 1000; 187 timerFrequency = 1000;
189 timerTicks = dateNow; 188 timerTicks = dateNow;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 787
789 SyncIterable(this._generator, this._args); 788 SyncIterable(this._generator, this._args);
790 789
791 // TODO(jmesserly): this should be [Symbol.iterator]() method. Unfortunately 790 // TODO(jmesserly): this should be [Symbol.iterator]() method. Unfortunately
792 // we have no way of telling the compiler yet, so it will generate an extra 791 // we have no way of telling the compiler yet, so it will generate an extra
793 // layer of indirection that wraps the SyncIterator. 792 // layer of indirection that wraps the SyncIterator.
794 _jsIterator() => JS('', '#(...#)', _generator, _args); 793 _jsIterator() => JS('', '#(...#)', _generator, _args);
795 794
796 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator()); 795 Iterator<E> get iterator => new SyncIterator<E>(_jsIterator());
797 } 796 }
OLDNEW
« no previous file with comments | « test/codegen/varargs.dart ('k') | tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698