1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 10:07:45 +03:00

Rename mal's Error class to _Error

This commit is contained in:
Poeticode 2017-09-12 00:36:27 -04:00
parent 6e8730c4eb
commit df2cc0c51c
4 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ require_once 'reader.php';
require_once 'printer.php'; require_once 'printer.php';
// Error/Exception functions // Error/Exception functions
function mal_throw($obj) { throw new Error($obj); } function mal_throw($obj) { throw new _Error($obj); }
// String functions // String functions

View File

@ -119,7 +119,7 @@ function MAL_EVAL($ast, $env) {
if ($a2[0]->value === "catch*") { if ($a2[0]->value === "catch*") {
try { try {
return MAL_EVAL($a1, $env); return MAL_EVAL($a1, $env);
} catch (Error $e) { } catch (_Error $e) {
$catch_env = new Env($env, array($a2[1]), $catch_env = new Env($env, array($a2[1]),
array($e->obj)); array($e->obj));
return MAL_EVAL($a2[2], $catch_env); return MAL_EVAL($a2[2], $catch_env);

View File

@ -124,7 +124,7 @@ function MAL_EVAL($ast, $env) {
if ($a2[0]->value === "catch*") { if ($a2[0]->value === "catch*") {
try { try {
return MAL_EVAL($a1, $env); return MAL_EVAL($a1, $env);
} catch (Error $e) { } catch (_Error $e) {
$catch_env = new Env($env, array($a2[1]), $catch_env = new Env($env, array($a2[1]),
array($e->obj)); array($e->obj));
return MAL_EVAL($a2[2], $catch_env); return MAL_EVAL($a2[2], $catch_env);

View File

@ -2,7 +2,7 @@
// Errors/Exceptions // Errors/Exceptions
class Error extends Exception { class _Error extends Exception {
public $obj = null; public $obj = null;
public function __construct($obj) { public function __construct($obj) {
parent::__construct("Mal Error", 0, null); parent::__construct("Mal Error", 0, null);