diff options
Diffstat (limited to 'graphics/asymptote/fundec.cc')
-rw-r--r-- | graphics/asymptote/fundec.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/graphics/asymptote/fundec.cc b/graphics/asymptote/fundec.cc index ed82463c2e..997161f882 100644 --- a/graphics/asymptote/fundec.cc +++ b/graphics/asymptote/fundec.cc @@ -22,7 +22,9 @@ varinit *Default=new definit(nullPos); void formal::prettyprint(ostream &out, Int indent) { - prettyname(out, keywordOnly ? "formal (keyword only)" : "formal", indent, getPos()); + prettyname( + out, keywordOnly ? "formal (keyword only)" : "formal", indent, getPos() + ); base->prettyprint(out, indent+1); if (start) start->prettyprint(out, indent+1); @@ -115,6 +117,14 @@ void formals::addOps(coenv &e, record *r) rest->addOps(e, r); } +mem::vector<tySymbolPair> *formals::getFields() { + auto *lst = new mem::vector<tySymbolPair>(); + for (auto frml : fields) { + lst->emplace_back(frml->getAbsyntaxType(), frml->getName()); + } + return lst; +} + // Another helper class. Does an assignment, but relying only on the // destination for the type. class basicAssignExp : public exp { @@ -194,7 +204,9 @@ std::pair<std::string, optional<std::string>> formal::fnInfo() const { std::string typeName(static_cast<std::string>(*base)); return start != nullptr ? - std::make_pair(typeName, make_optional(static_cast<std::string>(start->getName()))) : + std::make_pair(typeName, + make_optional(static_cast<std::string>(start->getName())) + ) : std::make_pair(typeName, nullopt); } #endif @@ -356,7 +368,9 @@ types::ty *fundef::trans(coenv &e) { void fundef::createSymMap(AsymptoteLsp::SymbolContext* symContext) { #ifdef HAVE_LSP - auto* declCtx(symContext->newContext<AsymptoteLsp::AddDeclContexts>(getPos().LineColumn())); + auto* declCtx(symContext->newContext<AsymptoteLsp::AddDeclContexts>( + getPos().LineColumn() + )); params->createSymMap(declCtx); body->createSymMap(declCtx); #endif @@ -386,9 +400,11 @@ void fundec::transAsField(coenv &e, record *r) void fundec::createSymMap(AsymptoteLsp::SymbolContext* symContext) { #ifdef HAVE_LSP - AsymptoteLsp::FunctionInfo& fnInfo=symContext->symMap.addFunDef(static_cast<std::string>(id), - getPos().LineColumn(), - static_cast<std::string>(*fun.result)); + AsymptoteLsp::FunctionInfo& fnInfo= + symContext->symMap.addFunDef(static_cast<std::string>(id), + getPos().LineColumn(), + static_cast<std::string>(*fun.result) + ); fun.addArgumentsToFnInfo(fnInfo); fun.createSymMap(symContext); #endif |