瀏覽代碼

Doc pane shows traits correctly.

Not as subclass of nil.

Additionally, used traits, if any, are shown as well.
Herby Vojčík 4 年之前
父節點
當前提交
2171c22124
共有 2 個文件被更改,包括 126 次插入30 次删除
  1. 106 23
      src/Helios-Browser.js
  2. 20 7
      src/Helios-Browser.st

+ 106 - 23
src/Helios-Browser.js

@@ -3351,6 +3351,41 @@ return self;
 }; }),
 $globals.HLDocumentationWidget);
 
+$core.addMethod(
+$core.method({
+selector: "renderClassLinkTo:on:",
+protocol: "rendering",
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aClassOrTrait", "html"],
+source: "renderClassLinkTo: aClassOrTrait on: html\x0a\x09html a \x0a\x09\x09with: aClassOrTrait name;\x0a\x09\x09onClick: [ self selectClass: aClassOrTrait ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+pragmas: [],
+messageSends: ["with:", "a", "name", "onClick:", "selectClass:"]
+}, function ($methodClass){ return function (aClassOrTrait,html){
+var self=this,$self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv(html)._a();
+$recv($1)._with_($recv(aClassOrTrait)._name());
+$recv($1)._onClick_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $self._selectClass_(aClassOrTrait);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"renderClassLinkTo:on:",{aClassOrTrait:aClassOrTrait,html:html})});
+//>>excludeEnd("ctx");
+}; }),
+$globals.HLDocumentationWidget);
+
 $core.addMethod(
 $core.method({
 selector: "renderContentOn:",
@@ -3487,70 +3522,118 @@ selector: "renderInheritanceOn:",
 protocol: "rendering",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["html"],
-source: "renderInheritanceOn: html\x0a\x09html div \x09\x0a\x09\x09class: 'inheritance';\x0a\x09\x09with: [\x0a\x09\x09\x09html with: 'Subclass of '.\x0a\x09\x09\x09self selectedItem superclass \x0a\x09\x09\x09\x09ifNil: [ html em with: 'nil' ]\x0a\x09\x09\x09\x09ifNotNil: [\x0a\x09\x09\x09\x09\x09html a \x0a\x09\x09\x09\x09\x09\x09with: self selectedItem superclass name;\x0a\x09\x09\x09\x09\x09\x09onClick: [ self selectClass: self selectedItem superclass ] ] ]",
+source: "renderInheritanceOn: html\x0a\x09html div \x09\x0a\x09\x09class: 'inheritance';\x0a\x09\x09with: [\x0a\x09\x09\x09self selectedItem isBehavior\x0a\x09\x09\x09\x09ifFalse: [ html with: 'Trait' ]\x0a\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09html with: 'Subclass of '.\x0a\x09\x09\x09\x09\x09self selectedItem superclass \x0a\x09\x09\x09\x09\x09\x09ifNil: [ html em with: 'nil' ]\x0a\x09\x09\x09\x09\x09\x09ifNotNil: [ :sclass | self renderClassLinkTo: sclass on: html ] ] ];\x0a\x09\x09with: '. ';\x0a\x09\x09with: [ self selectedItem traitComposition ifNotEmpty: [ :composition |\x0a\x09\x09\x09html with: 'Uses '.\x0a\x09\x09\x09composition\x0a\x09\x09\x09\x09do: [ :each | self renderClassLinkTo: each trait on: html ]\x0a\x09\x09\x09\x09separatedBy: [ html with: ', ' ].\x0a\x09\x09\x09html with: '. ' ] ]\x0a\x09\x09",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["class:", "div", "with:", "ifNil:ifNotNil:", "superclass", "selectedItem", "em", "a", "name", "onClick:", "selectClass:"]
+messageSends: ["class:", "div", "with:", "ifFalse:ifTrue:", "isBehavior", "selectedItem", "ifNil:ifNotNil:", "superclass", "em", "renderClassLinkTo:on:", "ifNotEmpty:", "traitComposition", "do:separatedBy:", "trait"]
 }, function ($methodClass){ return function (html){
 var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3;
+var $1,$2;
 $1=$recv(html)._div();
 $recv($1)._class_("inheritance");
 [$recv($1)._with_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
+if($core.assert($recv([$self._selectedItem()
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx2.sendIdx["selectedItem"]=1
+//>>excludeEnd("ctx");
+][0])._isBehavior())){
 [$recv(html)._with_("Subclass of ")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["with:"]=2
+,$ctx2.sendIdx["with:"]=3
 //>>excludeEnd("ctx");
 ][0];
-$2=[$recv([$self._selectedItem()
+$2=$recv([$self._selectedItem()
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["selectedItem"]=1
+,$ctx2.sendIdx["selectedItem"]=2
 //>>excludeEnd("ctx");
-][0])._superclass()
+][0])._superclass();
+if($2 == null || $2.a$nil){
+return [$recv($recv(html)._em())._with_("nil")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["superclass"]=1
+,$ctx2.sendIdx["with:"]=4
 //>>excludeEnd("ctx");
 ][0];
-if($2 == null || $2.a$nil){
-return [$recv($recv(html)._em())._with_("nil")
+} else {
+var sclass;
+sclass=$2;
+return [$self._renderClassLinkTo_on_(sclass,html)
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["with:"]=3
+,$ctx2.sendIdx["renderClassLinkTo:on:"]=1
 //>>excludeEnd("ctx");
 ][0];
+}
 } else {
-$3=$recv(html)._a();
-$recv($3)._with_($recv([$recv([$self._selectedItem()
+return [$recv(html)._with_("Trait")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["selectedItem"]=2
+,$ctx2.sendIdx["with:"]=2
 //>>excludeEnd("ctx");
-][0])._superclass()
+][0];
+}
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx2.sendIdx["superclass"]=2
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");
-][0])._name());
-return $recv($3)._onClick_((function(){
+}))
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx1.sendIdx["with:"]=1
+//>>excludeEnd("ctx");
+][0];
+[$recv($1)._with_(". ")
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx1.sendIdx["with:"]=5
+//>>excludeEnd("ctx");
+][0];
+[$recv($1)._with_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $recv($recv($self._selectedItem())._traitComposition())._ifNotEmpty_((function(composition){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-return $self._selectClass_($recv($self._selectedItem())._superclass());
+[$recv(html)._with_("Uses ")
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
+,$ctx3.sendIdx["with:"]=7
+//>>excludeEnd("ctx");
+][0];
+$recv(composition)._do_separatedBy_((function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx4) {
+//>>excludeEnd("ctx");
+return $self._renderClassLinkTo_on_($recv(each)._trait(),html);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,8)});
+//>>excludeEnd("ctx");
+}),(function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx4) {
+//>>excludeEnd("ctx");
+return [$recv(html)._with_(", ")
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+,$ctx4.sendIdx["with:"]=8
+//>>excludeEnd("ctx");
+][0];
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx4) {$ctx4.fillBlock({},$ctx3,9)});
 //>>excludeEnd("ctx");
 }));
-}
+return $recv(html)._with_(". ");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+}, function($ctx3) {$ctx3.fillBlock({composition:composition},$ctx2,7)});
+//>>excludeEnd("ctx");
+}));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
 //>>excludeEnd("ctx");
 }))
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-,$ctx1.sendIdx["with:"]=1
+,$ctx1.sendIdx["with:"]=6
 //>>excludeEnd("ctx");
 ][0];
 return self;

