compiler/TMethodDefinition.st
changeset 8 eec72263ed75
parent 5 976f21e29d37
child 16 17a2d1d9f205
equal deleted inserted replaced
7:7556e3d41d80 8:eec72263ed75
     1 "{ Package: 'jv:tea/compiler' }"
     1 "{ Package: 'jv:tea/compiler' }"
     2 
     2 
     3 "{ NameSpace: Smalltalk }"
     3 "{ NameSpace: Smalltalk }"
     4 
     4 
     5 RGMethodDefinition subclass:#TMethodDefinition
     5 RGMethodDefinition subclass:#TMethodDefinition
     6 	instanceVariableNames:'node'
     6 	instanceVariableNames:'binding parseTree'
     7 	classVariableNames:''
     7 	classVariableNames:''
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'Languages-Tea-Compiler-Model'
     9 	category:'Languages-Tea-Compiler-Model'
    10 !
    10 !
    11 
    11 
    12 
    12 
    13 !TMethodDefinition methodsFor:'accessing'!
    13 !TMethodDefinition methodsFor:'accessing'!
    14 
    14 
    15 binding
    15 binding
    16     ^ self parseTree binding
    16     binding isNil ifTrue:[ 
       
    17         | header |
       
    18         header := TParser parseMethodHeader: self source.
       
    19 
       
    20         binding := TMethodBinding class: self parent binding selector: header selector.
       
    21         binding parameterTypes: (header arguments collect:[ :arg | arg typeSpec asType ]).
       
    22         binding returnType: header returnTypeSpec asType.
       
    23     ].
       
    24     ^ binding
    17 
    25 
    18     "Created: / 31-08-2015 / 10:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    26     "Created: / 31-08-2015 / 10:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    27     "Modified: / 14-09-2015 / 10:57:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    19 !
    28 !
    20 
    29 
    21 parseTree
    30 parseTree
    22     node isNil ifTrue:[ 
    31     parseTree isNil ifTrue:[ 
    23         node := TParser parseMethod: self source
    32         parseTree := TParser parseMethod: self source.
       
    33         parseTree binding: self binding.
    24     ].
    34     ].
    25     ^ node
    35     ^ parseTree
    26 
    36 
    27     "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    37     "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    28     "Modified: / 29-08-2015 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    38     "Modified: / 14-09-2015 / 10:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    29 !
    39 !
    30 
    40 
    31 selector
    41 selector
    32     "Retrieves the name of the method"
    42     "Retrieves the name of the method"
    33 
    43 
    40         ].
    50         ].
    41     ].
    51     ].
    42     ^ name
    52     ^ name
    43 
    53 
    44     "Created: / 29-08-2015 / 11:36:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    54     "Created: / 29-08-2015 / 11:36:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    55     "Modified: / 14-09-2015 / 06:23:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    45 ! !
    56 ! !
    46 
    57 
    47 !TMethodDefinition class methodsFor:'documentation'!
    58 !TMethodDefinition class methodsFor:'documentation'!
    48 
    59 
    49 version_HG
    60 version_HG