expanding the set of simple expressions to include primitive references

This commit is contained in:
Danny Yoo 2012-03-01 17:40:24 -05:00
parent c54583dde4
commit 1cd5e9b7cc
2 changed files with 15 additions and 10 deletions

View File

@ -1243,7 +1243,8 @@
[operand-poss [operand-poss
(simple-operands->opargs (map (lambda: ([op : Expression]) (simple-operands->opargs (map (lambda: ([op : Expression])
(adjust-expression-depth op n n)) (ensure-simple-expression
(adjust-expression-depth op n n)))
(App-operands exp)) (App-operands exp))
operand-knowledge)]) operand-knowledge)])
(end-with-linkage (end-with-linkage
@ -1342,11 +1343,12 @@
(: ensure-simple-expression (Expression -> (U Constant ToplevelRef LocalRef))) (: ensure-simple-expression (Expression -> (U Constant ToplevelRef LocalRef PrimitiveKernelValue)))
(define (ensure-simple-expression e) (define (ensure-simple-expression e)
(if (or (Constant? e) (if (or (Constant? e)
(LocalRef? e) (LocalRef? e)
(ToplevelRef? e)) (ToplevelRef? e)
(PrimitiveKernelValue? e))
e e
(error 'ensure-simple-expression))) (error 'ensure-simple-expression)))
@ -1359,13 +1361,16 @@
(define (simple-expression? e) (define (simple-expression? e)
(or (Constant? e) (or (Constant? e)
(LocalRef? e) (LocalRef? e)
(ToplevelRef? e))) (ToplevelRef? e)
(PrimitiveKernelValue? e)))
(: simple-operands->opargs ((Listof Expression) (Listof CompileTimeEnvironmentEntry) -> (Listof OpArg))) (: simple-operands->opargs ((Listof (U Constant LocalRef ToplevelRef PrimitiveKernelValue))
;; Produces a list of OpArgs if all the operands are particularly simple, and false otherwise. (Listof CompileTimeEnvironmentEntry)
-> (Listof OpArg)))
;; Produces a list of OpArgs if all the operands are particularly simple.
(define (simple-operands->opargs rands knowledge) (define (simple-operands->opargs rands knowledge)
(map (lambda: ([e : Expression] (map (lambda: ([e : (U Constant LocalRef ToplevelRef PrimitiveKernelValue)]
[k : CompileTimeEnvironmentEntry]) [k : CompileTimeEnvironmentEntry])
(cond (cond
[(Constant? e) [(Constant? e)
@ -1380,8 +1385,8 @@
[else [else
(make-EnvPrefixReference (ToplevelRef-depth e) (ToplevelRef-pos e) #f)])] (make-EnvPrefixReference (ToplevelRef-depth e) (ToplevelRef-pos e) #f)])]
[else [(PrimitiveKernelValue? e)
(error 'all-operands-are-constant "Impossible")])) e]))
rands rands
knowledge)) knowledge))

View File

@ -7,4 +7,4 @@
(provide version) (provide version)
(: version String) (: version String)
(define version "1.205") (define version "1.208")