OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 service; | 5 part of service; |
6 | 6 |
7 // Some value smaller than the object ring, so requesting a large array | 7 // Some value smaller than the object ring, so requesting a large array |
8 // doesn't result in an expired ref because the elements lapped it in the | 8 // doesn't result in an expired ref because the elements lapped it in the |
9 // object ring. | 9 // object ring. |
10 const int kDefaultFieldLimit = 100; | 10 const int kDefaultFieldLimit = 100; |
(...skipping 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 return isolate._eval(this, expression); | 2756 return isolate._eval(this, expression); |
2757 } | 2757 } |
2758 | 2758 |
2759 String toString() => 'Instance($shortName)'; | 2759 String toString() => 'Instance($shortName)'; |
2760 } | 2760 } |
2761 | 2761 |
2762 | 2762 |
2763 class Context extends HeapObject implements M.Context { | 2763 class Context extends HeapObject implements M.Context { |
2764 @observable Context parentContext; | 2764 @observable Context parentContext; |
2765 @observable int length; | 2765 @observable int length; |
2766 @observable var variables; | 2766 @observable Iterable<ContextElement> variables; |
2767 | 2767 |
2768 Context._empty(ServiceObjectOwner owner) : super._empty(owner); | 2768 Context._empty(ServiceObjectOwner owner) : super._empty(owner); |
2769 | 2769 |
2770 void _update(ObservableMap map, bool mapIsRef) { | 2770 void _update(ObservableMap map, bool mapIsRef) { |
2771 // Extract full properties. | 2771 // Extract full properties. |
2772 _upgradeCollection(map, isolate); | 2772 _upgradeCollection(map, isolate); |
2773 super._update(map, mapIsRef); | 2773 super._update(map, mapIsRef); |
2774 | 2774 |
2775 length = map['length']; | 2775 length = map['length']; |
2776 parentContext = map['parent']; | 2776 parentContext = map['parent']; |
2777 | 2777 |
2778 if (mapIsRef) { | 2778 if (mapIsRef) { |
2779 return; | 2779 return; |
2780 } | 2780 } |
2781 | 2781 |
2782 variables = map['variables']; | 2782 variables = (map['variables'] ?? const []).map((element) => |
| 2783 new ContextElement(element)); |
2783 | 2784 |
2784 // We are fully loaded. | 2785 // We are fully loaded. |
2785 _loaded = true; | 2786 _loaded = true; |
2786 } | 2787 } |
2787 | 2788 |
2788 String toString() => 'Context($length)'; | 2789 String toString() => 'Context($length)'; |
2789 } | 2790 } |
2790 | 2791 |
| 2792 class ContextElement extends M.ContextElement { |
| 2793 final Guarded<Instance> value; |
| 2794 |
| 2795 ContextElement(ServiceMap map) |
| 2796 : value = new Guarded<Instance>(map['value']); |
| 2797 } |
| 2798 |
2791 M.FunctionKind stringToFunctionKind(String value) { | 2799 M.FunctionKind stringToFunctionKind(String value) { |
2792 switch(value) { | 2800 switch(value) { |
2793 case 'RegularFunction': return M.FunctionKind.regular; | 2801 case 'RegularFunction': return M.FunctionKind.regular; |
2794 case 'ClosureFunction': return M.FunctionKind.closure; | 2802 case 'ClosureFunction': return M.FunctionKind.closure; |
2795 case 'GetterFunction': return M.FunctionKind.getter; | 2803 case 'GetterFunction': return M.FunctionKind.getter; |
2796 case 'SetterFunction': return M.FunctionKind.setter; | 2804 case 'SetterFunction': return M.FunctionKind.setter; |
2797 case 'Constructor': return M.FunctionKind.constructor; | 2805 case 'Constructor': return M.FunctionKind.constructor; |
2798 case 'ImplicitGetter': return M.FunctionKind.implicitGetter; | 2806 case 'ImplicitGetter': return M.FunctionKind.implicitGetter; |
2799 case 'ImplicitSetter': return M.FunctionKind.implicitSetter; | 2807 case 'ImplicitSetter': return M.FunctionKind.implicitSetter; |
2800 case 'ImplicitStaticFinalGetter': | 2808 case 'ImplicitStaticFinalGetter': |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4287 var v = list[i]; | 4295 var v = list[i]; |
4288 if ((v is ObservableMap) && _isServiceMap(v)) { | 4296 if ((v is ObservableMap) && _isServiceMap(v)) { |
4289 list[i] = owner.getFromMap(v); | 4297 list[i] = owner.getFromMap(v); |
4290 } else if (v is ObservableList) { | 4298 } else if (v is ObservableList) { |
4291 _upgradeObservableList(v, owner); | 4299 _upgradeObservableList(v, owner); |
4292 } else if (v is ObservableMap) { | 4300 } else if (v is ObservableMap) { |
4293 _upgradeObservableMap(v, owner); | 4301 _upgradeObservableMap(v, owner); |
4294 } | 4302 } |
4295 } | 4303 } |
4296 } | 4304 } |
OLD | NEW |