compiler/TMethodDefinition.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 22 Sep 2015 17:43:38 +0100
changeset 14 fa42d3f1a578
parent 8 eec72263ed75
child 16 17a2d1d9f205
permissions -rw-r--r--
Removed syntax for inline assembly, use <primitive: [:asm | ... ]> syntax. This one is easier to implement and less introusive, syntax-wise. And follows Smalltalk tradiiton.

"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

RGMethodDefinition subclass:#TMethodDefinition
	instanceVariableNames:'binding parseTree'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Tea-Compiler-Model'
!


!TMethodDefinition methodsFor:'accessing'!

binding
    binding isNil ifTrue:[ 
        | header |
        header := TParser parseMethodHeader: self source.

        binding := TMethodBinding class: self parent binding selector: header selector.
        binding parameterTypes: (header arguments collect:[ :arg | arg typeSpec asType ]).
        binding returnType: header returnTypeSpec asType.
    ].
    ^ binding

    "Created: / 31-08-2015 / 10:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 14-09-2015 / 10:57:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

parseTree
    parseTree isNil ifTrue:[ 
        parseTree := TParser parseMethod: self source.
        parseTree binding: self binding.
    ].
    ^ parseTree

    "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 14-09-2015 / 10:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

selector
    "Retrieves the name of the method"

    name isNil ifTrue:[ 
        | src |    

        src := self sourceCode.
        src notNil ifTrue:[ 
            name := TParser parseMethodPattern: src.  
        ].
    ].
    ^ name

    "Created: / 29-08-2015 / 11:36:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 14-09-2015 / 06:23:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TMethodDefinition class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !