diff options
author | dos-reis <gdr@axiomatics.org> | 2010-12-07 14:35:30 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-12-07 14:35:30 +0000 |
commit | acd73b3b9926403115db4db68361703bff439889 (patch) | |
tree | af05e8face530df9ed235e02cbe2e97f3d6a85ce /src/interp | |
parent | 871ae5f27191cd50a4629143243312da1be7ca94 (diff) | |
download | open-axiom-acd73b3b9926403115db4db68361703bff439889.tar.gz |
* interp/compiler.boot (compThrow): Remove niladic type restriction.
(compCatch): Tidy.
(compTry): Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 73d0e136..ef0250a6 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1152,28 +1152,24 @@ compReturn(["return",x],m,e) == compThrow: (%Form,%Mode,%Env) -> %Maybe %Triple compThrow(["%Throw",x],m,e) == - T := comp(x,$EmptyMode,e) or return nil - -- FIXME: at the moment, throwable expressions must be of type - -- FIXME: instantiated from niladic constructors. - T.mode isnt [c] or not(niladicConstructorFromDB c) => - stackAndThrow('"throw-operand %1b must be of known niladic type",[x]) + T := compOrCroak(x,$EmptyMode,e) -- An exception does not use the normal exit/return route, so -- we don't take into account neither $exitModeStack nor $returnMode. [['%throw,T.mode,T.expr],$NoValueMode,T.env] compCatch: (%Form,%Mode,%Env) -> %Maybe %Triple compCatch([x,s],m,e) == - [x',m',e] := compMakeDeclaration(second x, third x,e) + [.,m',e] := compMakeDeclaration(second x, third x,e) T := compOrCroak(s,m,e) - [['%catch,second x,m',T.expr],T.mode,e] + [['%catch,second x,m',T.expr],T.mode,T.env] compTry: (%Form,%Mode,%Env) -> %Maybe %Triple compTry(['%Try,x,ys,z],m,e) == x' := compOrCroak(x,m,e).expr ys' := [compCatch(y,m,e).expr for y in ys] z' := - z ~= nil => ['%finally,compOrCroak(z,$NoValueMode,e).expr] - nil + z = nil => nil + ['%finally,compOrCroak(z,$NoValueMode,e).expr] [['%try,x',ys',z'],m,e] --% ELT |