Fixes/refactoring of scopes and bindings.
Fixed initialization of scopes and bindings. Make
typechecker to seed types.
"{ Package: 'jv:tea/compiler' }"
"{ NameSpace: Smalltalk }"
TFunctionBinding subclass:#TMethodBinding
instanceVariableNames:'mclass selector'
classVariableNames:''
poolDictionaries:''
category:'Languages-Tea-Compiler-Bindings'
!
!TMethodBinding class methodsFor:'instance creation'!
class: aTClassBinding selector: aSymbol
^ self new initializeWithClass: aTClassBinding selector: aSymbol
"Created: / 31-08-2015 / 12:04:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TMethodBinding methodsFor:'accessing'!
mclass
^ mclass
"Created: / 31-08-2015 / 12:14:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
receiverType
^ mclass type
"Created: / 02-09-2015 / 21:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
selector
^ selector
! !
!TMethodBinding methodsFor:'converting'!
asLLVMValueInModule: aLLVMModule
| name function |
name := TLLVMCodeGenerator llvmFunctionNameForClass: mclass clazz selector: selector.
function := aLLVMModule getFunctionNamed: name.
function isNil ifTrue:[
| type |
mclass isMetaclass ifTrue:[
type := LLVMType
function: (parameterTypes collect:[:t|t asLLVMTypeInModule: aLLVMModule ])
returning: (returnType asLLVMTypeInModule: aLLVMModule).
] ifFalse:[
type := LLVMType
function: {mclass type asLLVMTypeInModule: aLLVMModule } ,
(parameterTypes collect:[:t|t asLLVMTypeInModule: aLLVMModule])
returning: (returnType asLLVMTypeInModule: aLLVMModule).
].
function := aLLVMModule addFunctionNamed: name type: type.
mclass isMetaclass ifFalse:[
(function parameterAt: 1) name: 'self'.
]
].
^ function
"Created: / 15-09-2015 / 07:04:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TMethodBinding methodsFor:'initialization'!
initializeWithClass: aTClassBinding selector: aSymbol
mclass := aTClassBinding.
selector := aSymbol
"Created: / 31-08-2015 / 11:20:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TMethodBinding methodsFor:'testing'!
isMethodBinding
^ true
! !
!TMethodBinding class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !