| 50 | } |
| 51 | |
| 52 | void 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 | |
| 74 | DeclarationPointer NodeJS::moduleExports(const QString& moduleName, const IndexedString& url) |
| 75 | { |
nothing calls this directly
no test coverage detected