|
191 | 191 | ((atom? dotexpr) '.temp) |
192 | 192 | ((list? (dotted-class-instance (arglist-dot dotexpr))) |
193 | 193 | (cond |
194 | | - ((eq? (car (dotted-class-instance (arglist-dot dotexpr))) 'new) '.temp) |
| 194 | + ((eq? (get-dotted-head (dotted-class-instance (arglist-dot dotexpr))) 'new) '.temp) |
195 | 195 | (else (find-highest-var (dotted-class-instance (arglist-dot dotexpr)))))) |
196 | 196 | ((eq? 'this (dotted-class-instance (arglist-dot dotexpr))) '.temp) |
197 | 197 | ((eq? 'super (dotted-class-instance (arglist-dot dotexpr))) '.temp) |
198 | 198 | ((eq? 'funcall (arglist-head dotexpr)) '.temp) |
199 | 199 | (else (dotted-class-instance (arglist-dot dotexpr)))))) |
200 | 200 |
|
| 201 | +(define get-dotted-head car) |
| 202 | + |
201 | 203 | ; Gets the case class a state is in |
202 | 204 | (define get-base-class |
203 | 205 | (lambda (state cfuncsinstance) |
|
218 | 220 | ((null? currentclass) default-currentclass) |
219 | 221 | ((declared-in-scope? (get-variable-section-state (get-top-scope state)) '.class) |
220 | 222 | (cond |
221 | | - ((and (eq? (car (get-value-section-state (get-top-scope state))) currentclass) |
| 223 | + ((and (eq? (get-value-section-top-head (get-value-section-state (get-top-scope state))) currentclass) |
222 | 224 | (G-initialized? '.class (get-tail-scope state))) |
223 | 225 | (get-value-from-pair (G-value-lookup->value_state '.class (get-tail-scope state) empty-cfuncs))) |
224 | 226 | (else (get-super-class currentclass (get-tail-scope state))))) |
225 | 227 | (else (get-super-class currentclass (get-tail-scope state)))))) |
226 | 228 |
|
| 229 | +(define get-value-section-top-head car) |
| 230 | + |
227 | 231 |
|
228 | 232 | (define default-currentclass '()) |
229 | 233 |
|
|
523 | 527 | ; value is a list: e.g. (new A). Prereq: the name of the instance has not been declared in the current stack frame |
524 | 528 | (define get-instance-initialization-value |
525 | 529 | (lambda (value state) |
526 | | - (let* ([cn (cadr value)]) |
| 530 | + (let* ([cn (get-instance-init-value-head value)]) |
527 | 531 | (cond |
528 | 532 | (else (list (list 'classname cn) |
529 | 533 | (G-eval-class-closure->state cn state))))))) |
530 | 534 |
|
| 535 | +(define get-instance-init-value-head cadr) |
| 536 | + |
531 | 537 |
|
532 | 538 | ; Pushes the declaration statement to the state |
533 | 539 | (define declare-var->state |
|
1137 | 1143 | ((null? desiredclass) (pop-scope-to-function-default fn state)) |
1138 | 1144 | ((declared-in-scope? (get-variable-section-state (get-top-scope state)) '.class) |
1139 | 1145 | (cond |
1140 | | - ((eq? (car (get-value-section-state (get-top-scope state))) desiredclass) |
| 1146 | + ((eq? (get-value-popped-head (get-value-section-state (get-top-scope state))) desiredclass) |
1141 | 1147 | (pop-scope-to-function-default fn state)) |
1142 | 1148 | (else (G-pop-scope-to-function->state fn desiredclass (get-tail-scope state))))) |
1143 | 1149 | ((declared-in-scope? (get-variable-section-state (get-top-scope state)) fn) state) |
1144 | 1150 | (else (G-pop-scope-to-function->state fn desiredclass (get-tail-scope state)))))) |
1145 | 1151 |
|
| 1152 | +(define get-value-popped-head car) |
| 1153 | + |
1146 | 1154 | ; Pops a scope to a givenfunction |
1147 | 1155 | (define pop-scope-to-function-default |
1148 | 1156 | (lambda (fn state) |
|
0 commit comments