summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/seagull.scm27
1 files changed, 11 insertions, 16 deletions
diff --git a/chickadee/graphics/seagull.scm b/chickadee/graphics/seagull.scm
index 5cacdcf..fdd1487 100644
--- a/chickadee/graphics/seagull.scm
+++ b/chickadee/graphics/seagull.scm
@@ -257,10 +257,7 @@
(map (lambda (exp) (expand exp stage env)) exps))
(define (expand:variable exp stage env)
- ;; Replace original variable with alpha-converted name, but keep
- ;; track of the original for showing the user error messages that
- ;; make sense later.
- `(var ,(lookup exp env) ,exp))
+ (lookup exp env))
(define (expand:if predicate consequent alternate stage env)
`(if ,(expand predicate stage env)
@@ -577,8 +574,8 @@
(define (propagate-constants exp env)
(match exp
((? immediate?) exp)
- (('var name _)
- (or (lookup* name env) exp))
+ ((? symbol?)
+ (or (lookup* exp env) exp))
(('if predicate consequent alternate)
(propagate:if predicate consequent alternate env))
(('lambda (params ...) body)
@@ -629,14 +626,14 @@
(match exp
((? immediate?)
#t)
- (('var name original-name)
- (or (memq name bound-vars) ; bound vars: OK
- (memq name top-level-vars) ; top-level vars: OK
+ ((? symbol?)
+ (or (memq exp bound-vars) ; bound vars: OK
+ (memq exp top-level-vars) ; top-level vars: OK
;; Free variables that aren't top-level are not allowed because
;; GLSL doesn't support closures.
(raise-exception
(make-exception
- (make-seagull-scope-error original-name)
+ (make-seagull-scope-error exp)
(make-exception-with-origin check-free-variables)
(make-exception-with-message
"seagull: free variable is not top-level")
@@ -752,7 +749,7 @@
(define (hoist-functions exp)
(match exp
- ((or (? immediate?) ('var _ _))
+ ((or (? immediate?) (? symbol?))
(values exp (empty-env)))
(('if predicate consequent alternate)
(hoist:if predicate consequent alternate))
@@ -1409,10 +1406,8 @@
(append (free-variables-in-type struct)
(free-variables-in-type var)))))
-;; Quantified variables:
-;; - Unused parameters
-;; - Parameters that appear free in the return type
-;; - Parameters that are used in overloaded primcalls
+;; Quantified variables are type variables that appear free in the
+;; function return types or in the predicate.
(define (generalize type pred env)
(if (function-type? type)
(match (difference (delete-duplicates
@@ -1797,7 +1792,7 @@
(match exp
((? immediate?)
(infer:immediate exp))
- ((or (? symbol? name) ('var name _))
+ ((? symbol? name)
(infer:variable name env))
(('if predicate consequent alternate)
(infer:if predicate consequent alternate env))