| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 class _Property { | 7 class _Property { |
| 8 _Property(this.name) : | 8 _Property(this.name) : |
| 9 _hasValue = false, | 9 _hasValue = false, |
| 10 writable = false, | 10 writable = false, |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return (methodMirror.isGetter || methodMirror.isSetter) && | 515 return (methodMirror.isGetter || methodMirror.isSetter) && |
| 516 (methodMirror.isSynthetic || | 516 (methodMirror.isSynthetic || |
| 517 _isSideEffectFreeGetter(methodMirror,libraryMirror)); | 517 _isSideEffectFreeGetter(methodMirror,libraryMirror)); |
| 518 } | 518 } |
| 519 | 519 |
| 520 // TODO(jacobr): generate more concise function descriptions instead of | 520 // TODO(jacobr): generate more concise function descriptions instead of |
| 521 // dumping the entire function source. | 521 // dumping the entire function source. |
| 522 static String describeFunction(function) { | 522 static String describeFunction(function) { |
| 523 if (function is _Trampoline) return function._methodMirror.source; | 523 if (function is _Trampoline) return function._methodMirror.source; |
| 524 try { | 524 try { |
| 525 return reflect(function).function.source; | 525 var mirror = reflect(function); |
| 526 return mirror.function.source; |
| 526 } catch (e) { | 527 } catch (e) { |
| 527 return function.toString(); | 528 return function.toString(); |
| 528 } | 529 } |
| 529 } | 530 } |
| 530 | 531 |
| 531 static List getInvocationTrampolineDetails(_Trampoline method) { | 532 static List getInvocationTrampolineDetails(_Trampoline method) { |
| 532 var loc = method._methodMirror.location; | 533 var loc = method._methodMirror.location; |
| 533 return [loc.line, loc.column, loc.sourceUri.toString(), | 534 return [loc.line, loc.column, loc.sourceUri.toString(), |
| 534 MirrorSystem.getName(method._selector)]; | 535 MirrorSystem.getName(method._selector)]; |
| 535 } | 536 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 return; | 621 return; |
| 621 } | 622 } |
| 622 var property = properties.putIfAbsent(name, () => new _Property(name)); | 623 var property = properties.putIfAbsent(name, () => new _Property(name)); |
| 623 _fillMethodMirrorProperty(libraryMirror, classMirror, methodMirror, | 624 _fillMethodMirrorProperty(libraryMirror, classMirror, methodMirror, |
| 624 symbol, accessorPropertiesOnly, property); | 625 symbol, accessorPropertiesOnly, property); |
| 625 } | 626 } |
| 626 }); | 627 }); |
| 627 } | 628 } |
| 628 | 629 |
| 629 static void _fillMethodMirrorProperty(LibraryMirror libraryMirror, | 630 static void _fillMethodMirrorProperty(LibraryMirror libraryMirror, |
| 630 Mirror methodOwner, MethodMirror methodMirror, Symbol symbol, | 631 methodOwner, MethodMirror methodMirror, Symbol symbol, |
| 631 bool accessorPropertiesOnly, _Property property) { | 632 bool accessorPropertiesOnly, _Property property) { |
| 632 if (methodMirror.isRegularMethod) { | 633 if (methodMirror.isRegularMethod) { |
| 633 property | 634 property |
| 634 ..value = new _MethodTrampoline(methodOwner, methodMirror, symbol) | 635 ..value = new _MethodTrampoline(methodOwner, methodMirror, symbol) |
| 635 ..isMethod = true; | 636 ..isMethod = true; |
| 636 } else if (methodMirror.isGetter) { | 637 } else if (methodMirror.isGetter) { |
| 637 if (treatPropertyAsField(methodMirror, libraryMirror)) { | 638 if (treatPropertyAsField(methodMirror, libraryMirror)) { |
| 638 try { | 639 try { |
| 639 property.value = methodOwner.getField(symbol).reflectee; | 640 property.value = methodOwner.getField(symbol).reflectee; |
| 640 } catch (e) { | 641 } catch (e) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 666 * shown or hidden. [ownProperties] is not currently used but is part of the | 667 * shown or hidden. [ownProperties] is not currently used but is part of the |
| 667 * Blink devtools API for enumerating properties. | 668 * Blink devtools API for enumerating properties. |
| 668 */ | 669 */ |
| 669 static void _addInstanceMirrors( | 670 static void _addInstanceMirrors( |
| 670 ObjectMirror objectMirror, | 671 ObjectMirror objectMirror, |
| 671 LibraryMirror libraryMirror, | 672 LibraryMirror libraryMirror, |
| 672 Map<Symbol, Mirror> declarations, | 673 Map<Symbol, Mirror> declarations, |
| 673 bool ownProperties, bool accessorPropertiesOnly, | 674 bool ownProperties, bool accessorPropertiesOnly, |
| 674 bool hideFields, bool hideMethods, | 675 bool hideFields, bool hideMethods, |
| 675 Map<String, _Property> properties) { | 676 Map<String, _Property> properties) { |
| 676 declarations.forEach((Symbol symbol, Mirror declaration) { | 677 declarations.forEach((symbol, declaration) { |
| 677 if (declaration is TypedefMirror || declaration is ClassMirror) return; | 678 if (declaration is TypedefMirror || declaration is ClassMirror) return; |
| 678 var name = _getShortSymbolName(symbol, declaration); | 679 var name = _getShortSymbolName(symbol, declaration); |
| 679 if (name.isEmpty) return; | 680 if (name.isEmpty) return; |
| 680 bool isField = declaration is VariableMirror || | 681 bool isField = declaration is VariableMirror || |
| 681 (declaration is MethodMirror && | 682 (declaration is MethodMirror && |
| 682 treatPropertyAsField(declaration, libraryMirror)); | 683 treatPropertyAsField(declaration, libraryMirror)); |
| 683 if ((isField && hideFields) || (hideMethods && !isField)) return; | 684 if ((isField && hideFields) || (hideMethods && !isField)) return; |
| 684 if (accessorPropertiesOnly) { | 685 if (accessorPropertiesOnly) { |
| 685 if (declaration is VariableMirror || declaration.isRegularMethod || | 686 if (declaration is VariableMirror || declaration.isRegularMethod || |
| 686 isField) { | 687 isField) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 _scheduleImmediateHelper._schedule(callback); | 981 _scheduleImmediateHelper._schedule(callback); |
| 981 }; | 982 }; |
| 982 | 983 |
| 983 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 984 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
| 984 throw new UnimplementedError("scheduleMicrotask in background isolates " | 985 throw new UnimplementedError("scheduleMicrotask in background isolates " |
| 985 "are not supported in the browser")); | 986 "are not supported in the browser")); |
| 986 | 987 |
| 987 void _initializeCustomElement(Element e) { | 988 void _initializeCustomElement(Element e) { |
| 988 _Utils.initializeCustomElement(e); | 989 _Utils.initializeCustomElement(e); |
| 989 } | 990 } |
| OLD | NEW |