浏览代码

more cleanup for `asSet` usages

Nicolas Petton 11 年之前
父节点
当前提交
014d04e067
共有 6 个文件被更改,包括 18 次插入17 次删除
  1. 4 4
      js/Helios-Browser.js
  2. 7 6
      js/Helios-Workspace.js
  3. 3 3
      js/Kernel-Infrastructure.js
  4. 2 2
      st/Helios-Browser.st
  5. 1 1
      st/Helios-Workspace.st
  6. 1 1
      st/Kernel-Infrastructure.st

+ 4 - 4
js/Helios-Browser.js

@@ -1859,10 +1859,10 @@ var $2,$1;
 if(($receiver = aPackage) == nil || $receiver == null){
 $1=[];
 } else {
-$1=_st(_st(_st(_st(_st(aPackage)._classes())._collect_((function(each){
+$1=_st(_st(_st(aPackage)._classes())._collect_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._theNonMetaClass();
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})))._asArray())._sort())._sort_((function(a,b){
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})))._sort_((function(a,b){
 return smalltalk.withContext(function($ctx2) {
 $2=_st(a)._name();
 $ctx2.sendIdx["name"]=1;
@@ -1872,8 +1872,8 @@ return _st($2).__lt(_st(b)._name());
 self._items_($1);
 return self}, function($ctx1) {$ctx1.fill(self,"setItemsForPackage:",{aPackage:aPackage},smalltalk.HLClassesListWidget)})},
 args: ["aPackage"],
-source: "setItemsForPackage: aPackage\x0a\x09self items: (aPackage \x0a    \x09ifNil: [ #() ]\x0a  \x09\x09ifNotNil: [ ((aPackage classes \x0a        \x09collect: [ :each | each theNonMetaClass ]) asArray sort) \x0a            \x09sort: [ :a :b | a name < b name ] ]).",
-messageSends: ["items:", "ifNil:ifNotNil:", "sort:", "sort", "asArray", "collect:", "classes", "theNonMetaClass", "<", "name"],
+source: "setItemsForPackage: aPackage\x0a\x09self items: (aPackage \x0a    \x09ifNil: [ #() ]\x0a  \x09\x09ifNotNil: [ (aPackage classes \x0a        \x09collect: [ :each | each theNonMetaClass ]) \x0a            \x09sort: [ :a :b | a name < b name ] ]).",
+messageSends: ["items:", "ifNil:ifNotNil:", "sort:", "collect:", "classes", "theNonMetaClass", "<", "name"],
 referencedClasses: []
 }),
 smalltalk.HLClassesListWidget);

+ 7 - 6
js/Helios-Workspace.js

@@ -988,7 +988,7 @@ var self=this;
 var variables,classNames,pseudoVariables;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $3,$2,$1,$8,$7,$6,$9,$5,$4;
+var $3,$2,$1,$9,$8,$7,$6,$10,$5,$4;
 $3=_st(_st(_st(anEditor)._display())._wrapper())._asJQuery();
 $ctx1.sendIdx["asJQuery"]=1;
 $2=_st($3)._find_("span.cm-variable");
@@ -1003,15 +1003,16 @@ return smalltalk.withContext(function($ctx2) {
 return _st(each)._name();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
 pseudoVariables=_st($Smalltalk())._pseudoVariableNames();
-$8=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
+$9=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
 $ctx1.sendIdx[","]=1;
+$8=_st($9)._asSet();
 $7=_st($8)._asArray();
 $6=_st($7)._sort();
 $5=_st($6)._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
-$9=_st(aToken)._string();
+$10=_st(aToken)._string();
 $ctx2.sendIdx["string"]=1;
-return _st(each)._includesSubString_($9);
+return _st(each)._includesSubString_($10);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
 $4=_st($5)._reject_((function(each){
 return smalltalk.withContext(function($ctx2) {
@@ -1020,8 +1021,8 @@ return _st(each).__eq(_st(aToken)._string());
 return $4;
 }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},smalltalk.HLCodeWidget)})},
 args: ["anEditor", "aToken"],
-source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asArray sort\x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
-messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "name", "pseudoVariableNames", "reject:", "select:", "sort", "asArray", ",", "includesSubString:", "string", "="],
+source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray sort\x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
+messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "name", "pseudoVariableNames", "reject:", "select:", "sort", "asArray", "asSet", ",", "includesSubString:", "string", "="],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.HLCodeWidget);

+ 3 - 3
js/Kernel-Infrastructure.js

@@ -251,12 +251,12 @@ $1;
 } else {
 _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
 };
-$2=_st(_st(protocols)._asArray())._sort();
+$2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},smalltalk.Environment)})},
 args: ["aClass"],
-source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asArray sort",
-messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray"],
+source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort",
+messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"],
 referencedClasses: []
 }),
 smalltalk.Environment);

+ 2 - 2
st/Helios-Browser.st

@@ -488,8 +488,8 @@ toggleShowComment
 setItemsForPackage: aPackage
 	self items: (aPackage 
     	ifNil: [ #() ]
-  		ifNotNil: [ ((aPackage classes 
-        	collect: [ :each | each theNonMetaClass ]) asArray sort) 
+  		ifNotNil: [ (aPackage classes 
+        	collect: [ :each | each theNonMetaClass ]) 
             	sort: [ :a :b | a name < b name ] ]).
 !
 

+ 1 - 1
st/Helios-Workspace.st

@@ -222,7 +222,7 @@ variableHintFor: anEditor token: aToken
 	classNames := Smalltalk classes collect: [ :each | each name ].
 	pseudoVariables := Smalltalk pseudoVariableNames.
 	
-	^ ((variables, classNames, pseudoVariables) asArray sort
+	^ ((variables, classNames, pseudoVariables) asSet asArray sort
 		select: [ :each | each includesSubString: aToken string ])
 		reject: [ :each | each = aToken string ]
 ! !

+ 1 - 1
st/Kernel-Infrastructure.st

@@ -90,7 +90,7 @@ availableProtocolsFor: aClass
 	
 	protocols := aClass protocols.
 	aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].
-	^ protocols asArray sort
+	^ protocols asSet asArray sort
 !
 
 classBuilder