OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 _interceptors; | 5 library _interceptors; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:_collection-dev' hide Symbol; | 8 import 'dart:_collection-dev' hide Symbol; |
9 import "dart:_collection-dev" as _symbol_dev show Symbol; | 9 import "dart:_collection-dev" as _symbol_dev show Symbol; |
10 import 'dart:_js_helper' show allMatchesInStringUnchecked, | 10 import 'dart:_js_helper' show |
11 Null, | 11 JSSyntaxRegExp, |
12 JSSyntaxRegExp, | 12 Null, |
13 Primitives, | 13 Primitives, |
14 checkNull, | 14 StringMatch, |
15 checkNum, | 15 allMatchesInStringUnchecked, |
16 checkString, | 16 checkNull, |
17 defineProperty, | 17 checkNum, |
18 getRuntimeType, | 18 checkString, |
19 regExpGetNative, | 19 defineProperty, |
20 stringContainsUnchecked, | 20 firstMatchAfter, |
21 stringLastIndexOfUnchecked, | 21 getRuntimeType, |
22 stringReplaceAllFuncUnchecked, | 22 lookupDispatchRecord, |
23 stringReplaceAllUnchecked, | 23 regExpGetNative, |
24 stringReplaceFirstUnchecked, | 24 runtimeTypeToString, |
25 lookupDispatchRecord, | 25 stringContainsUnchecked, |
26 StringMatch, | 26 stringLastIndexOfUnchecked, |
27 firstMatchAfter; | 27 stringReplaceAllFuncUnchecked, |
| 28 stringReplaceAllUnchecked, |
| 29 stringReplaceFirstUnchecked; |
28 import 'dart:_foreign_helper' show JS, JS_EFFECT; | 30 import 'dart:_foreign_helper' show JS, JS_EFFECT; |
29 | 31 import 'dart:_js_names' show extractKeys, unmangleGlobalNameIfPreservedAnyways; |
30 part 'js_array.dart'; | 32 part 'js_array.dart'; |
31 part 'js_number.dart'; | 33 part 'js_number.dart'; |
32 part 'js_string.dart'; | 34 part 'js_string.dart'; |
| 35 part 'js_types.dart'; |
33 | 36 |
34 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); | 37 String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); |
35 | 38 |
36 _symbolMapToStringMap(Map<Symbol, dynamic> map) { | 39 _symbolMapToStringMap(Map<Symbol, dynamic> map) { |
37 if (map == null) return null; | 40 if (map == null) return null; |
38 var result = new Map<String, dynamic>(); | 41 var result = new Map<String, dynamic>(); |
39 map.forEach((Symbol key, value) { | 42 map.forEach((Symbol key, value) { |
40 result[_symbolToString(key)] = value; | 43 result[_symbolToString(key)] = value; |
41 }); | 44 }); |
42 return result; | 45 return result; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 308 |
306 /** | 309 /** |
307 * The interface implemented by JavaScript objects. These are methods in | 310 * The interface implemented by JavaScript objects. These are methods in |
308 * addition to the regular Dart Object methods like [Object.hashCode]. | 311 * addition to the regular Dart Object methods like [Object.hashCode]. |
309 * | 312 * |
310 * This is the type that should be exported by a JavaScript interop library. | 313 * This is the type that should be exported by a JavaScript interop library. |
311 */ | 314 */ |
312 abstract class JSObject { | 315 abstract class JSObject { |
313 } | 316 } |
314 | 317 |
315 | |
316 /** | 318 /** |
317 * Interceptor base class for JavaScript objects not recognized as some more | 319 * Interceptor base class for JavaScript objects not recognized as some more |
318 * specific native type. | 320 * specific native type. |
319 */ | 321 */ |
320 abstract class JavaScriptObject extends Interceptor implements JSObject { | 322 abstract class JavaScriptObject extends Interceptor implements JSObject { |
321 const JavaScriptObject(); | 323 const JavaScriptObject(); |
322 | 324 |
323 // It would be impolite to stash a property on the object. | 325 // It would be impolite to stash a property on the object. |
324 int get hashCode => 0; | 326 int get hashCode => 0; |
325 | 327 |
326 Type get runtimeType => JSObject; | 328 Type get runtimeType => JSObject; |
327 } | 329 } |
328 | 330 |
329 | |
330 /** | 331 /** |
331 * Interceptor for plain JavaScript objects created as JavaScript object | 332 * Interceptor for plain JavaScript objects created as JavaScript object |
332 * literals or `new Object()`. | 333 * literals or `new Object()`. |
333 */ | 334 */ |
334 class PlainJavaScriptObject extends JavaScriptObject { | 335 class PlainJavaScriptObject extends JavaScriptObject { |
335 const PlainJavaScriptObject(); | 336 const PlainJavaScriptObject(); |
336 } | 337 } |
337 | 338 |
338 | |
339 /** | 339 /** |
340 * Interceptor for unclassified JavaScript objects, typically objects with a | 340 * Interceptor for unclassified JavaScript objects, typically objects with a |
341 * non-trivial prototype chain. | 341 * non-trivial prototype chain. |
342 */ | 342 */ |
343 class UnknownJavaScriptObject extends JavaScriptObject { | 343 class UnknownJavaScriptObject extends JavaScriptObject { |
344 const UnknownJavaScriptObject(); | 344 const UnknownJavaScriptObject(); |
345 } | 345 } |
OLD | NEW |