Calculate parameter scope in a less stupid way thereby fixing go-to-declaration with parameters
This commit is contained in:
parent
93f7c0eddf
commit
054ddfbf39
|
|
@ -129,11 +129,7 @@ final class FirstPass : ASTVisitor
|
|||
if (dec.functionBody !is null)
|
||||
{
|
||||
import std.algorithm;
|
||||
size_t scopeBegin = min(
|
||||
dec.functionBody.inStatement is null ? size_t.max : dec.functionBody.inStatement.blockStatement.startLocation,
|
||||
dec.functionBody.outStatement is null ? size_t.max : dec.functionBody.outStatement.blockStatement.startLocation,
|
||||
dec.functionBody.blockStatement is null ? size_t.max : dec.functionBody.blockStatement.startLocation,
|
||||
dec.functionBody.bodyStatement is null ? size_t.max : dec.functionBody.bodyStatement.blockStatement.startLocation);
|
||||
size_t scopeBegin = dec.name.index;
|
||||
size_t scopeEnd = max(
|
||||
dec.functionBody.inStatement is null ? 0 : dec.functionBody.inStatement.blockStatement.endLocation,
|
||||
dec.functionBody.outStatement is null ? 0 : dec.functionBody.outStatement.blockStatement.endLocation,
|
||||
|
|
@ -508,7 +504,7 @@ private:
|
|||
{
|
||||
SemanticSymbol* parameter = allocateSemanticSymbol(
|
||||
p.name.text, CompletionKind.variableName, symbolFile,
|
||||
size_t.max, p.type);
|
||||
p.name.index, p.type);
|
||||
symbol.addChild(parameter);
|
||||
parameter.parent = symbol;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,12 +59,6 @@ private:
|
|||
void assignToScopes(ACSymbol* currentSymbol)
|
||||
{
|
||||
Scope* s = moduleScope.getScopeByCursor(currentSymbol.location);
|
||||
// Look for a parent scope whose start location equals this scope's
|
||||
// start location. This only happens in the case of functions with
|
||||
// contracts. Use this outer scope that covers the in, out, and body
|
||||
// instead of the smaller scope found by getScopeByCursor.
|
||||
if (s.parent !is null && s.parent.startLocation == s.startLocation)
|
||||
s = s.parent;
|
||||
if (currentSymbol.kind != CompletionKind.moduleName)
|
||||
s.symbols.insert(currentSymbol);
|
||||
foreach (part; currentSymbol.parts[])
|
||||
|
|
|
|||
Loading…
Reference in New Issue