@@ -107,7 +107,7 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
107107 ]
108108 } ;
109109 this . _queried_map = { } ;
110- this . _expand_tree = { object_id : 0 , protos : { } } ;
110+ this . _expand_tree = new Dict ( { object_id : 0 , protos : new Dict ( ) } ) ;
111111 this . _rt_id = rt_id ;
112112 this . _obj_id = obj_id ;
113113 this . _identifier = identifier || '' ;
@@ -125,26 +125,32 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
125125
126126 this . _get_subtree = function ( path )
127127 {
128- const PATH_KEY = 0 , PATH_OBJ_ID = 1 , PATH_PROTO_INDEX = 2 ;
129- var key = '' , obj_id = 0 , proto_index = 0 , i = 0 , tree = this . _expand_tree , index = 0 ;
130- for ( ; path && path [ i ] ; i ++ )
128+ var PATH_KEY = 0 ;
129+ var PATH_OBJ_ID = 1 ;
130+ var PATH_PROTO_INDEX = 2 ;
131+ var key = "" ;
132+ var obj_id = 0 ;
133+ var proto_index = 0 ;
134+ var tree = this . _expand_tree ;
135+ var index = 0 ;
136+ for ( var i = 0 ; path && path [ i ] ; i ++ )
131137 {
132138 key = path [ i ] [ PATH_KEY ] ;
133139 obj_id = path [ i ] [ PATH_OBJ_ID ] ;
134140 index = path [ i ] [ PATH_PROTO_INDEX ] ;
135- if ( i < ( path . length - 1 ) && ! ( tree . protos [ index ] && tree . protos [ index ] [ key ] ) )
136- {
137- throw 'not valid path in InspectionBaseData._handle_examine_object' ;
138- }
139- if ( ! tree . protos )
140- tree . protos = { } ;
141- if ( ! tree . protos [ index ] )
142- tree . protos [ index ] = { } ;
141+ if ( i < ( path . length - 1 ) && ! ( tree . get_chain ( [ "protos" , index , key ] ) ) )
142+ throw "not valid path in InspectableJSObject._get_subtree" ;
143+
144+ if ( ! tree . get ( "protos" ) )
145+ tree . set ( "protos" , new Dict ( ) ) ;
146+ var protos = tree . get ( "protos" ) ;
147+ if ( ! protos . get ( index ) )
148+ protos . set ( index , new Dict ( ) ) ;
149+ var proto_index = protos . get ( index ) ;
143150 /* the last element of a prototype path has no object id */
144- if ( ( ! has_own_property . call ( tree . protos [ index ] , key ) && ! isNaN ( obj_id ) ) ||
145- tree . protos [ index ] [ key ] === null )
146- tree . protos [ index ] [ key ] = { object_id : obj_id , protos : { } } ;
147- tree = tree . protos [ index ] [ key ] ;
151+ if ( ! proto_index . get ( key ) && ! isNaN ( obj_id ) )
152+ proto_index . set ( key , new Dict ( { object_id : obj_id , protos : new Dict ( ) } ) ) ;
153+ tree = proto_index . get ( key ) ;
148154 }
149155 return tree ;
150156 }
@@ -153,33 +159,33 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
153159 // returns the removed tree
154160 this . _remove_subtree = function ( path )
155161 {
156- const PATH_KEY = 0 , PATH_OBJ_ID = 1 , PATH_PROTO_INDEX = 2 ;
157- var
158- key = '' ,
159- obj_id = 0 ,
160- proto_index = 0 ,
161- i = 0 ,
162- tree = this . _expand_tree ,
163- ret = null ;
164-
165- for ( ; path && path [ i ] ; i ++ )
162+ var PATH_KEY = 0 ;
163+ var PATH_OBJ_ID = 1 ;
164+ var PATH_PROTO_INDEX = 2 ;
165+ var key = "" ;
166+ var obj_id = 0 ;
167+ var proto_index = 0 ;
168+ var tree = this . _expand_tree ;
169+ var ret = null ;
170+ for ( var i = 0 ; path && path [ i ] ; i ++ )
166171 {
167172 key = path [ i ] [ PATH_KEY ] ;
168173 obj_id = path [ i ] [ PATH_OBJ_ID ] ;
169174 index = path [ i ] [ PATH_PROTO_INDEX ] ;
170- if ( ! ( tree . protos && tree . protos [ index ] && tree . protos [ index ] [ key ] ) )
175+ var sub_tree = tree . get_chain ( [ "protos" , index , key ] ) ;
176+ if ( ! sub_tree )
171177 {
172178 // with watches it can happen that we try to collapse
173179 // a path which was never expanded.
174180 return ret ;
175181 }
176182 if ( i == path . length - 1 )
177183 {
178- ret = tree . protos [ index ] [ key ] ;
179- tree . protos [ index ] [ key ] = null ;
184+ ret = sub_tree ;
185+ tree . get_chain ( [ "protos" , index ] ) . delete ( key ) ;
180186 break ;
181187 }
182- tree = tree . protos [ index ] [ key ] ;
188+ tree = sub_tree ;
183189 }
184190 return ret ;
185191 }
@@ -285,7 +291,7 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
285291 }
286292
287293 }
288- this . _obj_map [ this . _get_subtree ( path ) . object_id ] = proto_chain ;
294+ this . _obj_map [ this . _get_subtree ( path ) . get ( " object_id" ) ] = proto_chain ;
289295 if ( cb )
290296 cb ( ) ;
291297 }
@@ -320,22 +326,21 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
320326 this . _get_all_ids = function get_all_ids ( tree , ret )
321327 {
322328 ret || ( ret = [ ] ) ;
323- if ( tree )
329+ if ( tree && tree . get ( "object_id" ) )
324330 {
325- ret . push ( tree . object_id ) ;
326- for ( var index in tree . protos )
331+ ret . push ( tree . get ( "object_id" ) ) ;
332+ var protos = tree . get ( "protos" ) ;
333+ protos . keys ( ) . forEach ( function ( index )
327334 {
328- for ( var key in tree . protos [ index ] )
335+ var proto = protos . get ( index ) ;
336+ proto . keys ( ) . forEach ( function ( key )
329337 {
330- if ( tree . protos [ index ] [ key ] )
331- {
332- get_all_ids ( tree . protos [ index ] [ key ] , ret ) ;
333- }
334- }
335- }
338+ get_all_ids ( proto . get ( key ) , ret ) ;
339+ } ) ;
340+ } ) ;
336341 }
337342 return ret ;
338- }
343+ } ;
339344
340345 this . _get_id = ( function ( )
341346 {
@@ -436,8 +441,8 @@ cls.EcmascriptDebugger["6.0"].InspectableJSObject.prototype = new function()
436441 path = this . _norm_path ( path ) . slice ( 0 ) ;
437442 var index = path . pop ( ) [ PATH_PROTO_INDEX ] ;
438443 var top = this . _get_subtree ( path ) ;
439- var removed = top . protos [ index ] ;
440- top . protos [ index ] = null ;
444+ var removed = top . get ( [ "protos" , index ] ) ;
445+ top . get ( " protos" ) . delete ( index ) ;
441446 this . _cleanup_maps ( removed ) ;
442447 } ;
443448
0 commit comments