aboutsummaryrefslogtreecommitdiffstats
path: root/base.moon
diff options
context:
space:
mode:
Diffstat (limited to 'base.moon')
-rw-r--r--base.moon9
1 files changed, 7 insertions, 2 deletions
diff --git a/base.moon b/base.moon
index acade78..863305d 100644
--- a/base.moon
+++ b/base.moon
@@ -1,9 +1,14 @@
+import is_object from require 'moon'
+
class Const
- new: (@value) =>
+ types = { str: true, num: true, op: true, opdef: true }
+ new: (@type, @value) =>
+ assert types[@type], "invalid Const type: #{@type}"
+
get: => @value
getc: => @value
- __tostring: => "<const: #{@value}>"
+ __tostring: => "<#{@type}: #{@value}>"
class Op
new: (@node) =>