diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-11-11 09:07:10 +0100 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-11-11 09:07:10 +0100 |
commit | bec521d2cfc22274213ac5066d8817a085faa316 (patch) | |
tree | a4d6db99463882b16840039a94e1327ad9f8fe23 /Visitor | |
parent | 6e854e85824bc3af64236912ec0e336d9d6315bc (diff) | |
download | Praspel-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')
-rw-r--r-- | Visitor/Interpreter.php | 23 |
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': |