Skip to content

Commit

Permalink
Fix empty c..r
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKBeck committed May 1, 2018
1 parent b3a371c commit 956dd67
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions state-manipulation.scm
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@
((atom? dotexpr) '.temp)
((list? (dotted-class-instance (arglist-dot dotexpr)))
(cond
((eq? (car (dotted-class-instance (arglist-dot dotexpr))) 'new) '.temp)
((eq? (get-dotted-head (dotted-class-instance (arglist-dot dotexpr))) 'new) '.temp)
(else (find-highest-var (dotted-class-instance (arglist-dot dotexpr))))))
((eq? 'this (dotted-class-instance (arglist-dot dotexpr))) '.temp)
((eq? 'super (dotted-class-instance (arglist-dot dotexpr))) '.temp)
((eq? 'funcall (arglist-head dotexpr)) '.temp)
(else (dotted-class-instance (arglist-dot dotexpr))))))

(define get-dotted-head car)

; Gets the case class a state is in
(define get-base-class
(lambda (state cfuncsinstance)
Expand All @@ -218,12 +220,14 @@
((null? currentclass) default-currentclass)
((declared-in-scope? (get-variable-section-state (get-top-scope state)) '.class)
(cond
((and (eq? (car (get-value-section-state (get-top-scope state))) currentclass)
((and (eq? (get-value-section-top-head (get-value-section-state (get-top-scope state))) currentclass)
(G-initialized? '.class (get-tail-scope state)))
(get-value-from-pair (G-value-lookup->value_state '.class (get-tail-scope state) empty-cfuncs)))
(else (get-super-class currentclass (get-tail-scope state)))))
(else (get-super-class currentclass (get-tail-scope state))))))

(define get-value-section-top-head car)


(define default-currentclass '())

Expand Down Expand Up @@ -523,11 +527,13 @@
; value is a list: e.g. (new A). Prereq: the name of the instance has not been declared in the current stack frame
(define get-instance-initialization-value
(lambda (value state)
(let* ([cn (cadr value)])
(let* ([cn (get-instance-init-value-head value)])
(cond
(else (list (list 'classname cn)
(G-eval-class-closure->state cn state)))))))

(define get-instance-init-value-head cadr)


; Pushes the declaration statement to the state
(define declare-var->state
Expand Down Expand Up @@ -1137,12 +1143,14 @@
((null? desiredclass) (pop-scope-to-function-default fn state))
((declared-in-scope? (get-variable-section-state (get-top-scope state)) '.class)
(cond
((eq? (car (get-value-section-state (get-top-scope state))) desiredclass)
((eq? (get-value-popped-head (get-value-section-state (get-top-scope state))) desiredclass)
(pop-scope-to-function-default fn state))
(else (G-pop-scope-to-function->state fn desiredclass (get-tail-scope state)))))
((declared-in-scope? (get-variable-section-state (get-top-scope state)) fn) state)
(else (G-pop-scope-to-function->state fn desiredclass (get-tail-scope state))))))

(define get-value-popped-head car)

; Pops a scope to a givenfunction
(define pop-scope-to-function-default
(lambda (fn state)
Expand Down

0 comments on commit 956dd67

Please sign in to comment.