diff --git a/compiler/semdata.nim b/compiler/semdata.nim index d36278d03..ef23e40f2 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -113,7 +113,6 @@ type recursiveDep*: string suggestionsMade*: bool inTypeContext*: int - suggestionNode*: PNode proc makeInstPair*(s: PSym, inst: PInstantiation): TInstantiationPair = result.genericSym = s diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 3c4bf8c09..5630fa34f 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -405,13 +405,16 @@ proc inCheckpoint*(current: TLineInfo): TCheckPointResult = if current.line >= gTrackPos.line: return cpFuzzy -proc findClosestDot(n: PNode): PNode = +proc findClosestDot(n: PNode; inType: var bool): PNode = if n.kind == nkDotExpr and inCheckpoint(n.info) == cpExact: result = n else: for i in 0.. 0: return inc(c.compilesContextId) var outputs: Suggestions = @[] @@ -589,19 +592,16 @@ proc suggestSentinel*(c: PContext) = if c.compilesContextId > 0: return inc(c.compilesContextId) var outputs: Suggestions = @[] - if c.suggestionNode != nil: - sugExpr(c, c.suggestionNode, outputs, cpExact) - else: - # suggest everything: - var isLocal = true - var scopeN = 0 - for scope in walkScopes(c.currentScope): - if scope == c.topLevelScope: isLocal = false - dec scopeN - for it in items(scope.symbols): - var pm: PrefixMatch - if filterSymNoOpr(it, nil, pm): - outputs.add(symToSuggest(it, isLocal = isLocal, $ideSug, 0, PrefixMatch.None, false, scopeN)) + # suggest everything: + var isLocal = true + var scopeN = 0 + for scope in walkScopes(c.currentScope): + if scope == c.topLevelScope: isLocal = false + dec scopeN + for it in items(scope.symbols): + var pm: PrefixMatch + if filterSymNoOpr(it, nil, pm): + outputs.add(symToSuggest(it, isLocal = isLocal, $ideSug, 0, PrefixMatch.None, false, scopeN)) dec(c.compilesContextId) produceOutput(outputs) diff --git a/compiler/transf.nim b/compiler/transf.nim index 0c53c0cbf..771dc58f4 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -291,10 +291,13 @@ proc transformBreak(c: PTransf, n: PNode): PTransNode = else: result = newTransNode(n.kind, n.info, 1) result[0] = lablCopy.PTransNode - else: + elif c.breakSyms.len > 0: + # this check can fail for 'nim check' let labl = c.breakSyms[c.breakSyms.high] result = transformSons(c, n) result[0] = newSymNode(labl).PTransNode + else: + result = n.PTransNode proc unpackTuple(c: PTransf, n: PNode, father: PTransNode) = # XXX: BUG: what if `n` is an expression with side-effects? diff --git a/tools/nimsuggest/tests/tdot1.nim b/tools/nimsuggest/tests/tdot1.nim index d31085f9d..9ac92f8a5 100644 --- a/tools/nimsuggest/tests/tdot1.nim +++ b/tools/nimsuggest/tests/tdot1.nim @@ -11,4 +11,4 @@ type x, y: int proc main(f: Foo) = - f.#[!]# + if f.#[!]#: