|
38 | 38 | (else (list '() (evaluate-statement-list->state program state |
39 | 39 | (cfuncs-update-return cfuncsinstance return))))))))) |
40 | 40 |
|
41 | | -;(trace evaluate-parse-tree-with-cfuncs->retval_state) |
42 | 41 |
|
43 | 42 |
|
44 | 43 | (define evaluate-statement-list->state |
|
164 | 163 | (cond |
165 | 164 | ((G-initialized? '.this state) (get-value-from-pair (G-value-lookup->value_state '.this state cfuncsinstance))) |
166 | 165 | (else (get-value-from-pair (G-value-lookup->value_state '.class state cfuncsinstance)))))) |
167 | | - |
| 166 | +(trace get-current-class) |
168 | 167 | (define get-super-class |
169 | 168 | (lambda (currentclass state) |
170 | 169 | (cond |
|
301 | 300 | (define get-valid-this-call-state |
302 | 301 | (lambda (state) |
303 | 302 | (cond |
304 | | - ((G-state-has-stack-divider? state) (G-pop-to-stack-divider->state state)) |
305 | | - (else state)))) |
| 303 | + ((G-state-has-stack-divider? state) (G-pop-to-stack-divider->state state)) |
| 304 | + (else state)))) |
306 | 305 |
|
307 | 306 | ; Determines if the top scope in a state is the stack divider |
308 | 307 | (define is-top-scope-class-divider? |
|
517 | 516 | (lambda (arglist state cfuncsinstance) |
518 | 517 | (cond |
519 | 518 | ((single-atom? arglist) (G-value-lookup->value_state arglist state cfuncsinstance)) |
| 519 | + ((single-this? arglist) (handle-this-expr state)) |
| 520 | + ((single-super? arglist) (error "Not implemented")) |
520 | 521 | ((single-value-list? arglist) (G-value-lookup->value_state (arglist-head arglist) state cfuncsinstance)) |
521 | 522 | ((dot-expr? arglist) (evaluate-dotted-expr->value_state (arglist-dot arglist) state cfuncsinstance)) |
522 | 523 | ((G-expr? arglist) (G-eval-expr->value_state arglist state cfuncsinstance)) |
|
525 | 526 | ((is-initialization? arglist) ; arglist = (new classname). Value should be '((classname name) state), state should be original state |
526 | 527 | (list (get-instance-initialization-value arglist state) state)) |
527 | 528 | (else (error "not a valid atomic statement" arglist state))))) |
| 529 | +(define single-super? |
| 530 | + (lambda (arglist) |
| 531 | + (equal? arglist '(this)))) |
| 532 | +(define single-this? |
| 533 | + (lambda (arglist) |
| 534 | + (equal? arglist '(this)))) |
528 | 535 |
|
529 | | - |
| 536 | +(define handle-this-expr |
| 537 | + (lambda (state) |
| 538 | + (list (extract-new-class-instance-state state) state))) |
| 539 | +(trace handle-this-expr) |
| 540 | +;(trace G-eval-atomic-statement->value_state) |
530 | 541 | ; STUB |
531 | 542 | (define dot-expr? |
532 | 543 | (lambda (arglist) |
|
0 commit comments