From b9401fb5d4fd323078ae55594ac0c03c3ffe339b Mon Sep 17 00:00:00 2001 From: ryuukk <44361234+ryuukk@users.noreply.github.com> Date: Tue, 27 Aug 2024 07:44:17 +0200 Subject: [PATCH] Rework visitContructor to match how it is doen for func declarator --- dsymbol/src/dsymbol/conversion/first.d | 29 +++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d index 6cad7ff8..1a8465ea 100644 --- a/dsymbol/src/dsymbol/conversion/first.d +++ b/dsymbol/src/dsymbol/conversion/first.d @@ -905,12 +905,12 @@ 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; @@ -918,18 +918,19 @@ private: 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); } }