compiler/TClassDefinition.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 22 Sep 2015 17:43:38 +0100
changeset 14 fa42d3f1a578
parent 7 7556e3d41d80
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'jv:tea/compiler' }"
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
RGClassDefinition subclass:#TClassDefinition
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:'binding'
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'Languages-Tea-Compiler-Model'
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!TClassDefinition methodsFor:'accessing'!
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
binding
7
7556e3d41d80 Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5
diff changeset
    15
    binding isNil ifTrue:[ 
7556e3d41d80 Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5
diff changeset
    16
        binding := TClassBinding clazz: self.
7556e3d41d80 Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5
diff changeset
    17
    ].
4
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
    ^ binding
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
7
7556e3d41d80 Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5
diff changeset
    20
    "Modified: / 02-09-2015 / 16:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
! !
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
!TClassDefinition methodsFor:'behavior'!
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
withMetaclass
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    "Registers explicitly the metaclass of a class"
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
    metaClass:= TMetaDefinition class: self
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
    "Modified: / 31-08-2015 / 11:53:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
! !
3d80069ea3e2 More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
5
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    33
!TClassDefinition methodsFor:'class variables'!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    34
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    35
addClassVarNamed: aString
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    36
    self shouldNotImplement
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    37
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    38
    "Created: / 31-08-2015 / 15:40:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    39
!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    40
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    41
addClassVariables: aCollection
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    42
    self shouldNotImplement
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    43
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    44
    "Created: / 31-08-2015 / 15:38:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    45
! !
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    46
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    47
!TClassDefinition methodsFor:'instance variables'!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    48
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    49
addInstVarNamed: aString
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    50
    self shouldNotImplement
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    51
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    52
    "Created: / 31-08-2015 / 15:40:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    53
!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    54
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    55
addInstanceVariables: aCollection
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    56
    self shouldNotImplement
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    57
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    58
    "Created: / 31-08-2015 / 15:40:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    59
!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    60
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    61
classVariableNames: aStringOrCollection
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    62
    aStringOrCollection isEmptyOrNil ifTrue:[ ^ self ].
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    63
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    64
    self notYetImplemented
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    65
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    66
    "Created: / 31-08-2015 / 15:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    67
!
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    68
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    69
instanceVariableNames: aStringOrCollection
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    70
    aStringOrCollection isEmptyOrNil ifTrue:[ ^ self ].
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    71
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    72
    self notYetImplemented
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    73
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    74
    "Created: / 31-08-2015 / 15:40:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    75
! !
976f21e29d37 Added TSourceReader to allow reading source files. Initial work on T environment...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    76