aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-09 18:08:51 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-09 18:08:51 +0200
commitaf13e47350ad298432aef013e590e8ad1292b543 (patch)
tree401b16fba26a54e46fd2f14a8c672e03987d188f /Visitor/Interpreter.php
parentf9b766ceefeb3c996df7e7758ae878b9bf5b22f7 (diff)
downloadPraspel-af13e47350ad298432aef013e590e8ad1292b543.zip
Praspel-af13e47350ad298432aef013e590e8ad1292b543.tar.gz
Praspel-af13e47350ad298432aef013e590e8ad1292b543.tar.bz2
Add local variable with the “let” keyword.
A local variable is a contract variable, it does not represent a data of the program (class attribute or method argument). In Praspel: @requires let size: 1..5 and arr: array([…], size); In PHP $requires = $specification->getClause('requires'); $requires->let['size']->in = realdom()->boundinteger(1, 5); $requires['arr']->in = realdom()->array(…, $requires['size']);
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index c53a1cc..22e66ac 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -185,6 +185,13 @@ class Interpreter implements \Hoa\Visitor\Visit {
->accept($this, $handle, $eldnah);
break;
+ case '#local_declaration':
+ $variable = $element->getChild(0)
+ ->accept($this, $handle, false);
+ $this->_clause->let[$variable]->in = $element->getChild(1)
+ ->accept($this, $handle, $eldnah);
+ break;
+
case '#qualification':
$children = $element->getChildren();
$variable = $this->_clause[array_shift($children)->accept(