File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -258,8 +258,7 @@ class DeclVisitor : public AstVisitorBase<DeclVisitor> {
258
258
void emitAbstractFunctionDecl (swift::AbstractFunctionDecl* decl,
259
259
TrapLabel<AbstractFunctionDeclTag> label) {
260
260
assert (decl->hasParameterList () && " Expect functions to have a parameter list" );
261
- auto name = !decl->hasName () || decl->getName ().isSpecial () ? " (unnamed function decl)"
262
- : decl->getNameStr ().str ();
261
+ auto name = !decl->hasName () ? " (unnamed function decl)" : constructName (decl->getName ());
263
262
dispatcher_.emit (AbstractFunctionDeclsTrap{label, name});
264
263
if (auto body = decl->getBody ()) {
265
264
dispatcher_.emit (AbstractFunctionDeclBodiesTrap{label, dispatcher_.fetchLabel (body)});
@@ -355,6 +354,22 @@ class DeclVisitor : public AstVisitorBase<DeclVisitor> {
355
354
emitValueDecl (decl, label);
356
355
}
357
356
357
+ // Constructs a `std::string` of the form `f(x:y:)` for a declaration
358
+ // like `func f(x first: Int, y second: Int) { }`
359
+ std::string constructName (swift::DeclName declName) {
360
+ std::string name = declName.getBaseName ().userFacingName ().str ();
361
+ name += " (" ;
362
+ for (auto argName : declName.getArgumentNames ()) {
363
+ if (argName.empty ()) {
364
+ name += " _:" ;
365
+ } else {
366
+ name += argName.str ().str () + " :" ;
367
+ }
368
+ }
369
+ name += " )" ;
370
+ return name;
371
+ }
372
+
358
373
private:
359
374
swift::Mangle::ASTMangler mangler;
360
375
};
You can’t perform that action at this time.
0 commit comments