diff options
author | Araq <rumpf_a@web.de> | 2015-09-18 11:29:43 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-09-18 11:29:43 +0200 |
commit | c921f30b1d575b3e457cc98cb95198d1513e69ab (patch) | |
tree | 5fa5f43343e19ddc95b2c48853527311bc495c22 /compiler | |
parent | 5b2f54ffa14439df696ea7f8c254c5ebd2c10042 (diff) | |
download | Nim-c921f30b1d575b3e457cc98cb95198d1513e69ab.tar.gz |
renamed inCompilesContext to compilesContextId; added test case for #3313
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/lookups.nim | 2 | ||||
-rw-r--r-- | compiler/semcall.nim | 4 | ||||
-rw-r--r-- | compiler/semdata.nim | 2 | ||||
-rw-r--r-- | compiler/semexprs.nim | 8 | ||||
-rw-r--r-- | compiler/seminst.nim | 6 | ||||
-rw-r--r-- | compiler/suggest.nim | 6 |
6 files changed, 14 insertions, 14 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 88e32404a..e88589c3e 100644 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -116,7 +116,7 @@ proc errorSym*(c: PContext, n: PNode): PSym = result.typ = errorType(c) incl(result.flags, sfDiscardable) # pretend it's imported from some unknown module to prevent cascading errors: - if gCmd != cmdInteractive and c.inCompilesContext == 0: + if gCmd != cmdInteractive and c.compilesContextId == 0: c.importTable.addSym(result) type diff --git a/compiler/semcall.nim b/compiler/semcall.nim index f9fadeec7..381093531 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -95,7 +95,7 @@ proc notFoundError*(c: PContext, n: PNode, errors: CandidateErrors) = # Gives a detailed error message; this is separated from semOverloadedCall, # as semOverlodedCall is already pretty slow (and we need this information # only in case of an error). - if c.inCompilesContext > 0: + if c.compilesContextId > 0: # fail fast: globalError(n.info, errTypeMismatch, "") if errors.isNil or errors.len == 0: @@ -235,7 +235,7 @@ proc resolveOverloads(c: PContext, n, orig: PNode, internalAssert result.state == csMatch #writeMatches(result) #writeMatches(alt) - if c.inCompilesContext > 0: + if c.compilesContextId > 0: # quick error message for performance of 'compiles' built-in: globalError(n.info, errGenerated, "ambiguous call") elif gErrorCounter == 0: diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 48255c83d..9b2f2e2ce 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -71,7 +71,7 @@ type inTypeClass*: int # > 0 if we are in a user-defined type class inGenericContext*: int # > 0 if we are in a generic type inUnrolledContext*: int # > 0 if we are unrolling a loop - inCompilesContext*: int # > 0 if we are in a ``compiles`` magic + compilesContextId*: int # > 0 if we are in a ``compiles`` magic compilesContextIdGenerator*: int inGenericInst*: int # > 0 if we are instantiating a generic converters*: TSymSeq # sequence of converters diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 9b0e02976..4792702dc 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -818,7 +818,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = # This is a proc variable, apply normal overload resolution let m = resolveIndirectCall(c, n, nOrig, t) if m.state != csMatch: - if c.inCompilesContext > 0: + if c.compilesContextId > 0: # speed up error generation: globalError(n.info, errTypeMismatch, "") return emptyNode @@ -1636,9 +1636,9 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # watch out, hacks ahead: let oldErrorCount = msgs.gErrorCounter let oldErrorMax = msgs.gErrorMax - let oldCompilesId = c.inCompilesContext + let oldCompilesId = c.compilesContextId inc c.compilesContextIdGenerator - c.inCompilesContext = c.compilesContextIdGenerator + c.compilesContextId = c.compilesContextIdGenerator # do not halt after first error: msgs.gErrorMax = high(int) @@ -1662,7 +1662,7 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = except ERecoverableError: discard # undo symbol table changes (as far as it's possible): - c.inCompilesContext = oldCompilesId + c.compilesContextId = oldCompilesId c.generics = oldGenerics c.inGenericContext = oldInGenericContext c.inUnrolledContext = oldInUnrolledContext diff --git a/compiler/seminst.nim b/compiler/seminst.nim index ca9c7c2c0..abc5600c3 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -250,14 +250,14 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable, if tfTriggersCompileTime in result.typ.flags: incl(result.flags, sfCompileTime) n.sons[genericParamsPos] = ast.emptyNode - var oldPrc = genericCacheGet(fn, entry[], c.inCompilesContext) + var oldPrc = genericCacheGet(fn, entry[], c.compilesContextId) if oldPrc == nil: # we MUST not add potentially wrong instantiations to the caching mechanism. # This means recursive instantiations behave differently when in # a ``compiles`` context but this is the lesser evil. See # bug #1055 (tevilcompiles). - #if c.inCompilesContext == 0: - entry.compilesId = c.inCompilesContext + #if c.compilesContextId == 0: + entry.compilesId = c.compilesContextId fn.procInstCache.safeAdd(entry) c.generics.add(makeInstPair(fn, entry)) if n.sons[pragmasPos].kind != nkEmpty: diff --git a/compiler/suggest.nim b/compiler/suggest.nim index c15a56c54..ed21aa4ea 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -335,8 +335,8 @@ proc suggestExpr*(c: PContext, node: PNode) = if cp == cpNone: return var outputs = 0 # This keeps semExpr() from coming here recursively: - if c.inCompilesContext > 0: return - inc(c.inCompilesContext) + if c.compilesContextId > 0: return + inc(c.compilesContextId) if gIdeCmd == ideSug: var n = if nfIsCursor in node.flags: node else: findClosestDot(node) @@ -365,7 +365,7 @@ proc suggestExpr*(c: PContext, node: PNode) = addSon(a, x) suggestCall(c, a, n, outputs) - dec(c.inCompilesContext) + dec(c.compilesContextId) if outputs > 0 and gIdeCmd != ideUse: suggestQuit() proc suggestStmt*(c: PContext, n: PNode) = |