MCPcopy Create free account
hub / github.com/KDE/kdevelop / createObject

Method createObject

plugins/qmljs/duchain/frameworks/nodejs.cpp:52–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void NodeJS::createObject(const QString& name, int index, DeclarationBuilder* builder)
53{
54 Identifier identifier(name);
55
56 StructureType::Ptr type(new StructureType);
57 auto* decl = builder->openDeclaration<Declaration>(identifier, RangeInRevision());
58
59 type->setDeclaration(decl);
60 decl->setAlwaysForceDirect(true);
61 decl->setKind(Declaration::Type); // Not exactly what the user would expect, but this ensures that QmlJS::getInternalContext does not recurse infinitely
62 decl->setInternalContext(builder->openContext(
63 (QmlJS::AST::Node*)nullptr + index, // Index is used to disambiguate the contexts. "node" is never dereferenced and is only stored in a hash table
64 RangeInRevision(),
65 DUContext::Class,
66 QualifiedIdentifier(identifier)
67 ));
68
69 builder->closeContext();
70 builder->openType(type);
71 builder->closeAndAssignType();
72}
73
74DeclarationPointer NodeJS::moduleExports(const QString& moduleName, const IndexedString& url)
75{

Callers

nothing calls this directly

Calls 10

setAlwaysForceDirectMethod · 0.80
setInternalContextMethod · 0.80
openTypeMethod · 0.80
closeAndAssignTypeMethod · 0.80
RangeInRevisionClass · 0.50
QualifiedIdentifierClass · 0.50
setDeclarationMethod · 0.45
setKindMethod · 0.45
openContextMethod · 0.45
closeContextMethod · 0.45

Tested by

no test coverage detected