Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

drop support for try modifiers from stage 1

  • Loading branch information...
commit 0776e3b71066010ec57e945455c48b6455ec4850 1 parent d3fa0b7
@NotFound authored
Showing with 10 additions and 56 deletions.
  1. +9 −2 winxed.winxed
  2. +1 −54 winxedst1.winxed
View
11 winxed.winxed
@@ -8,6 +8,7 @@ $load "Getopt/Obj.pbc";
$include_const "iglobals.pasm";
$include_const "libpaths.pasm";
+$include_const "except_severity.pasm";
function extname(string filename, string ext)
{
@@ -417,12 +418,18 @@ function driver_main(var argv)
function main [main] (var argv)
{
int r;
- try [handle_types(__WINXED_ERROR__)] {
+ try {
driver_main(argv);
}
catch (e) {
+ int severity = e["severity"];
+ if (severity == EXCEPT_EXIT) {
+ int exit_code = e["exit_code"];
+ exit(exit_code);
+ }
+ int type = e["type"];
var payload = e["payload"];
- if (payload != null)
+ if (type == __WINXED_ERROR__ && payload != null)
cry(payload.filename, ":", payload.line, ": ", payload.message);
else
cry(e["message"]);
View
55 winxedst1.winxed
@@ -7377,66 +7377,18 @@ class ThrowStatement : Statement
// TryStatement
//*********************************************
-class TryModifierList : ModifierList
-{
- var start;
- function TryModifierList(var start, var tk, var owner)
- {
- self.start = start;
- self.ModifierList(tk, owner);
- }
- function emitmodifiers(var e, string reghandler)
- {
- var modiflist = self.getlist();
- for (var modif in modiflist) {
- string modifname = modif.getname();
- int nargs = modif.numargs();
- switch (modifname) {
- case "min_severity":
- case "max_severity":
- if (nargs != 1)
- SyntaxError("Wrong modifier args", self);
- var arg = modif.getarg(0);
- e.say(sformat(INDENT + "%0.'%1'(%2)",
- reghandler, modifname, arg.emit_get(e)));
- break;
- case "handle_types":
- case "handle_types_except":
- string argregs [];
- for (int i = 0; i < nargs; i = i + 1) {
- var arg = modif.getarg(i);
- push(argregs, arg.emit_get(e));
- }
- e.say(sformat(INDENT + "%0.'%1'(%2)",
- reghandler, modifname, join(", ", argregs)));
- break;
- case "allowtailcall":
- break;
- default:
- SyntaxError("Modifier '" + modifname + "' not valid for try", self);
- }
- }
- }
-}
-
class TryStatement : BlockStatement
{
var stry;
- var modifiers;
var exname;
var scatch;
function TryStatement(var start, var tk, var owner)
{
self.BlockStatement(start, owner);
- var t = tk.get();
- if (t.isop("["))
- self.modifiers = new TryModifierList(t, tk, self);
- else
- tk.unget(t);
self.stry = parseStatement(tk, self);
- t = tk.get();
+ var t = tk.get();
if (! t.iskeyword("catch"))
ExpectedOp("catch", t);
t = tk.get();
@@ -7455,8 +7407,6 @@ class TryStatement : BlockStatement
}
function optimize()
{
- if (self.modifiers != null)
- self.modifiers.optimize();
self.stry = self.stry.optimize();
self.scatch = self.scatch.optimize();
return self;
@@ -7479,9 +7429,6 @@ class TryStatement : BlockStatement
:>>
, reghandler, labelhandler));
- if (self.modifiers != null)
- self.modifiers.emitmodifiers(e, reghandler);
-
e.emitarg1("push_eh", reghandler);
e.comment("try: begin");
self.stry.emit(e);
Please sign in to comment.
Something went wrong with that request. Please try again.