diff options
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/interp/compiler.boot | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 90e1d753..0adec49c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-05-20 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/compiler.boot (compConstructorCategory): Rewrite. + 2011-05-19 Gabriel Dos Reis <gdr@cs.tamu.edu> * algebra/aggcat.spad.pamphlet (Aggregate) [more?,less?,size?]: diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index b1899ee8..3bfaada1 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -733,14 +733,32 @@ substituteIntoFunctorModemap(argl,modemap is [[dc,:sig],:.],e) == --% SPECIAL EVALUATION FUNCTIONS -compConstructorCategory(x,m,e) == [x,resolve($Category,m),e] - compEnumCat(x,m,e) == for arg in x.args repeat IDENTP arg => nil -- OK stackAndThrow('"all arguments to %1b must be identifiers",[x.op]) [x,resolve($Category,m),e] +compConstructorCategory(x,m,e) == + x is [ctor,:args] => + ctor in '(RecordCategory UnionCategory MappingCategory) => + failed := false + colons := 0 + args' := [] + while not failed for y in args repeat + y is [":",.,t] => + colons := colons + 1 + [t',.,e] := compForMode(t,$EmptyMode,e) or return (failed := true) + args' := [[y.op,second y,t'],:args'] + [t',.,e] := compForMode(y,$EmptyMode,e) or return (failed := true) + args' := [t',:args'] + failed => nil + colons ~= 0 and colons ~= #args and ctor isnt 'MappingCategory => nil + [[ctor,:reverse! args'],resolve($Category,m),e] + ctor is 'EnumerationCategory => compEnumCat(x,m,e) + nil + nil + --% SUBSET CATEGORY compSubsetCategory: (%Form,%Mode,%Env) -> %Maybe %Triple |