aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2017-07-29 10:25:45 -0400
committerEduardo Julian2017-07-29 10:25:45 -0400
commitdecf602f5b8a64381cd90b5dbb6fe067e2618e46 (patch)
treeba4b1dfc3e38fc4edda7f32235464fcf440258ac
parentc2a0847d2232d5c4e5b996bfeba6fc629f71d3de (diff)
- Added annotation support to units and models.
-rw-r--r--stdlib/source/lux/type/model.lux1
-rw-r--r--stdlib/source/lux/type/unit.lux8
2 files changed, 7 insertions, 2 deletions
diff --git a/stdlib/source/lux/type/model.lux b/stdlib/source/lux/type/model.lux
index 0914cfdf1..c4e9873d3 100644
--- a/stdlib/source/lux/type/model.lux
+++ b/stdlib/source/lux/type/model.lux
@@ -155,6 +155,7 @@
model-declaration (` ((~ (code;local-symbol name)) (~@ type-varsC)))
representation-declaration (` ((~ hidden-name) (~@ type-varsC)))]
(wrap (list& (` (type: (~@ (csw;export export)) (~ model-declaration)
+ (~ (csw;annotations annotations))
(host (~ hidden-name))))
(` (type: (~@ (csw;export export)) (~ representation-declaration)
(~ representation-type)))
diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux
index 14c1edbce..d04951507 100644
--- a/stdlib/source/lux/type/unit.lux
+++ b/stdlib/source/lux/type/unit.lux
@@ -63,8 +63,10 @@
)
(syntax: #export (unit: [export csr;export]
- [name s;local-symbol])
+ [name s;local-symbol]
+ [annotations (p;default cs;empty-annotations csr;annotations)])
(wrap (list (` (type: (~@ (csw;export export)) (~ (code;local-symbol name))
+ (~ (csw;annotations annotations))
(host (~ (code;local-symbol (unit-name name))))))
(` (def: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name)))
(~ (code;local-symbol name))
@@ -84,9 +86,11 @@
(syntax: #export (scale: [export csr;export]
[name s;local-symbol]
- [(^slots [#r;numerator #r;denominator]) ratio^])
+ [(^slots [#r;numerator #r;denominator]) ratio^]
+ [annotations (p;default cs;empty-annotations csr;annotations)])
(let [g!scale (code;local-symbol name)]
(wrap (list (` (type: (~@ (csw;export export)) ((~ g!scale) (~' u))
+ (~ (csw;annotations annotations))
(host (~ (code;local-symbol (scale-name name))) [(~' u)])))
(` (struct: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name)))
(;;Scale (~ g!scale))