diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-09-29 12:36:16 +0200 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-09-29 12:36:16 +0200 |
commit | 38d892792c8bff473da859fb7cccaf4849f5d964 (patch) | |
tree | 9b003460f33626e0153b04739fbbc2323c0f28d8 /Visitor | |
parent | 2a5a9abbbff245d8c2aa2135949c46d9ca1f78bf (diff) | |
download | Praspel-38d892792c8bff473da859fb7cccaf4849f5d964.zip Praspel-38d892792c8bff473da859fb7cccaf4849f5d964.tar.gz Praspel-38d892792c8bff473da859fb7cccaf4849f5d964.tar.bz2 |
Autobox single var declaration into a disjunction.
Diffstat (limited to 'Visitor')
-rw-r--r-- | Visitor/Interpreter.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php index 7af6727..fb05dad 100644 --- a/Visitor/Interpreter.php +++ b/Visitor/Interpreter.php @@ -239,17 +239,27 @@ class Interpreter implements \Hoa\Visitor\Visit { break; case '#declaration': - $variable = $element->getChild(0) - ->accept($this, $handle, false); - $this->_clause[$variable]->in = $element->getChild(1) - ->accept($this, $handle, $eldnah); + $left = $element->getChild(0)->accept($this, $handle, false); + $right = $element->getChild(1)->accept($this, $handle, $eldnah); + + $variable = $left; + + if($right instanceof \Hoa\Praspel\Model\Variable) + $right = realdom()->variable($right); + + $this->_clause[$variable]->in = $right; break; case '#local_declaration': - $variable = $element->getChild(0) - ->accept($this, $handle, false); - $this->_clause->let[$variable]->in = $element->getChild(1) - ->accept($this, $handle, $eldnah); + $left = $element->getChild(0)->accept($this, $handle, false); + $right = $element->getChild(1)->accept($this, $handle, $eldnah); + + $variable = $left; + + if($right instanceof \Hoa\Praspel\Model\Variable) + $right = realdom()->variable($right); + + $this->_clause->let[$variable]->in = $right; break; case '#qualification': |