SmalltalkLanguage.st
branchjv
changeset 19863 513bd7237fe7
parent 18930 59e70e261e49
parent 19855 4f47086ba17e
child 19899 25b35b705da5
equal deleted inserted replaced
19862:6c010853ea32 19863:513bd7237fe7
    38 
    38 
    39     ^'st'
    39     ^'st'
    40 
    40 
    41     "Modified: / 16-08-2009 / 10:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
    41     "Modified: / 16-08-2009 / 10:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
    42 ! !
    42 ! !
    43 
       
    44 
    43 
    45 !SmalltalkLanguage methodsFor:'accessing-classes'!
    44 !SmalltalkLanguage methodsFor:'accessing-classes'!
    46 
    45 
    47 codeGeneratorClass
    46 codeGeneratorClass
    48     "Answers a class that can generate code"
    47     "Answers a class that can generate code"
   164 methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
   163 methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
   165     "given a selector, return a prototype definition string"
   164     "given a selector, return a prototype definition string"
   166 
   165 
   167     aSelector numArgs > 0 ifTrue:[
   166     aSelector numArgs > 0 ifTrue:[
   168         aSelector isKeyword ifTrue:[
   167         aSelector isKeyword ifTrue:[
   169             ^ String streamContents:[:stream |
   168             ^ Text streamContents:[:stream |
   170                 aSelector keywords with:argNames do:[:eachKeyword :eachArgName|
   169                 aSelector keywords with:argNames do:[:eachKeyword :eachArgName|
   171                     stream nextPutAll:eachKeyword; nextPutAll:eachArgName; space.
   170                     stream bold; nextPutAll:eachKeyword; normal; nextPutAll:eachArgName; space.
   172                 ].
   171                 ].
   173                 stream backStep.   "remove the last space"
   172                 stream backStep.   "remove the last space"
   174              ].
   173              ].
   175         ].
   174         ].
   176         ^ aSelector , ' ' , (argNames at:1)
   175         ^ aSelector allBold , ' ' , (argNames at:1)
   177     ].
   176     ].
   178     ^ aSelector
   177     ^ aSelector allBold
   179 
   178 
   180     "
   179     "
   181      SmalltalkLanguage instance 
   180      SmalltalkLanguage instance 
   182         methodDefinitionTemplateForSelector:#foo andArgumentNames:#()
   181         methodDefinitionTemplateForSelector:#foo andArgumentNames:#()
   183      SmalltalkLanguage instance
   182      SmalltalkLanguage instance