somewhat better 'suggest'

This commit is contained in:
Araq 2011-02-21 01:07:12 +01:00
commit 4e7a22cac3
6 changed files with 12 additions and 4 deletions

View file

@ -104,7 +104,6 @@ proc existsConfigVar*(key: string): bool
proc getConfigVar*(key: string): string proc getConfigVar*(key: string): string
proc setConfigVar*(key, val: string) proc setConfigVar*(key, val: string)
proc addImplicitMod*(filename: string) proc addImplicitMod*(filename: string)
proc getOutFile*(filename, ext: string): string
proc binaryStrSearch*(x: openarray[string], y: string): int proc binaryStrSearch*(x: openarray[string], y: string): int
# implementation # implementation
@ -117,7 +116,7 @@ proc getConfigVar(key: string): string =
proc setConfigVar(key, val: string) = proc setConfigVar(key, val: string) =
nstrtabs.put(gConfigVars, key, val) nstrtabs.put(gConfigVars, key, val)
proc getOutFile(filename, ext: string): string = proc getOutFile*(filename, ext: string): string =
if options.outFile != "": result = options.outFile if options.outFile != "": result = options.outFile
else: result = changeFileExt(filename, ext) else: result = changeFileExt(filename, ext)

View file

@ -67,6 +67,7 @@ proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags = {}): PNode
L: int L: int
a: PNode a: PNode
result = n result = n
if gCmd == cmdSuggest: suggestStmt(c, n)
case n.kind case n.kind
of nkIdent: of nkIdent:
var s = SymtabGet(c.Tab, n.ident) var s = SymtabGet(c.Tab, n.ident)

View file

@ -275,6 +275,7 @@ proc semVar(c: PContext, n: PNode): PNode =
result = copyNode(n) result = copyNode(n)
for i in countup(0, sonsLen(n)-1): for i in countup(0, sonsLen(n)-1):
var a = n.sons[i] var a = n.sons[i]
if gCmd == cmdSuggest: suggestStmt(c, a)
if a.kind == nkCommentStmt: continue if a.kind == nkCommentStmt: continue
if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): IllFormedAst(a) if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): IllFormedAst(a)
checkMinSonsLen(a, 3) checkMinSonsLen(a, 3)
@ -331,6 +332,7 @@ proc semConst(c: PContext, n: PNode): PNode =
result = copyNode(n) result = copyNode(n)
for i in countup(0, sonsLen(n) - 1): for i in countup(0, sonsLen(n) - 1):
var a = n.sons[i] var a = n.sons[i]
if gCmd == cmdSuggest: suggestStmt(c, a)
if a.kind == nkCommentStmt: continue if a.kind == nkCommentStmt: continue
if (a.kind != nkConstDef): IllFormedAst(a) if (a.kind != nkConstDef): IllFormedAst(a)
checkSonsLen(a, 3) checkSonsLen(a, 3)
@ -483,6 +485,7 @@ proc SemTypeSection(c: PContext, n: PNode): PNode =
# we even look at the type definitions on the right # we even look at the type definitions on the right
for i in countup(0, sonsLen(n) - 1): for i in countup(0, sonsLen(n) - 1):
var a = n.sons[i] var a = n.sons[i]
if gCmd == cmdSuggest: suggestStmt(c, a)
if a.kind == nkCommentStmt: continue if a.kind == nkCommentStmt: continue
if a.kind != nkTypeDef: IllFormedAst(a) if a.kind != nkTypeDef: IllFormedAst(a)
checkSonsLen(a, 3) checkSonsLen(a, 3)

View file

@ -2,6 +2,7 @@ discard """
file: "t99bott.nim" file: "t99bott.nim"
line: 25 line: 25
errormsg: "constant expression expected" errormsg: "constant expression expected"
disabled: true
""" """
## 99 Bottles of Beer ## 99 Bottles of Beer
## http://www.99-bottles-of-beer.net/ ## http://www.99-bottles-of-beer.net/

View file

@ -1,5 +1,5 @@
- 'suggest' needs tweaking: more places in the semantic checking - 'suggest' needs tweaking: support for '.'
need to take it into account - stdout support for doc, pretty
- thread support: threadvar on Windows seems broken; - thread support: threadvar on Windows seems broken;
add --deadlock_prevention:on|off switch add --deadlock_prevention:on|off switch

View file

@ -61,6 +61,10 @@ case $ucpu in
*sparc*|*sun* ) *sparc*|*sun* )
mycpu="sparc" ;; mycpu="sparc" ;;
*ppc64* ) *ppc64* )
if [ "$myos" = "linux" ] ; then
COMP_FLAGS="$COMP_FLAGS -m64"
LINK_FLAGS="$LINK_FLAGS -m64"
fi
mycpu="powerpc64" ;; mycpu="powerpc64" ;;
*power*|*Power* ) *power*|*Power* )
mycpu="powerpc" ;; mycpu="powerpc" ;;