aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-11 09:07:10 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-11 09:07:10 +0100
commitbec521d2cfc22274213ac5066d8817a085faa316 (patch)
treea4d6db99463882b16840039a94e1327ad9f8fe23 /Visitor/Interpreter.php
parent6e854e85824bc3af64236912ec0e336d9d6315bc (diff)
downloadPraspel-bec521d2cfc22274213ac5066d8817a085faa316.zip
Praspel-bec521d2cfc22274213ac5066d8817a085faa316.tar.gz
Praspel-bec521d2cfc22274213ac5066d8817a085faa316.tar.bz2
Support dynamic resolutions as external variables.
`this->foo` is considered as a borrowing variable, with the type `TYPE_EXTERNAL`. Verifications use the contract registry and the binded class of specifications.
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index 3f01e3d..bf9a3d9 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -428,9 +428,23 @@ class Interpreter implements \Hoa\Visitor\Visit {
break;
case '#dynamic_resolution':
- $identifier = $element->getChild(0)->accept($this, $handle, $eldnah);
+ if(1 === $element->getChildrenNumber())
+ return $element->getChild(0)->accept($this, $handle, $eldnah);
- return $identifier;
+ $value = null;
+
+ foreach($element->getChildren() as $child) {
+
+ if(null !== $value)
+ $value .= '->';
+
+ $value .= $child->accept($this, $handle, false);
+ }
+
+ if(false !== $eldnah)
+ return $this->_clause->getVariable($value, true);
+
+ return $value;
break;
case '#self_identifier':
@@ -499,7 +513,10 @@ class Interpreter implements \Hoa\Visitor\Visit {
return $value;
case 'this':
- return $this->_root->getImplicitVariable('this');
+ if(false !== $eldnah)
+ return $this->_root->getImplicitVariable($value);
+
+ return $value;
case 'content':
case 'pure':