diff options
author | Araq <rumpf_a@web.de> | 2015-01-30 01:56:03 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-01-30 03:04:45 +0100 |
commit | fe30ec83e22f14ee65f1a5225152e01a3713b2c4 (patch) | |
tree | bce984e85865ec2ddf442ffe8e48d07c13ac2fd6 /compiler/sem.nim | |
parent | a9706dcfa2402c17aefc710e9ac925fcac8873ae (diff) | |
download | Nim-fe30ec83e22f14ee65f1a5225152e01a3713b2c4.tar.gz |
nimsuggest improvements
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r-- | compiler/sem.nim | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 90037fccd..214f471d6 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -47,6 +47,24 @@ proc finishMethod(c: PContext, s: PSym) proc indexTypesMatch(c: PContext, f, a: PType, arg: PNode): PNode +template semIdeForTemplateOrGenericCheck(n, requiresCheck) = + # we check quickly if the node is where the cursor is + when defined(nimsuggest): + if n.info.fileIndex == gTrackPos.fileIndex and n.info.line == gTrackPos.line: + requiresCheck = true + +template semIdeForTemplateOrGeneric(c: PContext; n: PNode; + requiresCheck: bool) = + # use only for idetools support; this is pretty slow so generics and + # templates perform some quick check whether the cursor is actually in + # the generic or template. + when defined(nimsuggest): + assert gCmd == cmdIdeTools + if requiresCheck: + if optIdeDebug in gGlobalOptions: + echo "passing to safeSemExpr: ", renderTree(n) + discard safeSemExpr(c, n) + proc typeMismatch(n: PNode, formal, actual: PType) = if formal.kind != tyError and actual.kind != tyError: localError(n.info, errGenerated, msgKindToString(errTypeMismatch) & @@ -359,13 +377,7 @@ proc semConstBoolExpr(c: PContext, n: PNode): PNode = localError(n.info, errConstExprExpected) result = nn -type - TSemGenericFlag = enum - withinBind, withinTypeDesc, withinMixin - TSemGenericFlags = set[TSemGenericFlag] - -proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags, - ctx: var IntSet): PNode +proc semGenericStmt(c: PContext, n: PNode): PNode include semtypes, semtempl, semgnrc, semstmts, semexprs |