mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 09:09:31 +00:00
Replace AttachBlock with more generic PartialScope
This commit is contained in:
parent
9b7d1e436e
commit
404e7dd56e
10 changed files with 124 additions and 70 deletions
|
|
@ -22,6 +22,9 @@ local VariableMetadata = ast.abstract.Runtime {
|
|||
return self.branched:get(state)
|
||||
end
|
||||
end,
|
||||
get_symbol = function(self)
|
||||
return self.symbol
|
||||
end,
|
||||
set = function(self, state, value)
|
||||
if self.symbol.constant then
|
||||
error(("trying to change the value of constant %s"):format(self.symbol.string), 0)
|
||||
|
|
@ -180,6 +183,10 @@ local Environment = ast.abstract.Runtime {
|
|||
get = function(self, state, identifier)
|
||||
return self:_get_variable(state, identifier):get(state)
|
||||
end,
|
||||
-- get the symbol that was used to define the variable in current or parent environment
|
||||
get_symbol = function(self, state, identifier)
|
||||
return self:_get_variable(state, identifier):get_symbol()
|
||||
end,
|
||||
-- set variable value in current or parent environment
|
||||
set = function(self, state, identifier, val)
|
||||
return self:_get_variable(state, identifier):set(state, val)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue