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 // Patch file for dart:core classes. | 5 // Patch file for dart:core classes. |
6 import "dart:_internal" as _symbol_dev; | 6 import "dart:_internal" as _symbol_dev; |
7 import 'dart:_interceptors'; | 7 import 'dart:_interceptors'; |
8 import 'dart:_js_helper' show patch, | 8 import 'dart:_js_helper' show patch, |
9 checkInt, | 9 checkInt, |
10 getRuntimeType, | 10 getRuntimeType, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static Map<String, dynamic> _toMangledNames( | 59 static Map<String, dynamic> _toMangledNames( |
60 Map<Symbol, dynamic> namedArguments) { | 60 Map<Symbol, dynamic> namedArguments) { |
61 Map<String, dynamic> result = {}; | 61 Map<String, dynamic> result = {}; |
62 namedArguments.forEach((symbol, value) { | 62 namedArguments.forEach((symbol, value) { |
63 result[_symbolToString(symbol)] = value; | 63 result[_symbolToString(symbol)] = value; |
64 }); | 64 }); |
65 return result; | 65 return result; |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
| 69 // TODO(jmesserly): switch to WeakMap |
69 // Patch for Expando implementation. | 70 // Patch for Expando implementation. |
70 @patch | 71 @patch |
71 class Expando<T> { | 72 class Expando<T> { |
72 @patch | 73 @patch |
73 Expando([String name]) : this.name = name; | 74 Expando([String name]) : this.name = name; |
74 | 75 |
75 @patch | 76 @patch |
76 T operator[](Object object) { | 77 T operator[](Object object) { |
77 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME); | 78 var values = Primitives.getProperty(object, _EXPANDO_PROPERTY_NAME); |
78 return (values == null) ? null : Primitives.getProperty(values, _getKey()); | 79 return (values == null) ? null : Primitives.getProperty(values, _getKey()); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 @patch | 445 @patch |
445 static bool get _isWindows => false; | 446 static bool get _isWindows => false; |
446 | 447 |
447 @patch | 448 @patch |
448 static Uri get base { | 449 static Uri get base { |
449 String uri = Primitives.currentUri(); | 450 String uri = Primitives.currentUri(); |
450 if (uri != null) return Uri.parse(uri); | 451 if (uri != null) return Uri.parse(uri); |
451 throw new UnsupportedError("'Uri.base' is not supported"); | 452 throw new UnsupportedError("'Uri.base' is not supported"); |
452 } | 453 } |
453 } | 454 } |
OLD | NEW |