| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
| 9 | 9 |
| 10 import 'dart:_foreign_helper' show JS, JS_CURRENT_ISOLATE; | 10 import 'dart:_foreign_helper' show JS, JS_CURRENT_ISOLATE; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 JsVariableMirror mirror = new JsVariableMirror.from(field, metadata); | 395 JsVariableMirror mirror = new JsVariableMirror.from(field, metadata); |
| 396 if (mirror != null) { | 396 if (mirror != null) { |
| 397 result[mirror.simpleName] = mirror; | 397 result[mirror.simpleName] = mirror; |
| 398 mirror._owner = this; | 398 mirror._owner = this; |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 return result; | 401 return result; |
| 402 } | 402 } |
| 403 | 403 |
| 404 Map<Symbol, Mirror> get members { | 404 Map<Symbol, Mirror> get members { |
| 405 Map<Symbol, Mirror> result = variables; | 405 Map<Symbol, Mirror> result = new Map<Symbol, Mirror>.from(variables); |
| 406 for (JsMethodMirror method in _methods) { | 406 for (JsMethodMirror method in _methods) { |
| 407 if (method.isSetter) { | 407 if (method.isSetter) { |
| 408 String name = n(method.simpleName); | 408 String name = n(method.simpleName); |
| 409 name = name.substring(0, name.length - 1); | 409 name = name.substring(0, name.length - 1); |
| 410 // Filter-out setters corresponding to variables. | 410 // Filter-out setters corresponding to variables. |
| 411 if (result[s(name)] is VariableMirror) continue; | 411 if (result[s(name)] is VariableMirror) continue; |
| 412 } | 412 } |
| 413 // Use putIfAbsent to filter-out getters corresponding to variables. | 413 // Use putIfAbsent to filter-out getters corresponding to variables. |
| 414 result.putIfAbsent(method.simpleName, () => method); | 414 result.putIfAbsent(method.simpleName, () => method); |
| 415 } | 415 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 List extractKeys(victim) { | 699 List extractKeys(victim) { |
| 700 return JS('List', ''' | 700 return JS('List', ''' |
| 701 (function(victim, hasOwnProperty) { | 701 (function(victim, hasOwnProperty) { |
| 702 var result = []; | 702 var result = []; |
| 703 for (var key in victim) { | 703 for (var key in victim) { |
| 704 if (hasOwnProperty.call(victim, key)) result.push(key); | 704 if (hasOwnProperty.call(victim, key)) result.push(key); |
| 705 } | 705 } |
| 706 return result; | 706 return result; |
| 707 })(#, Object.prototype.hasOwnProperty)''', victim); | 707 })(#, Object.prototype.hasOwnProperty)''', victim); |
| 708 } | 708 } |
| OLD | NEW |