author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 20 Sep 2015 12:01:42 +0100 | |
changeset 13 | 97090c2baa33 |
parent 10 | 2b9beeac547e |
child 16 | 17a2d1d9f205 |
permissions | -rw-r--r-- |
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 |
TBinding subclass:#TClassBinding |
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
6 |
instanceVariableNames:'clazz' |
4
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-Bindings' |
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 |
!TClassBinding class methodsFor:'instance creation'! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
13 |
|
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
14 |
clazz: aTClassDefinition |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
15 |
^ self new initializeWithClazz: aTClassDefinition |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
16 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
17 |
"Created: / 02-09-2015 / 15:57:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
18 |
! |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
19 |
|
4
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
20 |
name: aString |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
21 |
^ self new initializeWithName: aString |
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 |
"Created: / 31-08-2015 / 11:21:27 / 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
|
24 |
! ! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
25 |
|
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
26 |
!TClassBinding methodsFor:'accessing'! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
27 |
|
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
28 |
clazz |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
29 |
^ clazz |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
30 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
31 |
"Created: / 02-09-2015 / 15:58:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
32 |
! |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
33 |
|
4
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
34 |
type |
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
35 |
^ TSimpleType named: clazz name |
4
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
36 |
|
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
37 |
"Created: / 31-08-2015 / 11:45:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
38 |
"Modified: / 02-09-2015 / 15:56:43 / 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
|
39 |
! ! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
40 |
|
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
41 |
!TClassBinding methodsFor:'initialization'! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
42 |
|
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
43 |
initializeWithClazz: aTClassDefinition |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
44 |
clazz := aTClassDefinition |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
45 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
46 |
"Created: / 02-09-2015 / 15:58:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
47 |
! ! |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
48 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
49 |
!TClassBinding methodsFor:'lookup'! |
4
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
50 |
|
7
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
51 |
lookupMethodNamed: selector |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
52 |
| method | |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
53 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
54 |
method := clazz methodNamed: selector. |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
55 |
method isNil ifTrue:[ |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
56 |
self error: ('Could not resolve method %1 >> #%2' bindWith: clazz name with: selector) |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
57 |
]. |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
58 |
^ method binding |
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
59 |
|
7556e3d41d80
Make 3 + 4 working, though the code is rather messy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4
diff
changeset
|
60 |
"Created: / 02-09-2015 / 16:06:59 / 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
|
61 |
! ! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
62 |
|
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
63 |
!TClassBinding methodsFor:'testing'! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
64 |
|
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
65 |
isClassBinding |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
66 |
^ true |
10
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
67 |
! |
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
68 |
|
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
69 |
isMetaclass |
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
70 |
^ clazz isMetaclass |
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
71 |
|
2b9beeac547e
More work on environments...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7
diff
changeset
|
72 |
"Created: / 14-09-2015 / 15:34:53 / 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
|
73 |
! ! |
3d80069ea3e2
More work on basic infrastructure - types, bindings & compilation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
74 |