fix failure to handle otherwise blocks with multiple expressions
This commit is contained in:
@@ -273,10 +273,11 @@ class SpecialForms {
|
||||
// Therefore only one case is required in a case statement, because one case could be enough
|
||||
// to cover all patterns.
|
||||
wholeExp.checkNumArgs(2, null, '(case [expression] [cases...] [optional: (otherwise [default])])');
|
||||
var b = wholeExp.expBuilder();
|
||||
var defaultExpr = switch (args[-1].def) {
|
||||
case CallExp({pos: _, def: Symbol("otherwise")}, [otherwiseExp]):
|
||||
case CallExp({pos: _, def: Symbol("otherwise")}, otherwiseExps):
|
||||
args.pop();
|
||||
k.convert(otherwiseExp);
|
||||
k.convert(b.begin(otherwiseExps));
|
||||
default:
|
||||
null;
|
||||
};
|
||||
|
@@ -378,7 +378,12 @@
|
||||
((Some (as inner (Some v)))
|
||||
(Assert.equals 5 v)
|
||||
(Assert.isTrue (Type.enumEq (Some 5) inner)))
|
||||
(otherwise (Assert.fail))))
|
||||
(otherwise (Assert.fail)))
|
||||
|
||||
// Otherwise blocks should allow multiple expressions, too:
|
||||
(case 5
|
||||
(otherwise
|
||||
6 5)))
|
||||
|
||||
(function _testMaps []
|
||||
(localVar :Map<String,String> myMap [=>"hey" "you"
|
||||
|
Reference in New Issue
Block a user