| /arkcompiler/ets_frontend/arkguard/src/utils/ |
| D | NodeUtils.ts | 48 public static isPropertyDeclarationNode(node: Node): boolean { 49 let parent: Node | undefined = node.parent; 56 return parent.name === node; 59 if (isComputedPropertyName(parent) && parent.expression === node) { 64 if (isBindingElement(parent) && parent.propertyName === node) { 69 if (isPropertySignature(parent) && parent.name === node) { 74 if (isMethodSignature(parent) && parent.name === node) { 79 if (isEnumMember(parent) && parent.name === node) { 84 if (isPropertyDeclaration(parent) && parent.name === node) { 89 if (isMethodDeclaration(parent) && parent.name === node) { [all …]
|
| D | ScopeAnalyzer.ts | 198 …export function createScope(name: string, node: Node, type: ScopeKind, lexicalScope: boolean = fal… 204 let block: Node = node; 296 …export function createLabel(node: LabeledStatement, scope: Scope, parent?: Label | undefined): Lab… 297 let labelName: string = '$' + scope.labels.length + '_' + node.label.text; 299 'name': node.label.text, 301 'refs': [node.label], 337 getScopeOfNode(node: Node): Scope | undefined; 371 function addSymbolInScope(node: Node): void { 372 let defSymbols: SymbolTable = node?.locals; 388 function addExportSymbolInScope(node: Node): void { [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/ |
| D | jshelpers.js | 18 function getSymbol(node) { argument 19 return node.symbol; 26 function getTextOfIdentifierOrLiteral(node) { argument 27 return ts.getTextOfIdentifierOrLiteral(node); 46 function createDiagnosticForNode(node, message, ...args) { argument 47 return ts.createDiagnosticForNode(node, message, ...args); 58 function isEffectiveStrictModeSourceFile(node, compilerOptions) { argument 59 return ts.isEffectiveStrictModeSourceFile(node, compilerOptions); 62 function getErrorSpanForNode(sourceFile, node) { argument 63 return ts.getErrorSpanForNode(sourceFile, node); [all …]
|
| D | pandagen.ts | 214 private node: ts.SourceFile | ts.FunctionLikeDeclaration; property in PandaGen 235 constructor(internalName: string, node: ts.SourceFile | ts.FunctionLikeDeclaration, 238 this.node = node; 242 this.setFunctionKind(node); 263 public setFunctionKind(node: ts.SourceFile | ts.FunctionLikeDeclaration) { 264 if (ts.isSourceFile(node)) { 269 if (ts.isMethodDeclaration(node)) { 273 if (node.modifiers) { 274 for (let i = 0; i < node.modifiers.length; i++) { 275 if (node.modifiers[i].kind === ts.SyntaxKind.AsyncKeyword) { [all …]
|
| D | syntaxCheckerForStrcitMode.ts | 35 function checkDeleteStatement(node: ts.DeleteExpression): void { 36 let unaryExpr = node.expression; 42 function checkNumericLiteral(node: ts.NumericLiteral): void { 43 let num = jshelpers.getTextOfNode(node); 48 throw new DiagnosticError(node, DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode); 51 function checkString(node: ts.Node, text: string): void { 54 …throw new DiagnosticError(node, DiagnosticCode.Octal_escape_sequences_are_not_allowed_in_strict_mo… 58 throw new DiagnosticError(node, DiagnosticCode._8_and_9_are_not_allowed_in_strict_mode); 62 function checkStringLiteral(node: ts.StringLiteral): void { 64 if (stringLiteralIsInRegExp(node)) { [all …]
|
| D | syntaxChecker.ts | 61 scopeMap.forEach((scope, node) => { 63 if (isFunctionLikeDeclaration(node)) { 64 if (isStrictMode(node)) { 65 checkDuplicateParameter(node, recorder); 68 if (node.body) { 69 let bodyScope = <Scope>scopeMap.get(node.body); 70 let parameterNames = getParameterNames(node, recorder); 78 …if ((node.kind === ts.SyntaxKind.Block) && (node.parent != undefined && node.parent.kind === ts.Sy… 79 let catchScope = <Scope>scopeMap.get(node.parent); 89 if (ts.isFunctionDeclaration(decls[i].node) && scope instanceof ModuleScope) { [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/function/ |
| D | asyncGeneratorFunctionBuilder.ts | 58 prepare(node: ts.Node): void { 62 pg.createAsyncGeneratorObj(node, getVregisterCache(pg, CacheList.FUNC)); 63 pg.storeAccumulator(node, this.funcObj); 65 pg.label(node, this.beginLabel); 66 pg.loadAccumulator(node, getVregisterCache(pg, CacheList.UNDEFINED)); 67 pg.suspendGenerator(node, this.funcObj); 68 pg.resumeGenerator(node, this.funcObj); 69 pg.storeAccumulator(node, this.resumeVal); 72 await(node: ts.Node): void { 74 this.functionAwait(node); [all …]
|
| /arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mpl2mpl/src/ |
| D | ext_constantfold.cpp | 23 StmtNode *ExtConstantFold::ExtSimplify(StmtNode *node) in ExtSimplify() argument 25 CHECK_NULL_FATAL(node); in ExtSimplify() 26 switch (node->GetOpCode()) { in ExtSimplify() 28 return ExtSimplifyBlock(static_cast<BlockNode *>(node)); in ExtSimplify() 30 return ExtSimplifyIf(static_cast<IfStmtNode *>(node)); in ExtSimplify() 32 return ExtSimplifyDassign(static_cast<DassignNode *>(node)); in ExtSimplify() 34 return ExtSimplifyIassign(static_cast<IassignNode *>(node)); in ExtSimplify() 37 return ExtSimplifyWhile(static_cast<WhileStmtNode *>(node)); in ExtSimplify() 39 return node; in ExtSimplify() 43 BaseNode *ExtConstantFold::DispatchFold(BaseNode *node) in DispatchFold() argument [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/core/ |
| D | pandagen.h | 71 void StoreAccumulator(const ir::AstNode *node, VReg vreg); 72 void LoadAccumulator(const ir::AstNode *node, VReg reg); 74 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, VReg vd, VReg vs) override; 75 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, OutVReg vd, VReg vs) override; 76 void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs); 78 void LoadAccumulatorDouble(const ir::AstNode *node, double num); 79 void LoadAccumulatorInt(const ir::AstNode *node, size_t num); 81 void LoadConst(const ir::AstNode *node, Constant id); 82 void StoreConst(const ir::AstNode *node, VReg reg, Constant id); 84 void GetFunctionObject(const ir::AstNode *node); [all …]
|
| D | pandagen.cpp | 49 explicit EcmaDisabled(const ir::AstNode *node, [[maybe_unused]] Args &&...args) : IRNode(node) in EcmaDisabled() argument 332 void PandaGen::StoreAccumulator(const ir::AstNode *node, VReg vreg) in StoreAccumulator() argument 334 Ra().Emit<StaDyn>(node, vreg); in StoreAccumulator() 337 void PandaGen::LoadAccumulator(const ir::AstNode *node, VReg reg) in LoadAccumulator() argument 339 Ra().Emit<LdaDyn>(node, reg); in LoadAccumulator() 342 IRNode *PandaGen::AllocMov(const ir::AstNode *node, const VReg vd, const VReg vs) in AllocMov() argument 344 return Allocator()->New<MovDyn>(node, vd, vs); in AllocMov() 347 IRNode *PandaGen::AllocMov(const ir::AstNode *node, OutVReg vd, const VReg vs) in AllocMov() argument 350 return Allocator()->New<MovDyn>(node, *vd.reg, vs); in AllocMov() 353 void PandaGen::MoveVreg(const ir::AstNode *node, VReg vd, VReg vs) in MoveVreg() argument [all …]
|
| D | ETSGen.h | 46 [[nodiscard]] VReg StoreException(const ir::AstNode *node); 47 …void ApplyConversionAndStoreAccumulator(const ir::AstNode *node, VReg vreg, const checker::Type *t… 48 void StoreAccumulator(const ir::AstNode *node, VReg vreg); 49 void LoadAccumulator(const ir::AstNode *node, VReg vreg); 50 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, VReg vd, VReg vs) override; 51 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, OutVReg vd, VReg vs) override; 52 void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs); 56 void LoadVar(const ir::AstNode *node, varbinder::Variable const *var); 57 void LoadDynamicModuleVariable(const ir::AstNode *node, varbinder::Variable const *var); 58 void LoadDynamicNamespaceVariable(const ir::AstNode *node, varbinder::Variable const *var); [all …]
|
| D | ETSGen.cpp | 126 void ETSGen::ApplyConversionAndStoreAccumulator(const ir::AstNode *const node, const VReg vreg, in ApplyConversionAndStoreAccumulator() argument 129 ApplyConversion(node, targetType); in ApplyConversionAndStoreAccumulator() 130 StoreAccumulator(node, vreg); in ApplyConversionAndStoreAccumulator() 133 VReg ETSGen::StoreException(const ir::AstNode *node) in StoreException() argument 136 Ra().Emit<StaObj>(node, exception); in StoreException() 143 void ETSGen::StoreAccumulator(const ir::AstNode *const node, const VReg vreg) in StoreAccumulator() argument 148 Ra().Emit<StaObj>(node, vreg); in StoreAccumulator() 150 Ra().Emit<StaWide>(node, vreg); in StoreAccumulator() 152 Ra().Emit<Sta>(node, vreg); in StoreAccumulator() 158 void ETSGen::LoadAccumulator(const ir::AstNode *node, VReg vreg) in LoadAccumulator() argument [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/function/ |
| D | functionBuilder.cpp | 36 void FunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 38 pg_->EmitReturn(node); in DirectReturn() 41 void FunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 46 pg_->EmitReturnUndefined(node); in ImplicitReturn() 52 pg_->EmitReturn(node); in ImplicitReturn() 55 void FunctionBuilder::AsyncYield(const ir::AstNode *node, VReg completionType, VReg completionValue… in AsyncYield() argument 59 pg_->GeneratorYield(node, funcObj_); in AsyncYield() 60 pg_->SuspendAsyncGenerator(node, funcObj_); in AsyncYield() 62 ResumeGenerator(node, completionType, completionValue); in AsyncYield() 65 void FunctionBuilder::SuspendResumeExecution(const ir::AstNode *node, VReg completionType, VReg com… in SuspendResumeExecution() argument [all …]
|
| D | asyncGeneratorFunctionBuilder.cpp | 23 void AsyncGeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) const in Prepare() 25 VReg callee = FunctionReg(node); in Prepare() 27 pg_->CreateAsyncGeneratorObj(node, callee); in Prepare() 28 pg_->StoreAccumulator(node, funcObj_); in Prepare() 29 pg_->SuspendGenerator(node, funcObj_); in Prepare() 30 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 33 void AsyncGeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 37 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 38 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() 39 pg_->AsyncGeneratorReject(node, funcObj_); in CleanUp() [all …]
|
| D | generatorFunctionBuilder.cpp | 23 void GeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) const in Prepare() 25 VReg callee = FunctionReg(node); in Prepare() 27 pg_->CreateGeneratorObj(node, callee); in Prepare() 28 pg_->StoreAccumulator(node, funcObj_); in Prepare() 29 pg_->SuspendGenerator(node, funcObj_); in Prepare() 30 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 33 void GeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 37 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 38 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() 39 pg_->GeneratorComplete(node, funcObj_); in CleanUp() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/function/ |
| D | asyncGeneratorFunctionBuilder.cpp | 23 void AsyncGeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument 26 VReg callee = FunctionReg(node); in Prepare() 30 pg_->CreateAsyncGeneratorObj(node, callee); in Prepare() 31 pg_->StoreAccumulator(node, funcObj_); in Prepare() 33 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 35 pg_->LoadConst(node, Constant::JS_UNDEFINED); in Prepare() 36 SuspendResumeExecution(node, completionType, completionValue); in Prepare() 39 void AsyncGeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 46 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 47 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() [all …]
|
| D | functionBuilder.cpp | 38 void FunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 40 pg_->NotifyConcurrentResult(node); in DirectReturn() 41 pg_->EmitReturn(node); in DirectReturn() 44 void FunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 50 pg_->NotifyConcurrentResult(node); in ImplicitReturn() 52 pg_->EmitReturn(node); in ImplicitReturn() 55 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 56 pg_->NotifyConcurrentResult(node); in ImplicitReturn() 58 pg_->EmitReturnUndefined(node); in ImplicitReturn() 62 pg_->GetThis(node); in ImplicitReturn() [all …]
|
| /arkcompiler/ets_runtime/ecmascript/mem/ |
| D | ecma_list.h | 30 explicit EcmaList(T *node) : first_(node), last_(node) in EcmaList() argument 32 node->LinkPrev(nullptr); in EcmaList() 33 node->LinkNext(nullptr); in EcmaList() 38 void AddNode(T *node) in AddNode() argument 40 ASSERT(node != nullptr); in AddNode() 43 node->LinkNext(lastNext); in AddNode() 44 node->LinkPrev(last_); in AddNode() 45 last_->LinkNext(node); in AddNode() 47 lastNext->LinkPrev(node); in AddNode() 49 last_ = node; in AddNode() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/core/ |
| D | pandagen.cpp | 243 void PandaGen::InitializeLexEnv(const ir::AstNode *node) in InitializeLexEnv() argument 248 NewLexicalEnv(node, topScope_->LexicalSlots(), topScope_); in InitializeLexEnv() 252 void PandaGen::CopyFunctionArguments(const ir::AstNode *node) in CopyFunctionArguments() argument 259 StoreLexicalVar(node, 0, param->LexIdx(), targetReg++); in CopyFunctionArguments() 262 MoveVreg(node, param->Vreg(), targetReg++); in CopyFunctionArguments() 265 auto fn = [this](const ir::AstNode *node) { in CopyFunctionArguments() argument 267 if (node->IsScriptFunction()) { in CopyFunctionArguments() 268 typedFunc_.first = context_->TypeRecorder()->GetNodeTypeIndex(node); in CopyFunctionArguments() 271 if (node->Parent() != nullptr && node->Parent()->Parent() != nullptr) { in CopyFunctionArguments() 272 auto method = node->Parent()->Parent(); in CopyFunctionArguments() [all …]
|
| D | pandagen.h | 286 void InitializeLexEnv(const ir::AstNode *node); 287 void CopyFunctionArguments(const ir::AstNode *node); 288 void GetFunctionObject(const ir::AstNode *node); 289 void GetNewTarget(const ir::AstNode *node); 290 void GetThis(const ir::AstNode *node); 291 void SetThis(const ir::AstNode *node); 292 void LoadVar(const ir::Identifier *node, const binder::ScopeFindResult &result); 293 … void StoreVar(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration); 295 void StLetOrClassToGlobalRecord(const ir::AstNode *node, const util::StringView &name); 296 void StConstToGlobalRecord(const ir::AstNode *node, const util::StringView &name); [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tools/declgen_ts2ets/src/ |
| D | ASTTransformer.ts | 25 function getChildCount(node: ts.Node): number { 28 node.forEachChild((c) => { 39 function getChildAt(node: ts.Node, idx: number): ts.Node { 42 let res = node.forEachChild((c) => { 51 throw new Error(`index ${idx} out of range ${getChildCount(node)}`); 65 function isNull(node: ts.Node): boolean { 66 if (node.kind === ts.SyntaxKind.NullKeyword) { 70 if (!ts.isLiteralTypeNode(node)) { 75 getChildCount(node) == 1 && 76 node.getChildAt(0).kind == ts.SyntaxKind.NullKeyword [all …]
|
| /arkcompiler/ets_runtime/ecmascript/ |
| D | waiter_list.cpp | 22 void WaiterList::AddNode(WaiterListNode *node) in AddNode() argument 24 ASSERT(node->prev_ == nullptr); in AddNode() 25 ASSERT(node->next_ == nullptr); in AddNode() 26 auto iter = locationListMap_.find(node->waitPointer_); in AddNode() 28 iter->second.pTail->next_ = node; in AddNode() 29 node->prev_ = iter->second.pTail; in AddNode() 30 iter->second.pTail = node; in AddNode() 32 locationListMap_.emplace(node->waitPointer_, HeadAndTail {node, node}); in AddNode() 36 void WaiterList::DeleteNode(WaiterListNode *node) in DeleteNode() argument 38 auto iter = locationListMap_.find(node->waitPointer_); in DeleteNode() [all …]
|
| /arkcompiler/ets_frontend/arkguard/src/transformers/rename/ |
| D | RenamePropertiesTransformer.ts | 100 function renamePropertiesTransformer(node: Node): Node { 101 collectReservedNames(node); 103 let ret: Node = renameProperties(node); 107 function renameProperties(node: Node): Node { 108 if (isConstructorDeclaration(node)) { 112 if (NodeUtils.isClassPropertyInConstructorParams(node)) { 113 currentConstructorParams.add((node as Identifier).escapedText.toString()); 114 return renameProperty(node, false); 117 if (NodeUtils.isClassPropertyInConstructorBody(node, currentConstructorParams)) { 118 if (currentConstructorParams.has((node as Identifier).escapedText.toString())) { [all …]
|
| D | RenameFileNameTransformer.ts | 108 function renameFileNameTransformer(node: Node): Node { 113 let ret: Node = updateNodeInfo(node); 122 function updateNodeInfo(node: Node): Node { 123 if (isImportDeclaration(node) || isExportDeclaration(node)) { 124 return updateImportOrExportDeclaration(node); 127 if (isImportCall(node)) { 128 return tryUpdateDynamicImport(node); 131 if (isStructDeclaration(node)) { 132 return tryRemoveVirtualConstructor(node); 134 return visitEachChild(node, updateNodeInfo, context); [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/base/ |
| D | iterator.ts | 33 private node: ts.Node; property in Iterator 38 … pandaGen: PandaGen, node: ts.Node, kind ? : IteratorType, funcBuilder ? : FunctionBuilder) { 43 this.node = node; 58 …nd === IteratorType.Normal ? pandaGen.getIterator(this.node) : pandaGen.getAsyncIterator(this.node… 59 pandaGen.storeAccumulator(this.node, iterator); 62 pandaGen.loadObjProperty(this.node, iterator, "next"); 63 pandaGen.storeAccumulator(this.node, this.iterRecord.nextMethod); 71 this.pandaGen.loadObjProperty(this.node, this.iterRecord.iterator, id); 72 this.pandaGen.storeAccumulator(this.node, this.iterRecord.nextMethod); 82 this.pandaGen.call(this.node, [this.iterRecord.nextMethod, this.iterRecord.iterator], true); [all …]
|