aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-23 15:54:50 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-23 15:54:50 +0200
commit73afcad19993e283d0945a3d5be25b8250ef4898 (patch)
tree6ee36925fd7eb12b3e2858ce70003c66bce6dc15 /Visitor
parent057439b846af197af8f15e19c4b7adac8bf589ef (diff)
downloadPraspel-73afcad19993e283d0945a3d5be25b8250ef4898.zip
Praspel-73afcad19993e283d0945a3d5be25b8250ef4898.tar.gz
Praspel-73afcad19993e283d0945a3d5be25b8250ef4898.tar.bz2
New @throwable clause API.
Diffstat (limited to 'Visitor')
-rw-r--r--Visitor/Compiler.php5
-rw-r--r--Visitor/Interpreter.php17
2 files changed, 17 insertions, 5 deletions
diff --git a/Visitor/Compiler.php b/Visitor/Compiler.php
index 852bd1f..246b34a 100644
--- a/Visitor/Compiler.php
+++ b/Visitor/Compiler.php
@@ -154,8 +154,9 @@ class Compiler implements \Hoa\Visitor\Visit {
$variable . ' = ' . $parent .
'->getClause(\'throwable\');' . "\n";
- foreach($element->getExceptions() as $class)
- $out .= $variable . '->exception(\'' . $class . '\');' . "\n";
+ foreach($element->getExceptions() as $identifier => $class)
+ $out .= $variable . '[\'' . $identifier . '\'] = \'' . $class .
+ '\';' . "\n";
}
elseif($element instanceof \Hoa\Praspel\Model\Behavior) {
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index ccbca14..37be4da 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -173,10 +173,21 @@ class Interpreter implements \Hoa\Visitor\Visit {
break;
case '#exception_list':
- foreach($element->getChildren() as $child)
- $this->_clause->exception(
- $child->accept($this, $handle, false)
+ for($i = 0, $max = $element->getChildrenNumber(); $i < $max; $i += 2) {
+
+ $identifier = $element->getChild($i + 1)->accept(
+ $this,
+ $handle,
+ false
+ );
+ $classname = $element->getChild($i)->accept(
+ $this,
+ $handle,
+ false
);
+
+ $this->_clause[$identifier] = $classname;
+ }
break;
case '#declaration':