aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/synthesizer/function.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/synthesizer/function.lux')
-rw-r--r--new-luxc/source/luxc/synthesizer/function.lux23
1 files changed, 14 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/synthesizer/function.lux b/new-luxc/source/luxc/synthesizer/function.lux
index be6a74da0..42aa7a6cd 100644
--- a/new-luxc/source/luxc/synthesizer/function.lux
+++ b/new-luxc/source/luxc/synthesizer/function.lux
@@ -22,18 +22,23 @@
(-> ls;Variable Bool)
(<comp> 0 var))]
- [function-var? i.=]
- [local-var? i.>]
- [captured-var? i.<]
+ [self? i.=]
+ [local? i.>]
+ [captured? i.<]
)
-(def: #export (nested-function? scope-args)
- (-> Nat Bool)
- (n.> +1 scope-args))
+(do-template [<name> <comp> <ref>]
+ [(def: #export (<name> arity)
+ (-> ls;Arity Bool)
+ (<comp> <ref> arity))]
-(def: #export (adjust-var scope-args var)
- (-> Nat ls;Variable ls;Variable)
- (|> scope-args n.dec nat-to-int (i.+ var)))
+ [nested? n.> +1]
+ [top? n.= +0]
+ )
+
+(def: #export (adjust-var outer var)
+ (-> ls;Arity ls;Variable ls;Variable)
+ (|> outer n.dec nat-to-int (i.+ var)))
(def: #export (to-captured idx)
(-> Nat Int)