Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of Concept for exception flow with finally's #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/PHPCfg/Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class Func {
public $params;
/** @var Block|null */
public $cfg;
/** @var Block */
public $stopNormal;
/** @var Block */
public $stopException;

public function __construct($name, $returnsRef, $returnType, $class) {
$this->name = $name;
Expand All @@ -30,6 +34,8 @@ public function __construct($name, $returnsRef, $returnType, $class) {
$this->class = $class;
$this->params = [];
$this->cfg = new Block;
$this->stopNormal = new Block;
$this->stopException = new Block;
}

public function getScopedName() {
Expand Down
18 changes: 18 additions & 0 deletions lib/PHPCfg/Op/Exception/Current.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace PHPCfg\Op\Exception;

use PHPCfg\Op\Expr;
use PHPCfg\Operand;

class Current extends Expr {
public $var;

public function __construct(array $attributes = []) {
parent::__construct($attributes);
}

public function getVariableNames() {
return ['result'];
}
}
16 changes: 16 additions & 0 deletions lib/PHPCfg/Op/Exception/Recover.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace PHPCfg\Op\Exception;

use PHPCfg\Op\Terminal;
use PHPCfg\Operand;

class Recover extends Terminal {
public function __construct(array $attributes = []) {
parent::__construct($attributes);
}

public function getVariableNames() {
return [];
}
}
7 changes: 1 addition & 6 deletions lib/PHPCfg/Op/Terminal/Throw_.php → lib/PHPCfg/Op/Exception/Throw_.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @license MIT See LICENSE at the root of the project for more info
*/

namespace PHPCfg\Op\Terminal;
namespace PHPCfg\Op\Exception;

use PHPCfg\Op\Terminal;
use PHPCfg\Operand;
Expand All @@ -23,9 +23,4 @@ public function __construct(Operand $expr, array $attributes = []) {
public function getVariableNames() {
return ['expr'];
}

public function getSubBlocks() {
return [];
}

}
Loading