+ 20 - 7
src/Helios-Browser.st

@@ -872,6 +872,12 @@ setClassComment: aString
 
 !HLDocumentationWidget methodsFor: 'rendering'!
 
+renderClassLinkTo: aClassOrTrait on: html
+	html a 
+		with: aClassOrTrait name;
+		onClick: [ self selectClass: aClassOrTrait ]
+!
+
 renderContentOn: html
 	html div 
 		class: 'doc';
@@ -906,13 +912,20 @@ renderInheritanceOn: html
 	html div 	
 		class: 'inheritance';
 		with: [
-			html with: 'Subclass of '.
-			self selectedItem superclass 
-				ifNil: [ html em with: 'nil' ]
-				ifNotNil: [
-					html a 
-						with: self selectedItem superclass name;
-						onClick: [ self selectClass: self selectedItem superclass ] ] ]
+			self selectedItem isBehavior
+				ifFalse: [ html with: 'Trait' ]
+				ifTrue: [
+					html with: 'Subclass of '.
+					self selectedItem superclass 
+						ifNil: [ html em with: 'nil' ]
+						ifNotNil: [ :sclass | self renderClassLinkTo: sclass on: html ] ] ];
+		with: '. ';
+		with: [ self selectedItem traitComposition ifNotEmpty: [ :composition |
+			html with: 'Uses '.
+			composition
+				do: [ :each | self renderClassLinkTo: each trait on: html ]
+				separatedBy: [ html with: ', ' ].
+			html with: '. ' ] ]
 ! !
 
 HLToolListWidget subclass: #HLMethodsListWidget