aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-09-29 12:36:16 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-09-29 12:36:16 +0200
commit38d892792c8bff473da859fb7cccaf4849f5d964 (patch)
tree9b003460f33626e0153b04739fbbc2323c0f28d8 /Visitor/Interpreter.php
parent2a5a9abbbff245d8c2aa2135949c46d9ca1f78bf (diff)
downloadPraspel-38d892792c8bff473da859fb7cccaf4849f5d964.zip
Praspel-38d892792c8bff473da859fb7cccaf4849f5d964.tar.gz
Praspel-38d892792c8bff473da859fb7cccaf4849f5d964.tar.bz2
Autobox single var declaration into a disjunction.
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php26
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':