Skip to content

Commit

Permalink
Rework visitContructor to match how it is doen for func declarator
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuukk authored Aug 27, 2024
1 parent 27b1042 commit b9401fb
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions dsymbol/src/dsymbol/conversion/first.d
Original file line number Diff line number Diff line change
Expand Up @@ -905,31 +905,32 @@ private:
const TemplateParameters templateParameters,
const FunctionBody functionBody, string doc)
{
SemanticSymbol* symbol = allocateSemanticSymbol(CONSTRUCTOR_SYMBOL_NAME,
CompletionKind.functionName, symbolFile, location);
symbol.parent = currentSymbol;
currentSymbol.addChild(symbol, true);
symbol.acSymbol.protection = protection.current;
symbol.acSymbol.doc = makeDocumentation(doc);
pushSymbol(CONSTRUCTOR_SYMBOL_NAME, CompletionKind.functionName, symbolFile, location, null);
scope (exit) popSymbol();

currentSymbol.acSymbol.protection = protection.current;
currentSymbol.acSymbol.doc = makeDocumentation(doc);
currentSymbol.acSymbol.qualifier = SymbolQualifier.func;

istring lastComment = this.lastComment;
this.lastComment = istring.init;
scope(exit) this.lastComment = lastComment;

if (functionBody !is null)
{
pushFunctionScope(functionBody, location + 4); // 4 == "this".length
scope(exit) popScope();
currentSymbol = symbol;
processParameters(symbol, null, THIS_SYMBOL_NAME, parameters, templateParameters);
size_t start = location + 4; // 4 = ctor name length
currentSymbol.acSymbol.location = start;

pushFunctionScope(functionBody, start);
scope (exit) popScope();
processParameters(currentSymbol, null,
currentSymbol.acSymbol.name, parameters, templateParameters);
functionBody.accept(this);
currentSymbol = currentSymbol.parent;
}
else
{
currentSymbol = symbol;
processParameters(symbol, null, THIS_SYMBOL_NAME, parameters, templateParameters);
currentSymbol = currentSymbol.parent;
processParameters(currentSymbol, null,
currentSymbol.acSymbol.name, parameters, templateParameters);
}
}

Expand Down

0 comments on commit b9401fb

Please sign in to comment.