more improvements for idetools
This commit is contained in:
parent
541fdceb57
commit
976c39cdc9
4 changed files with 17 additions and 9 deletions
|
|
@ -12,7 +12,7 @@ import
|
||||||
|
|
||||||
type
|
type
|
||||||
TMsgKind* = enum
|
TMsgKind* = enum
|
||||||
errUnknown, errIllFormedAstX, errCannotOpenFile, errInternal, errGenerated,
|
errUnknown, errIllFormedAstX, errInternal, errCannotOpenFile, errGenerated,
|
||||||
errXCompilerDoesNotSupportCpp, errStringLiteralExpected,
|
errXCompilerDoesNotSupportCpp, errStringLiteralExpected,
|
||||||
errIntLiteralExpected, errInvalidCharacterConstant,
|
errIntLiteralExpected, errInvalidCharacterConstant,
|
||||||
errClosingTripleQuoteExpected, errClosingQuoteExpected,
|
errClosingTripleQuoteExpected, errClosingQuoteExpected,
|
||||||
|
|
@ -115,8 +115,8 @@ const
|
||||||
MsgKindToStr*: array[TMsgKind, string] = [
|
MsgKindToStr*: array[TMsgKind, string] = [
|
||||||
errUnknown: "unknown error",
|
errUnknown: "unknown error",
|
||||||
errIllFormedAstX: "illformed AST: $1",
|
errIllFormedAstX: "illformed AST: $1",
|
||||||
errCannotOpenFile: "cannot open \'$1\'",
|
|
||||||
errInternal: "internal error: $1",
|
errInternal: "internal error: $1",
|
||||||
|
errCannotOpenFile: "cannot open \'$1\'",
|
||||||
errGenerated: "$1",
|
errGenerated: "$1",
|
||||||
errXCompilerDoesNotSupportCpp: "\'$1\' compiler does not support C++",
|
errXCompilerDoesNotSupportCpp: "\'$1\' compiler does not support C++",
|
||||||
errStringLiteralExpected: "string literal expected",
|
errStringLiteralExpected: "string literal expected",
|
||||||
|
|
@ -576,7 +576,7 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
|
||||||
assert(false) # we want a stack trace here
|
assert(false) # we want a stack trace here
|
||||||
if msg >= fatalMin and msg <= fatalMax:
|
if msg >= fatalMin and msg <= fatalMax:
|
||||||
if gVerbosity >= 3: assert(false)
|
if gVerbosity >= 3: assert(false)
|
||||||
if gCmd != cmdIdeTools: quit(1)
|
quit(1)
|
||||||
if msg >= errMin and msg <= errMax:
|
if msg >= errMin and msg <= errMax:
|
||||||
if gVerbosity >= 3: assert(false)
|
if gVerbosity >= 3: assert(false)
|
||||||
inc(gErrorCounter)
|
inc(gErrorCounter)
|
||||||
|
|
@ -661,16 +661,19 @@ proc GlobalError*(info: TLineInfo, msg: TMsgKind, arg = "") =
|
||||||
liMessage(info, msg, arg, doRaise)
|
liMessage(info, msg, arg, doRaise)
|
||||||
|
|
||||||
proc LocalError*(info: TLineInfo, msg: TMsgKind, arg = "") =
|
proc LocalError*(info: TLineInfo, msg: TMsgKind, arg = "") =
|
||||||
|
if gCmd == cmdIdeTools and gErrorCounter > 10: return
|
||||||
liMessage(info, msg, arg, doNothing)
|
liMessage(info, msg, arg, doNothing)
|
||||||
|
|
||||||
proc Message*(info: TLineInfo, msg: TMsgKind, arg = "") =
|
proc Message*(info: TLineInfo, msg: TMsgKind, arg = "") =
|
||||||
liMessage(info, msg, arg, doNothing)
|
liMessage(info, msg, arg, doNothing)
|
||||||
|
|
||||||
proc InternalError*(info: TLineInfo, errMsg: string) =
|
proc InternalError*(info: TLineInfo, errMsg: string) =
|
||||||
|
if gCmd == cmdIdeTools: return
|
||||||
writeContext(info)
|
writeContext(info)
|
||||||
liMessage(info, errInternal, errMsg, doAbort)
|
liMessage(info, errInternal, errMsg, doAbort)
|
||||||
|
|
||||||
proc InternalError*(errMsg: string) =
|
proc InternalError*(errMsg: string) =
|
||||||
|
if gCmd == cmdIdeTools: return
|
||||||
writeContext(UnknownLineInfo())
|
writeContext(UnknownLineInfo())
|
||||||
rawMessage(errInternal, errMsg)
|
rawMessage(errInternal, errMsg)
|
||||||
|
|
||||||
|
|
@ -680,4 +683,3 @@ template AssertNotNil*(e: expr): expr =
|
||||||
|
|
||||||
template InternalAssert*(e: bool): stmt =
|
template InternalAssert*(e: bool): stmt =
|
||||||
if not e: InternalError($InstantiationInfo())
|
if not e: InternalError($InstantiationInfo())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1258,8 +1258,8 @@ proc semSetConstr(c: PContext, n: PNode): PNode =
|
||||||
typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyOrdinal})
|
typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyOrdinal})
|
||||||
if not isOrdinalType(typ):
|
if not isOrdinalType(typ):
|
||||||
LocalError(n.info, errOrdinalTypeExpected)
|
LocalError(n.info, errOrdinalTypeExpected)
|
||||||
return
|
typ = makeRangeType(c, 0, MaxSetElements - 1, n.info)
|
||||||
if lengthOrd(typ) > MaxSetElements:
|
elif lengthOrd(typ) > MaxSetElements:
|
||||||
typ = makeRangeType(c, 0, MaxSetElements - 1, n.info)
|
typ = makeRangeType(c, 0, MaxSetElements - 1, n.info)
|
||||||
addSonSkipIntLit(result.typ, typ)
|
addSonSkipIntLit(result.typ, typ)
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
|
|
|
||||||
|
|
@ -1199,7 +1199,11 @@ proc SemStmt(c: PContext, n: PNode): PNode =
|
||||||
result = semExprNoType(c, n)
|
result = semExprNoType(c, n)
|
||||||
#LocalError(n.info, errStmtExpected)
|
#LocalError(n.info, errStmtExpected)
|
||||||
#result = ast.emptyNode
|
#result = ast.emptyNode
|
||||||
if result == nil: InternalError(n.info, "SemStmt: result = nil")
|
if result == nil:
|
||||||
|
InternalError(n.info, "SemStmt: result = nil")
|
||||||
|
# error correction:
|
||||||
|
result = emptyNode
|
||||||
|
else:
|
||||||
incl(result.flags, nfSem)
|
incl(result.flags, nfSem)
|
||||||
|
|
||||||
proc semStmtScope(c: PContext, n: PNode): PNode =
|
proc semStmtScope(c: PContext, n: PNode): PNode =
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -23,6 +23,8 @@ version 0.9.0
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
|
|
||||||
|
- bug: aporia.nim(968, 5) Error: ambiguous identifier: 'DELETE' --
|
||||||
|
use a qualifier
|
||||||
- bug: pragma statements in combination with symbol files are evaluated twice
|
- bug: pragma statements in combination with symbol files are evaluated twice
|
||||||
but this can lead to compilation errors
|
but this can lead to compilation errors
|
||||||
- bug: the parser is not strict enough with newlines: 'echo "a" echo "b"'
|
- bug: the parser is not strict enough with newlines: 'echo "a" echo "b"'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue