1 "{ Package: 'jv:tea/compiler' }" |
1 "{ Package: 'jv:tea/compiler' }" |
2 |
2 |
3 "{ NameSpace: Smalltalk }" |
3 "{ NameSpace: Smalltalk }" |
4 |
4 |
5 RGMethodDefinition subclass:#TMethodDefinition |
5 RGMethodDefinition subclass:#TMethodDefinition |
6 instanceVariableNames:'node' |
6 instanceVariableNames:'binding parseTree' |
7 classVariableNames:'' |
7 classVariableNames:'' |
8 poolDictionaries:'' |
8 poolDictionaries:'' |
9 category:'Languages-Tea-Compiler-Model' |
9 category:'Languages-Tea-Compiler-Model' |
10 ! |
10 ! |
11 |
11 |
12 |
12 |
13 !TMethodDefinition methodsFor:'accessing'! |
13 !TMethodDefinition methodsFor:'accessing'! |
14 |
14 |
15 binding |
15 binding |
16 ^ self parseTree binding |
16 binding isNil ifTrue:[ |
|
17 | header | |
|
18 header := TParser parseMethodHeader: self source. |
|
19 |
|
20 binding := TMethodBinding class: self parent binding selector: header selector. |
|
21 binding parameterTypes: (header arguments collect:[ :arg | arg typeSpec asType ]). |
|
22 binding returnType: header returnTypeSpec asType. |
|
23 ]. |
|
24 ^ binding |
17 |
25 |
18 "Created: / 31-08-2015 / 10:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
26 "Created: / 31-08-2015 / 10:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
27 "Modified: / 14-09-2015 / 10:57:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
19 ! |
28 ! |
20 |
29 |
21 parseTree |
30 parseTree |
22 node isNil ifTrue:[ |
31 parseTree isNil ifTrue:[ |
23 node := TParser parseMethod: self source |
32 parseTree := TParser parseMethod: self source. |
|
33 parseTree binding: self binding. |
24 ]. |
34 ]. |
25 ^ node |
35 ^ parseTree |
26 |
36 |
27 "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
37 "Created: / 25-08-2015 / 19:43:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
28 "Modified: / 29-08-2015 / 22:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
38 "Modified: / 14-09-2015 / 10:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
29 ! |
39 ! |
30 |
40 |
31 selector |
41 selector |
32 "Retrieves the name of the method" |
42 "Retrieves the name of the method" |
33 |
43 |