compiler/TNamespaceBinding.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 03:51:15 +0100
changeset 16 17a2d1d9f205
parent 9 569bf5707c7e
permissions -rw-r--r--
Added standalone Tea compiler - teak It allows for compilation of .tea files from the command line.

"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

TBinding subclass:#TNamespaceBinding
	instanceVariableNames:'definition elements'
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Tea-Compiler-Bindings'
!

!TNamespaceBinding class methodsFor:'documentation'!

copyright
"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
! !

!TNamespaceBinding class methodsFor:'instance creation'!

namespace: aTNamespaceDefinition
    ^ self new initializeWithNamespace: aTNamespaceDefinition

    "Created: / 02-09-2015 / 15:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

new
    "return an initialized instance"

    ^ self basicNew initialize.
! !

!TNamespaceBinding methodsFor:'accessing'!

type
    ^ self shouldNotImplement

    "Created: / 14-09-2015 / 14:13:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TNamespaceBinding methodsFor:'initialization'!

initializeWithNamespace: aTNamespaceDefinition
    "Invoked when a new instance is created."

    definition := aTNamespaceDefinition.

    "Created: / 02-09-2015 / 15:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TNamespaceBinding methodsFor:'lookup'!

lookupClassBoolean
    ^ self lookupClassNamed: 'tBoolean'

    "Created: / 14-09-2015 / 14:13:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

lookupClassNamed: name
    | class |

    class := definition classNamed: name.
    class notNil ifTrue:[ 
        ^ class binding
    ].
    self error:('Could not resolve class named %1' bindWith: name)

    "Created: / 02-09-2015 / 11:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 02-09-2015 / 16:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

lookupClassPointer
    ^ self lookupClassNamed: 'tPointer'

    "Created: / 14-09-2015 / 14:14:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

lookupClassSIntegerW
    ^ self lookupClassNamed: 'tSIntegerW'

    "Created: / 14-09-2015 / 14:13:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

lookupClassUIntegerW
    ^ self lookupClassNamed: 'tUIntegerW'

    "Created: / 14-09-2015 / 14:13:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!TNamespaceBinding class methodsFor:'documentation'!

version_HG

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