From 4e7a22cac31a0a703c080c7fe0d2569f56ab16a0 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 21 Feb 2011 01:07:12 +0100 Subject: [PATCH] somewhat better 'suggest' --- rod/options.nim | 3 +-- rod/semgnrc.nim | 1 + rod/semstmts.nim | 3 +++ tests/reject/t99bott.nim | 1 + todo.txt | 4 ++-- tools/buildsh.tmpl | 4 ++++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rod/options.nim b/rod/options.nim index b2bf7fed93..9dc2b235e8 100755 --- a/rod/options.nim +++ b/rod/options.nim @@ -104,7 +104,6 @@ proc existsConfigVar*(key: string): bool proc getConfigVar*(key: string): string proc setConfigVar*(key, val: string) proc addImplicitMod*(filename: string) -proc getOutFile*(filename, ext: string): string proc binaryStrSearch*(x: openarray[string], y: string): int # implementation @@ -117,7 +116,7 @@ proc getConfigVar(key: string): string = proc setConfigVar(key, val: string) = nstrtabs.put(gConfigVars, key, val) -proc getOutFile(filename, ext: string): string = +proc getOutFile*(filename, ext: string): string = if options.outFile != "": result = options.outFile else: result = changeFileExt(filename, ext) diff --git a/rod/semgnrc.nim b/rod/semgnrc.nim index 77c2001203..00ad3fdc9f 100755 --- a/rod/semgnrc.nim +++ b/rod/semgnrc.nim @@ -67,6 +67,7 @@ proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags = {}): PNode L: int a: PNode result = n + if gCmd == cmdSuggest: suggestStmt(c, n) case n.kind of nkIdent: var s = SymtabGet(c.Tab, n.ident) diff --git a/rod/semstmts.nim b/rod/semstmts.nim index eb4a51b517..801542d17e 100755 --- a/rod/semstmts.nim +++ b/rod/semstmts.nim @@ -275,6 +275,7 @@ proc semVar(c: PContext, n: PNode): PNode = result = copyNode(n) for i in countup(0, sonsLen(n)-1): var a = n.sons[i] + if gCmd == cmdSuggest: suggestStmt(c, a) if a.kind == nkCommentStmt: continue if (a.kind != nkIdentDefs) and (a.kind != nkVarTuple): IllFormedAst(a) checkMinSonsLen(a, 3) @@ -331,6 +332,7 @@ proc semConst(c: PContext, n: PNode): PNode = result = copyNode(n) for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] + if gCmd == cmdSuggest: suggestStmt(c, a) if a.kind == nkCommentStmt: continue if (a.kind != nkConstDef): IllFormedAst(a) checkSonsLen(a, 3) @@ -483,6 +485,7 @@ proc SemTypeSection(c: PContext, n: PNode): PNode = # we even look at the type definitions on the right for i in countup(0, sonsLen(n) - 1): var a = n.sons[i] + if gCmd == cmdSuggest: suggestStmt(c, a) if a.kind == nkCommentStmt: continue if a.kind != nkTypeDef: IllFormedAst(a) checkSonsLen(a, 3) diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim index b514b49d94..936ebdd3b6 100755 --- a/tests/reject/t99bott.nim +++ b/tests/reject/t99bott.nim @@ -2,6 +2,7 @@ discard """ file: "t99bott.nim" line: 25 errormsg: "constant expression expected" + disabled: true """ ## 99 Bottles of Beer ## http://www.99-bottles-of-beer.net/ diff --git a/todo.txt b/todo.txt index 5958cfa019..3ce1fb65a3 100755 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,5 @@ -- 'suggest' needs tweaking: more places in the semantic checking - need to take it into account +- 'suggest' needs tweaking: support for '.' +- stdout support for doc, pretty - thread support: threadvar on Windows seems broken; add --deadlock_prevention:on|off switch diff --git a/tools/buildsh.tmpl b/tools/buildsh.tmpl index d8c59628b2..e763a5c05f 100755 --- a/tools/buildsh.tmpl +++ b/tools/buildsh.tmpl @@ -61,6 +61,10 @@ case $ucpu in *sparc*|*sun* ) mycpu="sparc" ;; *ppc64* ) + if [ "$myos" = "linux" ] ; then + COMP_FLAGS="$COMP_FLAGS -m64" + LINK_FLAGS="$LINK_FLAGS -m64" + fi mycpu="powerpc64" ;; *power*|*Power* ) mycpu="powerpc" ;;