Home
last modified time | relevance | path

Searched +full:parserprogram +full:- (Results 1 – 25 of 61) sorted by relevance

123

/arkcompiler/ets_frontend/ets2panda/test/unit/lsp/
Disolated_declaration.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
55 auto checker = reinterpret_cast<ark::es2panda::checker::ETSChecker *>(ctx->checker); in TEST_F()
56 auto ast = ctx->parserProgram->Ast(); in TEST_F()
57 auto id = ast->FindChild([](ark::es2panda::ir::AstNode *childNode) { in TEST_F()
58 return childNode->IsIdentifier() && childNode->AsIdentifier()->Name() == "foo"; in TEST_F()
60 … textChange = ark::es2panda::lsp::ProcessIdentifier(id->AsIdentifier(), checker, ctx->parserProgra… in TEST_F()
94 auto checker = reinterpret_cast<ark::es2panda::checker::ETSChecker *>(ctx->checker); in TEST_F()
95 auto ast = ctx->parserProgram->Ast(); in TEST_F()
96 auto id = ast->FindChild([](ark::es2panda::ir::AstNode *childNode) { in TEST_F()
97 return childNode->IsIdentifier() && childNode->AsIdentifier()->Name() == "foo"; in TEST_F()
[all …]
Dquick_info_test_1.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
29 … initializer.CreateContext("enum-test.ets", ES2PANDA_STATE_CHECKED, "enum MyEnum { A, B, C }"); in TEST_F()
32 auto ast = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
34 return node->Type() == ark::es2panda::ir::AstNodeType::CLASS_DEFINITION && in TEST_F()
35 node->AsClassDefinition()->Ident()->Name() == "MyEnum"; in TEST_F()
37 auto found = ast->FindChild(checkFunc); in TEST_F()
38 auto enumDecl = found->AsClassDefinition()->OrigEnumDecl()->AsTSEnumDeclaration(); in TEST_F()
52 initializer.CreateContext("quick-info-test.ets", ES2PANDA_STATE_CHECKED, in TEST_F()
58 auto ast = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
60 return node->Type() == ark::es2panda::ir::AstNodeType::CLASS_DECLARATION && in TEST_F()
[all …]
Dchange_tracker_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
63 auto sourceFile = context->sourceFile; in TEST_F()
66 …context->parserProgram->Ast()->FindChild([](const auto *node) { return node->IsReturnStatement(); … in TEST_F()
69 auto spanStart = returnNode->Start().index; in TEST_F()
72 std::string retStr = "return a - b;"; in TEST_F()
103 const auto sourceFile = context->sourceFile; in TEST_F()
104 ark::es2panda::ir::AstNode *ast = context->parserProgram->Ast(); in TEST_F()
111 ast->FindChild([&ca, &aDecl](ark::es2panda::ir::AstNode *node) { in TEST_F()
112 if (node->IsVariableDeclaration() && in TEST_F()
113 node->AsVariableDeclaration()->Declarators()[c0]->Id()->AsIdentifier()->Name() == ca) { in TEST_F()
[all …]
Dcreate_type_help_items_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0*
49 auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
51 astNode->FindChild([&list](const ark::es2panda::ir::AstNode *child) { in TEST_F()
76 auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
78 astNode->FindChild([&list](const ark::es2panda::ir::AstNode *child) { in TEST_F()
101 auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
103 astNode->FindChild([&list](const ark::es2panda::ir::AstNode *child) { in TEST_F()
140 … auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
143 astNode->FindChild([&typeParameters, &result](const ark::es2panda::ir::AstNode *child) { in TEST_F()
144 if (child->IsClassDeclaration()) { in TEST_F()
Dinlay_hints_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0*
57 auto *parent = reinterpret_cast<ark::es2panda::ir::AstNode *>(astContext->parserProgram->Ast()); in TEST_F()
61 parent->FindChild([&callExprNode, parent, &result](ark::es2panda::ir::AstNode *childNode) { in TEST_F()
62 if (childNode->IsCallExpression()) { in TEST_F()
127 …const auto *parent = reinterpret_cast<ark::es2panda::ir::AstNode *>(astContext->parserProgram->Ast… in TEST_F()
130 parent->FindChild([parent, &result](ark::es2panda::ir::AstNode *childNode) { in TEST_F()
131 if (childNode->IsAssignmentExpression()) { in TEST_F()
181 …const auto *parent = reinterpret_cast<ark::es2panda::ir::AstNode *>(astContext->parserProgram->Ast… in TEST_F()
184 parent->FindChild([&result](ark::es2panda::ir::AstNode *childNode) { in TEST_F()
185 if (childNode->IsMethodDefinition()) { in TEST_F()
[all …]
Dlsp_rename_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
34 …es2panda_Context *ctx = initializer.CreateContext("trigger-span-literal.ets", ES2PANDA_STATE_CHECK… in TEST_F()
39 auto targetNode = ast->FindChild([](ark::es2panda::ir::AstNode *node) { in TEST_F()
40 return node->IsNumberLiteral() && node->AsNumberLiteral()->Str() == "1234"; in TEST_F()
56 …es2panda_Context *ctx = initializer.CreateContext("trigger-span-string-literal.ets", ES2PANDA_STAT… in TEST_F()
61 auto targetNode = ast->FindChild([](ark::es2panda::ir::AstNode *node) { in TEST_F()
62 return node->IsStringLiteral() && node->AsStringLiteral()->Str() == "hello"; in TEST_F()
79 …initializer.CreateContext("trigger-span-empty-string.ets", ES2PANDA_STATE_CHECKED, "let emptyStr =… in TEST_F()
83 auto targetNode = ast->FindChild([](ark::es2panda::ir::AstNode *node) { in TEST_F()
84 return node->IsStringLiteral() && node->AsStringLiteral()->Str() == ""; in TEST_F()
[all …]
Dget_completions_entry_details.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
40 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details.ets", ctx, offset); in TEST_F()
71 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details1.ets", ctx, offset); in TEST_F()
104 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details2.ets", ctx, offset); in TEST_F()
141 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details9.ets", ctx, offset); in TEST_F()
179 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details10.ets", ctx, offset); in TEST_F()
224 lspApi->getCompletionEntryDetails(entryName, "completion_entry_details11.ets", ctx, offset); in TEST_F()
264 auto ast = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
268 auto found = ast->FindChild(checkFunc); in TEST_F()
269 auto targetNode = ark::es2panda::compiler::DeclarationFromIdentifier(found->AsIdentifier()); in TEST_F()
[all …]
Dformatting_context_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0*
51 auto program = contextPtr->parserProgram; in TEST_F()
79 auto program = contextPtr->parserProgram; in TEST_F()
Dget_file_references_impl_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
54 auto isPackageModule = reinterpret_cast<Context *>(ctx)->parserProgram->IsPackage(); in TEST_F()
103 auto isPackageModule = reinterpret_cast<Context *>(ctx)->parserProgram->IsPackage(); in TEST_F()
130 std::vector<std::string> files = {"package-module.ets"}; in TEST_F()
142 auto baseUrl = reinterpret_cast<Context *>(ctx)->config->options->ArkTSConfig()->BaseUrl(); in TEST_F()
Dlsp_api_test.h7 * http://www.apache.org/licenses/LICENSE-2.0
35 return s->state; in ContextState()
42 auto ast = reinterpret_cast<Ast *>(ctx->parserProgram->Ast()); in GetAstFromContext()
79 // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
82 // NOLINTEND(misc-non-private-member-variables-in-classes)
Dsignature_help_items_test.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
42 if (tokenAtPosition->Start().index < position && tokenAtPosition->End().index > position) { in FindTokenOnLeftOfPosition()
46 …return ark::es2panda::lsp::FindPrecedingToken(position, ctx->parserProgram->Ast(), ctx->allocator); in FindTokenOnLeftOfPosition()
102 const auto callExpr = callToken->Parent(); in TEST_F()
104 auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
107 ASSERT_TRUE(callExpr->IsCallExpression()); in TEST_F()
138 const auto callee = callToken->Parent(); in TEST_F()
142 auto astNode = reinterpret_cast<ark::es2panda::ir::AstNode *>(context->parserProgram->Ast()); in TEST_F()
175 const auto callNode = callToken->Parent(); in TEST_F()
178 ASSERT_TRUE(callNode->IsCallExpression()); in TEST_F()
[all …]
/arkcompiler/ets_frontend/ets2panda/lsp/src/
Dreferences.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
28 switch (astNode->Type()) { in IsValidReference()
38 if (astNode == nullptr || !astNode->IsIdentifier()) { in GetDeclInfoImpl()
41 auto declNode = compiler::DeclarationFromIdentifier(astNode->AsIdentifier()); in GetDeclInfoImpl()
44 if (node->IsETSModule()) { in GetDeclInfoImpl()
45 auto name = std::string(node->AsETSModule()->Program()->SourceFilePath()); in GetDeclInfoImpl()
46 return std::make_tuple(name, declNode->DumpEtsSrc()); in GetDeclInfoImpl()
48 node = node->Parent(); in GetDeclInfoImpl()
60 if (ctx->parserProgram == nullptr || ctx->parserProgram->Ast() == nullptr) { in GetReferencesAtPositionImpl()
63 auto astNode = reinterpret_cast<ir::AstNode *>(ctx->parserProgram->Ast()); in GetReferencesAtPositionImpl()
[all …]
Dorganize_imports.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
30 auto *ast = context->parserProgram->Ast(); in IsImportUsed()
33 ast->FindChild([&](ir::AstNode *node) { in IsImportUsed()
34 if (node->IsETSImportDeclaration() || node->IsImportSpecifier()) { in IsImportUsed()
39 if (node->IsTSQualifiedName()) { in IsImportUsed()
40 auto *qname = node->AsTSQualifiedName(); in IsImportUsed()
41 found = qname->Left()->IsIdentifier() && in IsImportUsed()
42 (std::string(qname->Left()->AsIdentifier()->Name()) == spec.localName); in IsImportUsed()
46 if (node->IsMemberExpression()) { in IsImportUsed()
47 auto *member = node->AsMemberExpression(); in IsImportUsed()
[all …]
Dinternal_api.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
49 cfg_ = impl_->CreateConfig(argv.size(), argv.data()); in Initializer()
56 impl_->DestroyConfig(cfg_); in ~Initializer()
65 if (ctx->parserProgram == nullptr || ctx->parserProgram->Ast() == nullptr) { in GetTouchingToken()
68 auto ast = reinterpret_cast<ir::AstNode *>(ctx->parserProgram->Ast()); in GetTouchingToken()
69 …auto checkFunc = [&pos](ir::AstNode *node) { return pos >= node->Start().index && pos < node->End(… in GetTouchingToken()
70 auto found = ast->FindChild(checkFunc); in GetTouchingToken()
72 auto *nestedFound = found->FindChild(checkFunc); in GetTouchingToken()
93 ss << textStr.substr(start, pos - start); in FormatStringFromArgs()
99 std::string placeholder = textStr.substr(pos, end - pos + 1); in FormatStringFromArgs()
[all …]
Dget_definition_and_bound_span.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
29 auto statements = ctx->parserProgram->Ast()->Statements(); in GetDefinitionAndBoundSpan()
30 const auto definitions = lspApi->getDefinitionAtPosition(referenceFileContext, offset); in GetDefinitionAndBoundSpan()
Dline_column_offset.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
36 auto program = ctx->parserProgram; in ToLineColumnOffset()
37 lexer::LineIndex index(program->SourceCode()); in ToLineColumnOffset()
38 auto pos = node->Start(); in ToLineColumnOffset()
Dclass_hierarchy.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
32 if (node->IsClassDeclaration()) { in GetHierarchyDeclarationFileName()
33 if (node->AsClassDeclaration()->Definition()->Ident()->Range().start.Program() == nullptr) { in GetHierarchyDeclarationFileName()
36 …return std::string(node->AsClassDeclaration()->Definition()->Ident()->Range().start.Program()->Abs… in GetHierarchyDeclarationFileName()
38 if (node->IsTSInterfaceDeclaration()) { in GetHierarchyDeclarationFileName()
39 if (node->AsTSInterfaceDeclaration()->Id()->Range().start.Program() == nullptr) { in GetHierarchyDeclarationFileName()
42 …return std::string(node->AsTSInterfaceDeclaration()->Id()->Range().start.Program()->AbsoluteName()… in GetHierarchyDeclarationFileName()
52 if (node->IsClassDeclaration()) { in GetHierarchyDeclarationName()
53 return std::string(node->AsClassDeclaration()->Definition()->Ident()->Name()); in GetHierarchyDeclarationName()
55 if (node->IsTSInterfaceDeclaration()) { in GetHierarchyDeclarationName()
[all …]
Dgenerate_constructor.cpp7 * http://www.apache.org/licenses/LICENSE-2.0*
28 size_t start = classNode->Start().index; in HasConstructorNode()
29 size_t end = classNode->End().index; in HasConstructorNode()
30 ir::AstNode *constructorNode = classNode->FindChild([start, end](ir::AstNode *node) { in HasConstructorNode()
34 return node->Start().index >= start && node->End().index <= end && node->IsConstructor(); in HasConstructorNode()
43 auto bodyNodes = classNode->AsClassDeclaration()->Definition()->Body(); in GetClassProperties()
47 if (node->IsStatic() || !node->IsClassProperty()) { in GetClassProperties()
64 auto baseNodeBody = baseNode->AsClassDeclaration()->Definition()->Body(); in GetExtendedClassProperties()
66 if (!node->IsClassProperty()) { in GetExtendedClassProperties()
69 auto tmp = node->AsClassProperty(); in GetExtendedClassProperties()
[all …]
Dfind_references.cpp7 * http://www.apache.org/licenses/LICENSE-2.0*
38 if (!node->IsIdentifier()) { in GetIdentifier()
39 … return node->FindChild([](ark::es2panda::ir::AstNode *child) { return child->IsIdentifier(); }); in GetIdentifier()
50 return std::string {id->AsIdentifier()->Name()}; in GetIdentifierName()
59 return GetIdentifier(ark::es2panda::compiler::DeclarationFromIdentifier(id->AsIdentifier())); in GetOwner()
73 if (program->Ast() == node->GetTopStatement()) { in GetLocationId()
74 absPath = std::string {program->AbsoluteName()}; in GetLocationId()
76 auto externals = program->DirectExternalSources(); in GetLocationId()
77 auto top = node->GetTopStatement(); in GetLocationId()
80 auto programAbsPath = std::string {p->AbsoluteName()}; in GetLocationId()
[all …]
/arkcompiler/ets_frontend/ets2panda/lsp/src/formatting/
Dformatting_context.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
38 if (ctx->parserProgram == nullptr || ctx->parserProgram->Ast() == nullptr) { in UpdateContext()
42 contextNode_ = reinterpret_cast<ir::AstNode *>(ctx->parserProgram->Ast()); in UpdateContext()
48 currentTokenParent_ = current->Parent(); in UpdateContext()
50 nextTokenParent_ = GetTouchingToken(context, nextToken.start.index, false)->Parent(); in UpdateContext()
90 return node->Start().line == node->End().line; in NodeIsOnOneLine()
99 …auto nodeChild = node->FindChild([](ir::AstNode *astnode) { return CheckNodeKindForBraceMatching(a… in BlockIsOnOneLine()
/arkcompiler/ets_frontend/ets2panda/public/
Des2panda_lib.cpp2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
70 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in StrToToken()
71 for (auto *tp = table; tp->str != nullptr; tp++) { in StrToToken()
72 if (strcmp(str, tp->str) == 0) { in StrToToken()
73 return tp->token; in StrToToken()
81 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in TokenToStr()
82 for (auto *tp = table; tp->str != nullptr; tp++) { in TokenToStr()
83 if (tp->token == token) { in TokenToStr()
84 return tp->str; in TokenToStr()
[all …]
/arkcompiler/ets_frontend/ets2panda/compiler/lowering/
DresolveIdentifiers.cpp7 * http://www.apache.org/licenses/LICENSE-2.0
24 auto const *options = ctx->config->options; in Perform()
25 auto *varbinder = ctx->parserProgram->VarBinder()->AsETSBinder(); in Perform()
27 if (options->IsDumpAst()) { in Perform()
28 std::cout << varbinder->Program()->Dump() << std::endl; in Perform()
31 if (options->IsDumpAstOnlySilent()) { in Perform()
32 varbinder->Program()->DumpSilent(); in Perform()
35 if (options->IsParseOnly()) { in Perform()
39 varbinder->SetGenStdLib(options->GetCompilationMode() == CompilationMode::GEN_STD_LIB); in Perform()
40 varbinder->IdentifierAnalysis(); in Perform()
DcheckerPhase.cpp2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
22 for (auto [_, programList] : program->ExternalSources()) { in Perform()
24 for (auto stmt : prog->Ast()->Statements()) { in Perform()
25 stmt->AddAstNodeFlags(ir::AstNodeFlags::NOCLEANUP); in Perform()
29 for (auto stmt : program->Ast()->Statements()) { in Perform()
30 stmt->AddAstNodeFlags(ir::AstNodeFlags::NOCLEANUP); in Perform()
32 …auto checkerResult = ctx->checker->StartChecker(ctx->parserProgram->VarBinder(), *ctx->config->opt… in Perform()
33 return program->Extension() == ScriptExtension::ETS ? true : checkerResult; in Perform()
/arkcompiler/ets_frontend/ets2panda/compiler/core/
DcompilerImpl.cpp2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
59 auto *emitter = context->emitter; in HandleContextLiterals()
62 for (const auto &buff : context->contextLiterals) { in HandleContextLiterals()
63 emitter->AddLiteralBuffer(buff, index++); in HandleContextLiterals()
66 emitter->LiteralBufferIndex() += context->contextLiterals.size(); in HandleContextLiterals()
77 auto *emitter = context->emitter; in Emit()
78 … queue_.Wait([emitter](CompileJob *job) { emitter->AddProgramElement(job->GetProgramElement()); }); in Emit()
80 return emitter->Finalize(context->config->options->IsDumpDebugInfo(), Signatures::ETS_GLOBAL); in Emit()
87 compiler::ProgramElement *programElement) -> void { in MakeCompileJob()
[all …]
/arkcompiler/ets_frontend/ets2panda/compiler/lowering/ets/
DoptionalLowering.cpp2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
36 auto *const allocator = ctx->allocator; in LowerOptionalExpr()
37 auto *const parser = ctx->parser->AsETSParser(); in LowerOptionalExpr()
38 auto *const varbinder = ctx->parserProgram->VarBinder(); in LowerOptionalExpr()
43 auto *tmpIdentClone = tmpIdent->Clone(allocator, nullptr); in LowerOptionalExpr()
46 auto *sequenceExpr = parser->CreateFormattedExpression( in LowerOptionalExpr()
50 sequenceExpr->SetParent(chain->Parent()); in LowerOptionalExpr()
51 InitScopesPhaseETS::RunExternalNode(sequenceExpr, ctx->parserProgram->VarBinder()); in LowerOptionalExpr()
53 auto const &stmts = sequenceExpr->AsBlockExpression()->Statements(); in LowerOptionalExpr()
[all …]

123