add compiler error when building invalid descructure

This commit is contained in:
leaf corcoran 2020-11-22 18:22:22 -08:00
parent e2a44b040c
commit 21226eb5e2
2 changed files with 3 additions and 0 deletions

View File

@ -103,6 +103,7 @@ extract_assign_names = function(name, accum, prefix)
end end
local build_assign local build_assign
build_assign = function(scope, destruct_literal, receiver) build_assign = function(scope, destruct_literal, receiver)
assert(receiver, "attempting to build destructure assign with no receiver")
local extracted_names = extract_assign_names(destruct_literal) local extracted_names = extract_assign_names(destruct_literal)
local names = { } local names = { }
local values = { } local values = { }

View File

@ -54,6 +54,8 @@ extract_assign_names = (name, accum={}, prefix={}) ->
accum accum
build_assign = (scope, destruct_literal, receiver) -> build_assign = (scope, destruct_literal, receiver) ->
assert receiver, "attempting to build destructure assign with no receiver"
extracted_names = extract_assign_names destruct_literal extracted_names = extract_assign_names destruct_literal
names = {} names = {}