equal
deleted
inserted
replaced
22 |
22 |
23 "Created: / 20-09-2015 / 07:19:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23 "Created: / 20-09-2015 / 07:19:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
24 ! ! |
24 ! ! |
25 |
25 |
26 !TTypechecker methodsFor:'visitor-double dispatching'! |
26 !TTypechecker methodsFor:'visitor-double dispatching'! |
|
27 |
|
28 acceptBlockNode: aBlockNode |
|
29 | formalType actualType | |
|
30 |
|
31 super acceptBlockNode: aBlockNode. |
|
32 |
|
33 formalType := aBlockNode binding type. |
|
34 actualType := aBlockNode body statements last binding type. |
|
35 formalType isAutomaticType ifTrue:[ |
|
36 aBlockNode binding returnType: actualType. |
|
37 ] ifFalse:[ |
|
38 formalType = actualType ifFalse:[ |
|
39 context reportTypeError: ('Block return type is specified as %1 but actually is %3' bindWith: formalType with: actualType). |
|
40 ]. |
|
41 ]. |
|
42 |
|
43 "Created: / 23-09-2015 / 16:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
44 ! |
27 |
45 |
28 acceptIfTrueIfFalseNode: node |
46 acceptIfTrueIfFalseNode: node |
29 | receiverType booleanType | |
47 | receiverType booleanType | |
30 |
48 |
31 receiverType := node receiver binding type. |
49 receiverType := node receiver binding type. |
92 ]. |
110 ]. |
93 self notYetImplemented |
111 self notYetImplemented |
94 |
112 |
95 "Created: / 02-09-2015 / 10:34:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
113 "Created: / 02-09-2015 / 10:34:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
96 "Modified: / 14-09-2015 / 14:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
114 "Modified: / 14-09-2015 / 14:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
115 ! |
|
116 |
|
117 acceptWhileTrueNode: node |
|
118 | receiverType booleanType | |
|
119 |
|
120 (node isCascaded not or: [node isFirstCascaded]) ifTrue: [ |
|
121 self visitNode: node receiver |
|
122 ]. |
|
123 node arguments do: [:each | self visitNode: each]. |
|
124 |
|
125 receiverType := node receiver binding type. |
|
126 booleanType := context environment binding lookupClassBoolean type. |
|
127 |
|
128 receiverType = booleanType ifFalse:[ |
|
129 context reportTypeError: 'receiver of ifTrue:ifFalse: special form must be of type tBoolean (is ' , receiverType printString. |
|
130 ]. |
|
131 |
|
132 "Created: / 23-09-2015 / 14:06:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
133 "Modified: / 23-09-2015 / 16:46:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
97 ! ! |
134 ! ! |
98 |
135 |
99 !TTypechecker class methodsFor:'documentation'! |
136 !TTypechecker class methodsFor:'documentation'! |
100 |
137 |
101 version_HG |
138 version_HG |