compiler/TMethodDefinition.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 31 Aug 2015 13:53:40 +0100
changeset 4 3d80069ea3e2
parent 3 compiler/TMethod.st@97ee341d3e9f
child 5 976f21e29d37
permissions -rw-r--r--
More work on basic infrastructure - types, bindings & compilation. At this point it actually can compile a simple method returning an integer value. However, full of hacks here and there and full of #notYetImplemented.

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

"{ NameSpace: Smalltalk }"

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

!TMethodDefinition methodsFor:'accessing'!

binding
    ^ self parseTree binding

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

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

    "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 29-08-2015 / 22:01:41 / 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>"
! !