aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--syntax_tree.lua5
-rw-r--r--syntax_tree.moon3
2 files changed, 6 insertions, 2 deletions
diff --git a/syntax_tree.lua b/syntax_tree.lua
index 067018c..70a2daa 100644
--- a/syntax_tree.lua
+++ b/syntax_tree.lua
@@ -254,7 +254,10 @@ do
[patt:as_var()] = self
}
end
- if patt:get_stub() ~= self:get_stub() then
+ if patt.type ~= self.type then
+ return nil
+ end
+ if patt.type == "Action" and patt:get_stub() ~= self:get_stub() then
return nil
end
if #self ~= #patt then
diff --git a/syntax_tree.moon b/syntax_tree.moon
index 31d6924..faf9159 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -134,7 +134,8 @@ class SyntaxTree
matching: (patt)=>
if patt.type == "Var"
return {[patt\as_var!]:@}
- return nil if patt\get_stub! != @get_stub!
+ return nil if patt.type != @type
+ return nil if patt.type == "Action" and patt\get_stub! != @get_stub!
-- TODO: support vararg matches like (\(say 1 2 3), matching \(say *$values))
return nil if #@ != #patt
match = {}