瀏覽代碼

inspectOn: now sets list of associations

This is breaking for old-style inspectors
assuming a Dictionary in setVariables: send.

OTOH, (1 to: 25000) inspect now takes ~3 seconds, not a minute.
Herby Vojčík 4 年之前
父節點
當前提交
14951912ee
共有 2 個文件被更改,包括 36 次插入25 次删除
  1. 27 15
      src/Helios-Debugger.js
  2. 9 10
      src/Helios-Debugger.st

+ 27 - 15
src/Helios-Debugger.js

@@ -75,11 +75,11 @@ selector: "inspectOn:",
 protocol: "inspecting",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anInspector"],
-source: "inspectOn: anInspector\x0a\x09| variables inspectedContext |\x0a\x09\x0a\x09variables := Dictionary new.\x0a\x09inspectedContext := self context.\x0a\x09\x0a\x09variables addAll: inspectedContext locals.\x0a\x09\x0a\x09[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [\x0a\x09\x09inspectedContext := inspectedContext outerContext.\x0a\x09\x09inspectedContext ifNotNil: [\x0a\x09\x09\x09variables addAll: inspectedContext locals ] ].\x0a\x09\x0a\x09anInspector\x0a\x09\x09setLabel: 'Context';\x0a\x09\x09setVariables: variables",
-referencedClasses: ["Dictionary"],
+source: "inspectOn: anInspector\x0a\x09| variables inspectedContext |\x0a\x0a\x09inspectedContext := self context. console log: 'paso por aqui'.\x0a\x09variables := Array streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: inspectedContext locals associations.\x0a\x09\x09\x0a\x09\x09[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [\x0a\x09\x09\x09inspectedContext := inspectedContext outerContext.\x0a\x09\x09\x09inspectedContext ifNotNil: [\x0a\x09\x09\x09\x09stream nextPutAll: inspectedContext locals associations ] ] ].\x0a\x09\x0a\x09anInspector\x0a\x09\x09setLabel: 'Context';\x0a\x09\x09setVariables: variables",
+referencedClasses: ["Array"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["new", "context", "addAll:", "locals", "whileTrue:", "and:", "notNil", "isBlockContext", "outerContext", "ifNotNil:", "setLabel:", "setVariables:"]
+messageSends: ["context", "log:", "streamContents:", "nextPutAll:", "associations", "locals", "whileTrue:", "and:", "notNil", "isBlockContext", "outerContext", "ifNotNil:", "setLabel:", "setVariables:"]
 }, function ($methodClass){ return function (anInspector){
 var self=this,$self=this;
 var variables,inspectedContext;
@@ -87,46 +87,58 @@ var variables,inspectedContext;
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1;
-variables=$recv($globals.Dictionary)._new();
 inspectedContext=$self._context();
-[$recv(variables)._addAll_([$recv(inspectedContext)._locals()
+$recv(console)._log_("paso por aqui");
+variables=$recv($globals.Array)._streamContents_((function(stream){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx1.sendIdx["locals"]=1
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+[$recv(stream)._nextPutAll_([$recv([$recv(inspectedContext)._locals()
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx2.sendIdx["locals"]=1
+//>>excludeEnd("ctx");
+][0])._associations()
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx2.sendIdx["associations"]=1
 //>>excludeEnd("ctx");
 ][0])
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx1.sendIdx["addAll:"]=1
+,$ctx2.sendIdx["nextPutAll:"]=1
 //>>excludeEnd("ctx");
 ][0];
-$recv((function(){
+return $recv((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
+return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
 return $recv($recv(inspectedContext)._notNil())._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx3) {
+return $core.withContext(function($ctx4) {
 //>>excludeEnd("ctx");
 return $recv(inspectedContext)._isBlockContext();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
 //>>excludeEnd("ctx");
 }));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
 //>>excludeEnd("ctx");
 }))._whileTrue_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
+return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
 inspectedContext=$recv(inspectedContext)._outerContext();
 $1=inspectedContext;
 if($1 == null || $1.a$nil){
 return $1;
 } else {
-return $recv(variables)._addAll_($recv(inspectedContext)._locals());
+return $recv(stream)._nextPutAll_($recv($recv(inspectedContext)._locals())._associations());
 }
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
+//>>excludeEnd("ctx");
+}));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
 //>>excludeEnd("ctx");
 }));
 $recv(anInspector)._setLabel_("Context");

+ 9 - 10
src/Helios-Debugger.st

@@ -26,16 +26,15 @@ initializeFromContext: aContext
 
 inspectOn: anInspector
 	| variables inspectedContext |
-	
-	variables := Dictionary new.
-	inspectedContext := self context.
-	
-	variables addAll: inspectedContext locals.
-	
-	[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [
-		inspectedContext := inspectedContext outerContext.
-		inspectedContext ifNotNil: [
-			variables addAll: inspectedContext locals ] ].
+
+	inspectedContext := self context. console log: 'paso por aqui'.
+	variables := Array streamContents: [ :stream |
+		stream nextPutAll: inspectedContext locals associations.
+		
+		[ inspectedContext notNil and: [ inspectedContext isBlockContext ] ] whileTrue: [
+			inspectedContext := inspectedContext outerContext.
+			inspectedContext ifNotNil: [
+				stream nextPutAll: inspectedContext locals associations ] ] ].
 	
 	anInspector
 		setLabel: 'Context';