Browse Source

fix typo and add test case for data type defs

pull/16/head
nisstyre56 10 years ago
parent
commit
71640b2c48
  1. 3
      example.jl
  2. 5
      parse.js

3
example.jl

@ -3,6 +3,9 @@ defop 2 Left (a ++ b)
deftype Foo (A -> B)
deftype (Foo a b)
(a -> b)
(qat :: A -> b)
def tdeftype (lambda a b c -> (a + b))

5
parse.js

@ -357,6 +357,7 @@ function parseDataType(tokens, linenum, charnum) {
var typeName = parse(tokens, linenum, charnum);
var typeParams;
var typeBody;
var result;
if (typeName.exprType !== "TypeOperator") {
throw error.JSyntaxError(typeName.linenum,
@ -376,7 +377,9 @@ function parseDataType(tokens, linenum, charnum) {
}
tokens.pop();
typeBody = parse(tokens);
return addSrcPos(new typ.DataType, tokens, typeBody.linenum, typeBody.charnum);
result = addSrcPos(new typ.DataType(parameters, typeBody), tokens, typeBody.linenum, typeBody.charnum);
return result;
}

Loading…
Cancel
Save