• Home
  • Raw
  • Download

Lines Matching +full:parserprogram +full:-

2  * 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()
92 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in StringViewToCString()
97 char *res = reinterpret_cast<char *>(allocator->Alloc(utf8.size() + 1)); in StringViewToCString()
104 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in StringViewToCString()
114 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in StdStringToCString()
115 char *res = reinterpret_cast<char *>(allocator->Alloc(str.length() + 1)); in StdStringToCString()
119 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in StdStringToCString()
130 // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) in EnumMemberResultToEs2pandaVariant()
131 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in EnumMemberResultToEs2pandaVariant()
148 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in EnumMemberResultToEs2pandaVariant()
149 // NOLINTEND(cppcoreguidelines-pro-type-union-access) in EnumMemberResultToEs2pandaVariant()
155 auto import = reinterpret_cast<const es2panda_AstNode *>(dynamicImportData->import); in DynamicImportDataToE2pPtr()
156 auto specifier = reinterpret_cast<const es2panda_AstNode *>(dynamicImportData->specifier); in DynamicImportDataToE2pPtr()
157 auto variable = reinterpret_cast<es2panda_Variable *>(dynamicImportData->variable); in DynamicImportDataToE2pPtr()
158 auto es2pandaDynamicImportData = allocator->New<es2panda_DynamicImportData>(); in DynamicImportDataToE2pPtr()
159 es2pandaDynamicImportData->import = import; in DynamicImportDataToE2pPtr()
160 es2pandaDynamicImportData->specifier = specifier; in DynamicImportDataToE2pPtr()
161 es2pandaDynamicImportData->variable = variable; in DynamicImportDataToE2pPtr()
181 auto es2pandaOverloadInfo = allocator->New<es2panda_OverloadInfo>(); in OverloadInfoToE2pPtr()
182 es2pandaOverloadInfo->minArg = overloadInfo->minArg; in OverloadInfoToE2pPtr()
183 es2pandaOverloadInfo->maxArg = overloadInfo->maxArg; in OverloadInfoToE2pPtr()
184 es2pandaOverloadInfo->needHelperOverload = overloadInfo->needHelperOverload; in OverloadInfoToE2pPtr()
185 es2pandaOverloadInfo->isDeclare = overloadInfo->isDeclare; in OverloadInfoToE2pPtr()
186 es2pandaOverloadInfo->hasRestVar = overloadInfo->hasRestVar; in OverloadInfoToE2pPtr()
187 es2pandaOverloadInfo->returnVoid = overloadInfo->returnVoid; in OverloadInfoToE2pPtr()
205 return ir::JsDocRecord(jsDocRecord->name, jsDocRecord->param, jsDocRecord->comment); in JsDocRecordToE2p()
211 es2panda_JsDocRecord *res = allocator->New<es2panda_JsDocRecord>(); in JsDocRecordFromE2p()
212 res->name = StringViewToCString(allocator, jsDocRecord.name); in JsDocRecordFromE2p()
213 res->param = StringViewToCString(allocator, jsDocRecord.param); in JsDocRecordFromE2p()
214 res->comment = StringViewToCString(allocator, jsDocRecord.comment); in JsDocRecordFromE2p()
221 es2panda_JsDocInfo *res = allocator->New<es2panda_JsDocInfo>(); in JsDocInfoFromE2p()
222 res->len = jsDocInfoLen; in JsDocInfoFromE2p()
223 res->strings = allocator->New<char *[]>(jsDocInfoLen); in JsDocInfoFromE2p()
224 res->jsDocRecords = allocator->New<es2panda_JsDocRecord *[]>(jsDocInfoLen); in JsDocInfoFromE2p()
227 res->strings[i] = StringViewToCString(allocator, key); in JsDocInfoFromE2p()
228 res->jsDocRecords[i] = JsDocRecordFromE2p(allocator, value); in JsDocInfoFromE2p()
237 char *res = reinterpret_cast<char *>(allocator->Alloc(len + 1)); in ArenaStrdup()
241 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in ArenaStrdup()
252 if (!options->Parse(Span(argv, args))) { in CreateConfig()
257 ark::Logger::InitializeStdLogging(options->LogLevel(), mask); in CreateConfig()
260 res->options = options; in CreateConfig()
261 res->diagnosticEngine = diagnosticEngine; in CreateConfig()
275 delete cfg->options; in DestroyConfig()
276 cfg->diagnosticEngine->FlushDiagnostic(); in DestroyConfig()
277 delete cfg->diagnosticEngine; in DestroyConfig()
285 ES2PANDA_ASSERT(ctx->config != nullptr); in GetAllErrorMessages()
286 ES2PANDA_ASSERT(ctx->allocator != nullptr); in GetAllErrorMessages()
287 auto *cfg = reinterpret_cast<ConfigImpl *>(ctx->config); in GetAllErrorMessages()
289 ES2PANDA_ASSERT(cfg->diagnosticEngine != nullptr); in GetAllErrorMessages()
290 auto allMessages = cfg->diagnosticEngine->PrintAndFlushErrorDiagnostic(); in GetAllErrorMessages()
292 char *cStringMessages = reinterpret_cast<char *>(ctx->allocator->Alloc(bufferSize)); in GetAllErrorMessages()
300 auto options = reinterpret_cast<ConfigImpl *>(config)->options; in ConfigGetOptions()
317 res->phaseManager = new compiler::PhaseManager(ScriptExtension::ETS, res->allocator); in InitializeContext()
318 res->queue = new compiler::CompileQueue(res->config->options->GetThread()); in InitializeContext()
320 auto *varbinder = res->allocator->New<varbinder::ETSBinder>(res->allocator); in InitializeContext()
321 res->parserProgram = res->allocator->New<parser::Program>(res->allocator, varbinder); in InitializeContext()
322 …res->parser = new parser::ETSParser(res->parserProgram, *res->config->options, *res->diagnosticEng… in InitializeContext()
324 res->parser->SetContext(res); in InitializeContext()
326 res->checker = res->allocator->New<checker::ETSChecker>(*res->diagnosticEngine, res->allocator); in InitializeContext()
327 res->analyzer = res->allocator->New<checker::ETSAnalyzer>(res->checker); in InitializeContext()
328 res->checker->SetAnalyzer(res->analyzer); in InitializeContext()
330 varbinder->SetProgram(res->parserProgram); in InitializeContext()
331 varbinder->SetContext(res); in InitializeContext()
332 res->codeGenCb = CompileJob; in InitializeContext()
333 res->emitter = new compiler::ETSEmitter(res); in InitializeContext()
334 res->program = nullptr; in InitializeContext()
335 res->state = ES2PANDA_STATE_NEW; in InitializeContext()
344 res->errorMessage = "Config is nullptr."; in InitContext()
345 res->state = ES2PANDA_STATE_ERROR; in InitContext()
349 if (cfg->options->GetExtension() != ScriptExtension::ETS) { in InitContext()
350 res->errorMessage = "Invalid extension. Plugin API supports only ETS."; in InitContext()
351 res->state = ES2PANDA_STATE_ERROR; in InitContext()
352 res->diagnosticEngine = cfg->diagnosticEngine; in InitContext()
356 res->config = cfg; in InitContext()
357 res->diagnosticEngine = cfg->diagnosticEngine; in InitContext()
365 if (res->state == ES2PANDA_STATE_ERROR) { in CreateContext()
370 res->input = std::move(source); in CreateContext()
371 res->sourceFileName = fileName; in CreateContext()
372 res->sourceFile = new SourceFile(res->sourceFileName, res->input, cfg->options->IsModule()); in CreateContext()
373 res->allocator = new ArenaAllocator(SpaceType::SPACE_TYPE_COMPILER, nullptr, true); in CreateContext()
374 res->queue = new compiler::CompileQueue(cfg->options->GetThread()); in CreateContext()
376 auto *varbinder = res->allocator->New<varbinder::ETSBinder>(res->allocator); in CreateContext()
377 res->parserProgram = new parser::Program(res->allocator, varbinder); in CreateContext()
378 res->diagnosticEngine = cfg->diagnosticEngine; in CreateContext()
379 res->parser = in CreateContext()
380 …new parser::ETSParser(res->parserProgram, *cfg->options, *cfg->diagnosticEngine, parser::ParserSta… in CreateContext()
381 res->parser->SetContext(res); in CreateContext()
382 res->checker = new checker::ETSChecker(*res->diagnosticEngine); in CreateContext()
383 …res->isolatedDeclgenChecker = new checker::IsolatedDeclgenChecker(*res->diagnosticEngine, *(res->p… in CreateContext()
384 res->analyzer = new checker::ETSAnalyzer(res->checker); in CreateContext()
385 res->checker->SetAnalyzer(res->analyzer); in CreateContext()
387 varbinder->SetProgram(res->parserProgram); in CreateContext()
389 varbinder->SetContext(res); in CreateContext()
390 res->codeGenCb = CompileJob; in CreateContext()
391 res->phaseManager = new compiler::PhaseManager(ScriptExtension::ETS, res->allocator); in CreateContext()
392 res->emitter = new compiler::ETSEmitter(res); in CreateContext()
393 res->program = nullptr; in CreateContext()
394 res->state = ES2PANDA_STATE_NEW; in CreateContext()
405 res->errorMessage = "Failed to open file: "; in CreateContextFromFile()
406 res->errorMessage.append(sourceFileName); in CreateContextFromFile()
413 res->errorMessage = "Failed to read file: "; in CreateContextFromFile()
414 res->errorMessage.append(sourceFileName); in CreateContextFromFile()
437 if (res->state == ES2PANDA_STATE_ERROR) { in CreateContextGenerateAbcForExternalSourceFiles()
442 ES2PANDA_ASSERT(cfg->options->IsSimultaneous()); in CreateContextGenerateAbcForExternalSourceFiles()
446 res->sourceFileNames.emplace_back(std::move(fileName)); in CreateContextGenerateAbcForExternalSourceFiles()
449 res->input = ""; in CreateContextGenerateAbcForExternalSourceFiles()
450 res->sourceFileName = ""; in CreateContextGenerateAbcForExternalSourceFiles()
451 res->sourceFile = new SourceFile(res->sourceFileName, res->input, cfg->options->IsModule()); in CreateContextGenerateAbcForExternalSourceFiles()
452 res->allocator = new ArenaAllocator(SpaceType::SPACE_TYPE_COMPILER, nullptr, true); in CreateContextGenerateAbcForExternalSourceFiles()
460 if (ctx->state != ES2PANDA_STATE_NEW) { in Parse()
461 ctx->state = ES2PANDA_STATE_ERROR; in Parse()
462 ctx->errorMessage = "Bad state at entry to Parse, needed NEW"; in Parse()
466 if (ctx->config->options->IsSimultaneous()) { in Parse()
468 …std::unordered_set<std::string> sourceFileNamesSet(ctx->sourceFileNames.begin(), ctx->sourceFileNa… in Parse()
469 ctx->MarkGenAbcForExternal(sourceFileNamesSet, ctx->parserProgram->ExternalSources()); in Parse()
471 ctx->parser->ParseScript(*ctx->sourceFile, in Parse()
472 … ctx->config->options->GetCompilationMode() == CompilationMode::GEN_STD_LIB); in Parse()
474 ctx->state = ES2PANDA_STATE_PARSED; in Parse()
482 for (auto &[_, extPrograms] : context->externalSources) { in SetProgramGenAbc()
485 if (prog->AbsoluteName() == pathView) { in SetProgramGenAbc()
486 prog->SetGenAbcForExternalSources(); in SetProgramGenAbc()
496 if (ctx->state < ES2PANDA_STATE_PARSED) { in Bind()
499 if (ctx->state == ES2PANDA_STATE_ERROR) { in Bind()
503 ES2PANDA_ASSERT(ctx->state == ES2PANDA_STATE_PARSED); in Bind()
504 while (auto phase = ctx->phaseManager->NextPhase()) { in Bind()
505 if (phase->Name() == "plugins-after-bind") { in Bind()
508 phase->Apply(ctx, ctx->parserProgram); in Bind()
510 ctx->state = ES2PANDA_STATE_BOUND; in Bind()
516 if (ctx->state < ES2PANDA_STATE_PARSED) { in Check()
520 if (ctx->state == ES2PANDA_STATE_ERROR) { in Check()
524 ES2PANDA_ASSERT(ctx->state >= ES2PANDA_STATE_PARSED && ctx->state < ES2PANDA_STATE_CHECKED); in Check()
525 while (auto phase = ctx->phaseManager->NextPhase()) { in Check()
526 if (phase->Name() == "plugins-after-check") { in Check()
529 phase->Apply(ctx, ctx->parserProgram); in Check()
531 … ctx->state = !ctx->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_CHECKED : ES2PANDA_STATE_ERROR; in Check()
537 if (ctx->state < ES2PANDA_STATE_CHECKED) { in Lower()
541 if (ctx->state == ES2PANDA_STATE_ERROR) { in Lower()
545 ES2PANDA_ASSERT(ctx->state == ES2PANDA_STATE_CHECKED); in Lower()
546 while (auto phase = ctx->phaseManager->NextPhase()) { in Lower()
547 phase->Apply(ctx, ctx->parserProgram); in Lower()
549 … ctx->state = !ctx->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_LOWERED : ES2PANDA_STATE_ERROR; in Lower()
555 if (ctx->state < ES2PANDA_STATE_LOWERED) { in GenerateAsm()
559 if (ctx->state == ES2PANDA_STATE_ERROR) { in GenerateAsm()
563 ES2PANDA_ASSERT(ctx->state == ES2PANDA_STATE_LOWERED); in GenerateAsm()
565 auto *emitter = ctx->emitter; in GenerateAsm()
566 emitter->GenAnnotation(); in GenerateAsm()
570 for (const auto &buff : ctx->contextLiterals) { in GenerateAsm()
571 emitter->AddLiteralBuffer(buff, index++); in GenerateAsm()
574 emitter->LiteralBufferIndex() += ctx->contextLiterals.size(); in GenerateAsm()
577 ctx->queue->Schedule(ctx); in GenerateAsm()
578 ctx->queue->Consume(); in GenerateAsm()
579 …ctx->queue->Wait([emitter](compiler::CompileJob *job) { emitter->AddProgramElement(job->GetProgram… in GenerateAsm()
580 ES2PANDA_ASSERT(ctx->program == nullptr); in GenerateAsm()
581 …ctx->program = emitter->Finalize(ctx->config->options->IsDumpDebugInfo(), compiler::Signatures::ET… in GenerateAsm()
582 …ctx->state = !ctx->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_ASM_GENERATED : ES2PANDA_STATE_… in GenerateAsm()
588 if (ctx->state < ES2PANDA_STATE_ASM_GENERATED) { in GenerateBin()
592 if (ctx->state == ES2PANDA_STATE_ERROR) { in GenerateBin()
596 ES2PANDA_ASSERT(ctx->state == ES2PANDA_STATE_ASM_GENERATED); in GenerateBin()
598 ES2PANDA_ASSERT(ctx->program != nullptr); in GenerateBin()
599 util::GenerateProgram(ctx->program, *ctx->config->options, in GenerateBin()
601 ctx->diagnosticEngine->LogDiagnostic(kind, params); in GenerateBin()
603 …ctx->state = !ctx->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_BIN_GENERATED : ES2PANDA_STATE_… in GenerateBin()
633 ctx->errorMessage = "It does not make sense to request stage"; in ProceedToState()
634 ctx->state = ES2PANDA_STATE_ERROR; in ProceedToState()
643 delete ctx->program; in DestroyContext()
644 delete ctx->emitter; in DestroyContext()
645 delete ctx->analyzer; in DestroyContext()
646 delete ctx->checker; in DestroyContext()
647 delete ctx->parser; in DestroyContext()
648 delete ctx->parserProgram; in DestroyContext()
649 delete ctx->queue; in DestroyContext()
650 delete ctx->allocator; in DestroyContext()
651 delete ctx->sourceFile; in DestroyContext()
652 delete ctx->phaseManager; in DestroyContext()
659 return s->state; in ContextState()
665 return s->errorMessage.c_str(); in ContextErrorMessage()
671 return reinterpret_cast<es2panda_Program *>(ctx->parserProgram); in ContextProgram()
679 auto *vec = allocator->New<ArenaVector<ExternalSourceEntry *>>(allocator->Adapter()); in ExternalSourcesToE2p()
682 vec->push_back(allocator->New<ExternalSourceEntry>(StringViewToCString(allocator, e_name), in ExternalSourcesToE2p()
686 *lenP = vec->size(); in ExternalSourcesToE2p()
687 return reinterpret_cast<es2panda_ExternalSource **>(vec->data()); in ExternalSourcesToE2p()
693 return entry->first; in ExternalSourceName()
700 *lenP = entry->second->size(); in ExternalSourcePrograms()
701 return reinterpret_cast<es2panda_Program **>(entry->second->data()); in ExternalSourcePrograms()
708 …node->IterateRecursively([=](ir::AstNode *child) { func(reinterpret_cast<es2panda_AstNode *>(child… in AstNodeForEach()
714 auto &n = reinterpret_cast<ir::NumberLiteral *>(node)->Number(); \
716 /* CC-OFFNXT(G.PRE.05) function gen */ \
720 /* CC-OFFNXT(G.PRE.05) The macro is used to generate a function. */ \
735 auto allocator = reinterpret_cast<Context *>(ctx)->allocator; in SET_NUMBER_LITERAL_IMPL()
736 auto node = allocator->New<ir::NumberLiteral>(number); in SET_NUMBER_LITERAL_IMPL()
744 auto allocator = reinterpret_cast<Context *>(ctx)->allocator; in UpdateNumberLiteral()
745 auto node = allocator->New<ir::NumberLiteral>(number); in UpdateNumberLiteral()
747 node->SetOriginalNode(e2pOriginal); in UpdateNumberLiteral()
748 node->SetParent(e2pOriginal->Parent()); in UpdateNumberLiteral()
749 node->SetRange(e2pOriginal->Range()); in UpdateNumberLiteral()
755 auto str = reinterpret_cast<const ir::NumberLiteral *>(classInstance)->Str(); in NumberLiteralStrConst()
756 return StringViewToCString(reinterpret_cast<Context *>(context)->allocator, str); in NumberLiteralStrConst()
761 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in AllocMemory()
762 void *ptr = allocator->Alloc(numberOfElements * sizeOfElement); in AllocMemory()
768 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateSourcePosition()
770 …allocator->New<lexer::SourcePosition>(index, line, reinterpret_cast<Context *>(context)->parserPro… in CreateSourcePosition()
776 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateSourceRange()
779 …return reinterpret_cast<es2panda_SourceRange *>(allocator->New<lexer::SourceRange>(startE2p, endE2… in CreateSourceRange()
786 auto id = ctx->config->diagnosticKindStorage.size() + 1; in CreateDiagnosticKind()
793 ctx->config->diagnosticKindStorage.emplace_back(type, id, dmessage); in CreateDiagnosticKind()
794 …return reinterpret_cast<const es2panda_DiagnosticKind *>(&ctx->config->diagnosticKindStorage.back(… in CreateDiagnosticKind()
800 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateDiagnosticInfo()
801 auto diagnosticInfo = allocator->New<es2panda_DiagnosticInfo>(); in CreateDiagnosticInfo()
802 diagnosticInfo->kind = kind; in CreateDiagnosticInfo()
803 diagnosticInfo->args = args; in CreateDiagnosticInfo()
804 diagnosticInfo->argc = argc; in CreateDiagnosticInfo()
811 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateSuggestionInfo()
812 auto suggestionInfo = allocator->New<es2panda_SuggestionInfo>(); in CreateSuggestionInfo()
813 suggestionInfo->kind = kind; in CreateSuggestionInfo()
814 suggestionInfo->args = args; in CreateSuggestionInfo()
815 suggestionInfo->argc = argc; in CreateSuggestionInfo()
816 suggestionInfo->substitutionCode = substitutionCode; in CreateSuggestionInfo()
824 … auto diagnostickind = reinterpret_cast<const diagnostic::DiagnosticKind *>(diagnosticInfo->kind); in LogDiagnosticWithSuggestion()
825 … auto suggestionkind = reinterpret_cast<const diagnostic::DiagnosticKind *>(suggestionInfo->kind); in LogDiagnosticWithSuggestion()
827 for (size_t i = 0; i < diagnosticInfo->argc; ++i) { in LogDiagnosticWithSuggestion()
828 diagnosticParams.push_back(diagnosticInfo->args[i]); in LogDiagnosticWithSuggestion()
833 for (size_t i = 0; i < suggestionInfo->argc; ++i) { in LogDiagnosticWithSuggestion()
834 suggestionParams.push_back(suggestionInfo->args[i]); in LogDiagnosticWithSuggestion()
837 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in LogDiagnosticWithSuggestion()
839 auto posE2p = allocator->New<lexer::SourcePosition>(E2pRange->start); in LogDiagnosticWithSuggestion()
840 auto suggestion = ctx->diagnosticEngine->CreateSuggestion(suggestionkind, suggestionParams, in LogDiagnosticWithSuggestion()
841 … suggestionInfo->substitutionCode, E2pRange); in LogDiagnosticWithSuggestion()
842 ctx->diagnosticEngine->LogDiagnostic(*diagnostickind, diagnosticParams, *posE2p, suggestion); in LogDiagnosticWithSuggestion()
855 ctx->diagnosticEngine->LogDiagnostic(*kind, params, *posE2p); in LogDiagnostic()
862 …return reinterpret_cast<const es2panda_DiagnosticStorage *>(&ctx->diagnosticEngine->GetDiagnosticS… in GetDiagnostics()
892 return reinterpret_cast<Context *>(context)->diagnosticEngine->IsAnyError(); in IsAnyError()
897 return reinterpret_cast<lexer::SourcePosition *>(position)->index; in SourcePositionIndex()
902 return reinterpret_cast<lexer::SourcePosition *>(position)->line; in SourcePositionLine()
908 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in SourceRangeStart()
910 …urn reinterpret_cast<es2panda_SourcePosition *>(allocator->New<lexer::SourcePosition>(E2pRange->st… in SourceRangeStart()
916 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in SourceRangeEnd()
918 …urn reinterpret_cast<es2panda_SourcePosition *>(allocator->New<lexer::SourcePosition>(E2pRange->en… in SourceRangeEnd()
931 auto varbinder = context->parserProgram->VarBinder()->AsETSBinder(); in AstNodeRebind()
932 auto phaseManager = context->phaseManager; in AstNodeRebind()
933 if (E2pNode->IsScriptFunction() || in AstNodeRebind()
934 E2pNode->FindChild([](ir::AstNode *n) { return n->IsScriptFunction(); }) != nullptr) { in AstNodeRebind()
935 while (!E2pNode->IsProgram()) { in AstNodeRebind()
936 E2pNode = E2pNode->Parent(); in AstNodeRebind()
946 auto varbinder = context->parserProgram->VarBinder()->AsETSBinder(); in AstNodeRecheck()
947 auto checker = context->checker->AsETSChecker(); in AstNodeRecheck()
948 auto phaseManager = context->phaseManager; in AstNodeRecheck()
949 if (E2pNode->IsScriptFunction() || in AstNodeRecheck()
950 E2pNode->FindChild([](ir::AstNode *n) { return n->IsScriptFunction(); }) != nullptr) { in AstNodeRecheck()
951 while (!E2pNode->IsProgram()) { in AstNodeRecheck()
952 E2pNode = E2pNode->Parent(); in AstNodeRecheck()
956 …context->state = !context->diagnosticEngine->IsAnyError() ? ES2PANDA_STATE_CHECKED : ES2PANDA_STAT… in AstNodeRecheck()
969 auto *allocator = reinterpret_cast<Context *>(ctx)->allocator; in Es2pandaEnumToString()
987 …ir::AstNode *res = reinterpret_cast<const ir::AstNode *>(node)->FindChild([&nameE2p](const ir::Ast… in FirstDeclarationByNameFromNode()
988 … if (ast != nullptr && ast->IsMethodDefinition() && ast->AsMethodDefinition()->Key() != nullptr && in FirstDeclarationByNameFromNode()
989 ast->AsMethodDefinition()->Key()->IsIdentifier() && in FirstDeclarationByNameFromNode()
990 ast->AsMethodDefinition()->Key()->AsIdentifier()->Name() == nameE2p) { in FirstDeclarationByNameFromNode()
1009 …FirstDeclarationByNameFromNode(ctx, reinterpret_cast<const es2panda_AstNode *>(programE2p->Ast()),… in FirstDeclarationByNameFromProgram()
1014 for (const auto &ext_source : programE2p->DirectExternalSources()) { in FirstDeclarationByNameFromProgram()
1018 ctx, reinterpret_cast<const es2panda_AstNode *>(ext_program->Ast()), name); in FirstDeclarationByNameFromProgram()
1033 auto result = ArenaSet<ir::AstNode *> {allocator->Adapter()}; in AllDeclarationsByNameFromNodeHelper()
1039 node->IterateRecursively([&result, &name](ir::AstNode *ast) { in AllDeclarationsByNameFromNodeHelper()
1040 … if (ast != nullptr && ast->IsMethodDefinition() && ast->AsMethodDefinition()->Key() != nullptr && in AllDeclarationsByNameFromNodeHelper()
1041 ast->AsMethodDefinition()->Key()->IsIdentifier() && in AllDeclarationsByNameFromNodeHelper()
1042 ast->AsMethodDefinition()->Key()->AsIdentifier()->Name() == name) { in AllDeclarationsByNameFromNodeHelper()
1056 auto allocator = reinterpret_cast<Context *>(ctx)->allocator; in AllDeclarationsByNameFromNode()
1059 auto apiRes = allocator->New<es2panda_AstNode *[]>(*declsLen); in AllDeclarationsByNameFromNode()
1072 auto allocator = reinterpret_cast<Context *>(ctx)->allocator; in AllDeclarationsByNameFromProgram()
1075 return allocator->New<es2panda_AstNode *[]>(0); in AllDeclarationsByNameFromProgram()
1080 auto result = ArenaSet<ir::AstNode *> {allocator->Adapter()}; in AllDeclarationsByNameFromProgram()
1082 …ArenaSet<ir::AstNode *> res = AllDeclarationsByNameFromNodeHelper(allocator, programE2p->Ast(), na… in AllDeclarationsByNameFromProgram()
1085 for (const auto &ext_source : programE2p->DirectExternalSources()) { in AllDeclarationsByNameFromProgram()
1088 res = AllDeclarationsByNameFromNodeHelper(allocator, ext_program->Ast(), nameE2p); in AllDeclarationsByNameFromProgram()
1095 auto apiRes = allocator->New<es2panda_AstNode *[]>(*declsLen); in AllDeclarationsByNameFromProgram()
1111 auto *checker = reinterpret_cast<ark::es2panda::checker::ETSChecker *>(ctxImpl->checker); in GenerateTsDeclarationsFromContext()
1119 …return ark::es2panda::declgen_ets2ts::GenerateTsDeclarations(checker, ctxImpl->parserProgram, decl… in GenerateTsDeclarationsFromContext()
1128 if (ctxImpl->state != ES2PANDA_STATE_CHECKED) { in GenerateStaticDeclarationsFromContext()
1131 …compiler::HandleGenerateDecl(*ctxImpl->parserProgram, *ctxImpl->diagnosticEngine, outputPath, fals… in GenerateStaticDeclarationsFromContext()
1133 return ctxImpl->diagnosticEngine->IsAnyError() ? 1 : 0; in GenerateStaticDeclarationsFromContext()
1140 auto *parserProgram = reinterpret_cast<parser::Program *>(program); in InsertETSImportDeclarationAndParse() local
1142 importDeclE2p->AddAstNodeFlags(ir::AstNodeFlags::NOCLEANUP); in InsertETSImportDeclarationAndParse()
1144parserProgram->Ast()->Statements().insert(parserProgram->Ast()->Statements().begin(), importDeclE2… in InsertETSImportDeclarationAndParse()
1145 importDeclE2p->SetParent(parserProgram->Ast()); in InsertETSImportDeclarationAndParse()
1147 ctx->parser->AsETSParser()->AddExternalSource(ctx->parser->AsETSParser()->ParseSources()); in InsertETSImportDeclarationAndParse()
1149 for ([[maybe_unused]] auto *specific : importDeclE2p->Specifiers()) { in InsertETSImportDeclarationAndParse()
1150 ES2PANDA_ASSERT(specific->Parent() != nullptr); in InsertETSImportDeclarationAndParse()