| OLD | NEW |
| 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_mirrors; | 5 library dart._js_mirrors; |
| 6 | 6 |
| 7 import 'dart:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
| 8 JsGetName, | 8 JsGetName, |
| 9 ALL_CLASSES, | 9 ALL_CLASSES, |
| 10 LAZIES, | 10 LAZIES, |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 | 2227 |
| 2228 MethodMirror get function { | 2228 MethodMirror get function { |
| 2229 String cacheName = Primitives.mirrorFunctionCacheName; | 2229 String cacheName = Primitives.mirrorFunctionCacheName; |
| 2230 JsMethodMirror cachedFunction; | 2230 JsMethodMirror cachedFunction; |
| 2231 // TODO(ahe): Restore caching. | 2231 // TODO(ahe): Restore caching. |
| 2232 //= JS('JsMethodMirror|Null', r'#.constructor[#]', reflectee, cacheName); | 2232 //= JS('JsMethodMirror|Null', r'#.constructor[#]', reflectee, cacheName); |
| 2233 if (cachedFunction != null) return cachedFunction; | 2233 if (cachedFunction != null) return cachedFunction; |
| 2234 disableTreeShaking(); | 2234 disableTreeShaking(); |
| 2235 // TODO(ahe): What about optional parameters (named or not). | 2235 // TODO(ahe): What about optional parameters (named or not). |
| 2236 String callPrefix = "${JS_GET_NAME(JsGetName.CALL_PREFIX)}\$"; | 2236 String callPrefix = "${JS_GET_NAME(JsGetName.CALL_PREFIX)}\$"; |
| 2237 // TODO(ahe): Use of for-in. |
| 2237 var extractCallName = JS('', r''' | 2238 var extractCallName = JS('', r''' |
| 2238 function(reflectee) { | 2239 function(reflectee) { |
| 2239 for (var property in reflectee) { | 2240 for (var property in reflectee) { |
| 2240 if (# == property.substring(0, #) && | 2241 if (# == property.substring(0, #) && |
| 2241 property[#] >= '0' && | 2242 property[#] >= '0' && |
| 2242 property[#] <= '9') return property; | 2243 property[#] <= '9') return property; |
| 2243 } | 2244 } |
| 2244 return null; | 2245 return null; |
| 2245 } | 2246 } |
| 2246 ''', callPrefix, callPrefix.length, callPrefix.length, callPrefix.length); | 2247 ''', callPrefix, callPrefix.length, callPrefix.length, callPrefix.length); |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3027 // have a part (following a '.') that starts with '_'. | 3028 // have a part (following a '.') that starts with '_'. |
| 3028 const int UNDERSCORE = 0x5f; | 3029 const int UNDERSCORE = 0x5f; |
| 3029 if (name.isEmpty) return true; | 3030 if (name.isEmpty) return true; |
| 3030 int index = -1; | 3031 int index = -1; |
| 3031 do { | 3032 do { |
| 3032 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; | 3033 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; |
| 3033 index = name.indexOf('.', index + 1); | 3034 index = name.indexOf('.', index + 1); |
| 3034 } while (index >= 0 && index + 1 < name.length); | 3035 } while (index >= 0 && index + 1 < name.length); |
| 3035 return true; | 3036 return true; |
| 3036 } | 3037 } |
| OLD | NEW |