From decf602f5b8a64381cd90b5dbb6fe067e2618e46 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 29 Jul 2017 10:25:45 -0400 Subject: - Added annotation support to units and models. --- stdlib/source/lux/type/model.lux | 1 + stdlib/source/lux/type/unit.lux | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'stdlib/source') 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)) -- cgit v1.2.3