small bugfixes to make more tests green
This commit is contained in:
parent
84c473a890
commit
1f6725e59e
11 changed files with 40 additions and 11 deletions
|
|
@ -19,6 +19,7 @@ type
|
|||
errTabulatorsAreNotAllowed, errInvalidToken, errLineTooLong,
|
||||
errInvalidNumber, errNumberOutOfRange, errNnotAllowedInCharacter,
|
||||
errClosingBracketExpected, errMissingFinalQuote, errIdentifierExpected,
|
||||
errNewlineExpected,
|
||||
errInvalidModuleName,
|
||||
errOperatorExpected, errTokenExpected, errStringAfterIncludeExpected,
|
||||
errRecursiveDependencyX, errOnOrOffExpected, errNoneSpeedOrSizeExpected,
|
||||
|
|
@ -128,6 +129,7 @@ const
|
|||
errClosingBracketExpected: "closing ']' expected, but end of file reached",
|
||||
errMissingFinalQuote: "missing final \'",
|
||||
errIdentifierExpected: "identifier expected, but found \'$1\'",
|
||||
errNewlineExpected: "newline expected, but found \'$1\'",
|
||||
errInvalidModuleName: "invalid module name: '$1'",
|
||||
errOperatorExpected: "operator expected, but found \'$1\'",
|
||||
errTokenExpected: "\'$1\' expected",
|
||||
|
|
|
|||
|
|
@ -95,6 +95,10 @@ proc optInd(p: var TParser, n: PNode) =
|
|||
skipComment(p, n)
|
||||
skipInd(p)
|
||||
|
||||
proc ExpectNl(p: TParser) =
|
||||
if p.tok.tokType notin {tkEof, tkSad, tkInd, tkDed}:
|
||||
lexMessage(p.lex, errNewlineExpected, prettyTok(p.tok))
|
||||
|
||||
proc expectIdentOrKeyw(p: TParser) =
|
||||
if p.tok.tokType != tkSymbol and not isKeyword(p.tok.tokType):
|
||||
lexMessage(p.lex, errIdentifierExpected, prettyTok(p.tok))
|
||||
|
|
@ -761,6 +765,7 @@ proc parseImportOrIncludeStmt(p: var TParser, kind: TNodeKind): PNode =
|
|||
if p.tok.tokType != tkComma: break
|
||||
getTok(p)
|
||||
optInd(p, a)
|
||||
expectNl(p)
|
||||
|
||||
proc parseFromStmt(p: var TParser): PNode =
|
||||
var a: PNode
|
||||
|
|
@ -798,6 +803,7 @@ proc parseFromStmt(p: var TParser): PNode =
|
|||
if p.tok.tokType != tkComma: break
|
||||
getTok(p)
|
||||
optInd(p, a)
|
||||
expectNl(p)
|
||||
|
||||
proc parseReturnOrRaise(p: var TParser, kind: TNodeKind): PNode =
|
||||
result = newNodeP(kind, p)
|
||||
|
|
@ -1299,6 +1305,7 @@ proc parseBind(p: var TParser): PNode =
|
|||
if p.tok.tokType != tkComma: break
|
||||
getTok(p)
|
||||
optInd(p, a)
|
||||
expectNl(p)
|
||||
|
||||
proc simpleStmt(p: var TParser): PNode =
|
||||
case p.tok.tokType
|
||||
|
|
|
|||
|
|
@ -253,8 +253,10 @@ proc semGenericStmt(c: PContext, n: PNode,
|
|||
addDecl(c, newSym(skUnknown, getIdent("result"), nil))
|
||||
n.sons[paramsPos] = semGenericStmt(c, n.sons[paramsPos], flags, toBind)
|
||||
n.sons[pragmasPos] = semGenericStmt(c, n.sons[pragmasPos], flags, toBind)
|
||||
var s = n.sons[namePos].sym
|
||||
n.sons[bodyPos] = semGenericStmtScope(c, s.getBody, flags, toBind)
|
||||
var body: PNode
|
||||
if n.sons[namePos].kind == nkSym: body = n.sons[namePos].sym.getBody
|
||||
else: body = n.sons[bodyPos]
|
||||
n.sons[bodyPos] = semGenericStmtScope(c, body, flags, toBind)
|
||||
closeScope(c.tab)
|
||||
else:
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
|
|
|
|||
|
|
@ -735,7 +735,8 @@ proc SameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
|||
result = sameObjectStructures(a, b, c)
|
||||
of tyDistinct:
|
||||
CycleCheck()
|
||||
result = sameTypeAux(a.sons[0], b.sons[0], c)
|
||||
if c.cmp == dcEq: result = sameDistinctTypes(a, b)
|
||||
else: result = sameTypeAux(a.sons[0], b.sons[0], c)
|
||||
of tyEnum, tyForward, tyProxy:
|
||||
# XXX generic enums do not make much sense, but require structural checking
|
||||
result = a.id == b.id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue