Skip to content

Commit 34b3b3b

Browse files
author
Brett Johnson
committed
Attempt to handle this as a single expression
1 parent 80b7907 commit 34b3b3b

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

state-manipulation.scm

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
(else (list '() (evaluate-statement-list->state program state
3939
(cfuncs-update-return cfuncsinstance return)))))))))
4040

41-
;(trace evaluate-parse-tree-with-cfuncs->retval_state)
4241

4342

4443
(define evaluate-statement-list->state
@@ -164,7 +163,7 @@
164163
(cond
165164
((G-initialized? '.this state) (get-value-from-pair (G-value-lookup->value_state '.this state cfuncsinstance)))
166165
(else (get-value-from-pair (G-value-lookup->value_state '.class state cfuncsinstance))))))
167-
166+
(trace get-current-class)
168167
(define get-super-class
169168
(lambda (currentclass state)
170169
(cond
@@ -301,8 +300,8 @@
301300
(define get-valid-this-call-state
302301
(lambda (state)
303302
(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))))
306305

307306
; Determines if the top scope in a state is the stack divider
308307
(define is-top-scope-class-divider?
@@ -517,6 +516,8 @@
517516
(lambda (arglist state cfuncsinstance)
518517
(cond
519518
((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"))
520521
((single-value-list? arglist) (G-value-lookup->value_state (arglist-head arglist) state cfuncsinstance))
521522
((dot-expr? arglist) (evaluate-dotted-expr->value_state (arglist-dot arglist) state cfuncsinstance))
522523
((G-expr? arglist) (G-eval-expr->value_state arglist state cfuncsinstance))
@@ -525,8 +526,18 @@
525526
((is-initialization? arglist) ; arglist = (new classname). Value should be '((classname name) state), state should be original state
526527
(list (get-instance-initialization-value arglist state) state))
527528
(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))))
528535

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)
530541
; STUB
531542
(define dot-expr?
532543
(lambda (arglist)

0 commit comments

Comments
 (0)