| /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 …]
|
| D | jshelpers.d.ts | 18 export function getSymbol(node: ts.Node): ts.Symbol; 20 export function getTextOfIdentifierOrLiteral(node: ts.Node): string; 25 export function createDiagnosticForNode(node: ts.Node, message: ts.DiagnosticMessage, ...args: (str… 29 export function isEffectiveStrictModeSourceFile(node: ts.SourceFile, compilerOptions: ts.CompilerOp… 30 export function getErrorSpanForNode(sourceFile: ts.SourceFile, node: ts.Node): ts.TextSpan; 32 export function getContainingClass(node: ts.Node): ts.ClassLikeDeclaration | undefined; 34 export function getContainingFunction(node: ts.Node): ts.SignatureDeclaration | undefined; 35 export function isPrologueDirective(node: ts.Node): node is ts.PrologueDirective; 36 export function getSourceTextOfNodeFromSourceFile(sourceFile: ts.SourceFile, node: ts.Node, include… 37 export function isAssignmentTarget(node: ts.Node): boolean; [all …]
|
| D | syntaxCheckHelper.ts | 33 export function isNewOrCallExpression(node: ts.Node): boolean { 34 return node.kind === ts.SyntaxKind.NewExpression || node.kind === ts.SyntaxKind.CallExpression; 37 export function stringLiteralIsInRegExp(node: ts.Node): boolean { 38 let parent = node.parent; 73 export function isEvalOrArgumentsIdentifier(node: ts.Node): boolean { 74 …return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === MandatoryArgu… 113 export function isLeftHandSideExpression(node: ts.Node): boolean { 114 return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); 121 export function isOriginalKeyword(node: ts.Identifier): boolean { 122 if (node.originalKeywordKind! >= ts.SyntaxKind.FirstFutureReservedWord && [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 …]
|
| D | asyncFunctionBuilder.ts | 47 prepare(node: ts.Node): void { 53 pandaGen.label(node, this.beginLabel); 56 await(node: ts.Node): void { 58 this.functionAwait(node); 59 this.handleMode(node); 62 explicitReturn(node: ts.Node | NodeKind, empty ? : boolean): void { 64 this.pg.asyncFunctionResolve(node, this.funcObj); 65 this.pg.return(node); 68 implicitReturn(node: ts.Node | NodeKind): void { 69 this.pg.loadAccumulator(node, getVregisterCache(this.pg, CacheList.UNDEFINED)); [all …]
|
| /arkcompiler/ets_frontend/arkguard/src/utils/ |
| D | NodeUtils.ts | 39 public static isPropertyDeclarationNode(node: Node): boolean { 40 let parent: Node | undefined = node.parent; 47 return parent.name === node; 50 if (isComputedPropertyName(parent) && parent.expression === node) { 55 if (isBindingElement(parent) && parent.propertyName === node) { 60 if (isPropertySignature(parent) && parent.name === node) { 65 if (isMethodSignature(parent) && parent.name === node) { 70 if (isEnumMember(parent) && parent.name === node) { 75 if (isPropertyDeclaration(parent) && parent.name === node) { 80 if (isMethodDeclaration(parent) && parent.name === node) { [all …]
|
| D | ScopeAnalyzer.ts | 192 …export function createScope(name: string, node: Node, type: ScopeKind, lexicalScope: boolean = fal… 198 let block: Node = node; 284 …export function createLabel(node: LabeledStatement, scope: Scope, parent?: Label | undefined): Lab… 285 let labelName: string = '$' + scope.labels.length + '_' + node.label.text; 287 'name': node.label.text, 289 'refs': [node.label], 324 getScopeOfNode(node: Node): Scope | undefined; 356 function addSymbolInScope(node: Node): void { 357 let defSymbols: SymbolTable = node?.locals; 377 function analyzeScope(node: Node): void { [all …]
|
| D | TransformUtil.ts | 41 let visit = (node: Node): void => { 42 if (isIdentifier(node)) { 43 identifiers.add(node.text); 46 forEachChild(node, visit); 61 let visit = (node: Node): Node => { 62 if (!isIdentifier(node) || !node.parent) { 63 return visitEachChild(node, visit, context); 66 identifiers.push(node); 67 return node; 80 export function isCommentedNode(node: Node, sourceFile: SourceFile): boolean { [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() 51 pg_->EmitReturn(node); in ImplicitReturn() 54 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 55 pg_->NotifyConcurrentResult(node); in ImplicitReturn() 56 pg_->EmitReturnUndefined(node); in ImplicitReturn() 66 pg_->NotifyConcurrentResult(node); in ImplicitReturn() [all …]
|
| D | generatorFunctionBuilder.cpp | 24 void GeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument 26 VReg callee = FunctionReg(node); in Prepare() 30 pg_->CreateGeneratorObj(node, callee); in Prepare() 31 pg_->StoreAccumulator(node, funcObj_); in Prepare() 32 pg_->LoadConst(node, Constant::JS_UNDEFINED); in Prepare() 33 SuspendResumeExecution(node, completionType, completionValue); in Prepare() 34 HandleCompletion(node, completionType, completionValue); in Prepare() 37 void GeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 41 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 42 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() [all …]
|
| D | asyncFunctionBuilder.cpp | 24 void AsyncFunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 26 pg_->AsyncFunctionResolve(node, funcObj_); // retVal is in acc in DirectReturn() 27 pg_->NotifyConcurrentResult(node); in DirectReturn() 28 pg_->EmitReturn(node); in DirectReturn() 31 void AsyncFunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 33 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 34 DirectReturn(node); in ImplicitReturn() 37 void AsyncFunctionBuilder::ExplicitReturn(const ir::AstNode *node) const in ExplicitReturn() 39 DirectReturn(node); in ExplicitReturn() 42 void AsyncFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument [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 | 216 void PandaGen::InitializeLexEnv(const ir::AstNode *node) in InitializeLexEnv() argument 221 NewLexicalEnv(node, topScope_->LexicalSlots(), topScope_); in InitializeLexEnv() 225 void PandaGen::CopyFunctionArguments(const ir::AstNode *node) in CopyFunctionArguments() argument 232 StoreLexicalVar(node, 0, param->LexIdx(), targetReg++); in CopyFunctionArguments() 235 MoveVreg(node, param->Vreg(), targetReg++); in CopyFunctionArguments() 238 auto fn = [this](const ir::AstNode *node) { in CopyFunctionArguments() argument 240 if (node->IsScriptFunction()) { in CopyFunctionArguments() 241 typedFunc_.first = context_->TypeRecorder()->GetNodeTypeIndex(node); in CopyFunctionArguments() 244 if (node->Parent() != nullptr && node->Parent()->Parent() != nullptr) { in CopyFunctionArguments() 245 auto method = node->Parent()->Parent(); in CopyFunctionArguments() [all …]
|
| D | pandagen.h | 278 void InitializeLexEnv(const ir::AstNode *node); 279 void CopyFunctionArguments(const ir::AstNode *node); 280 void GetFunctionObject(const ir::AstNode *node); 281 void GetNewTarget(const ir::AstNode *node); 282 void GetThis(const ir::AstNode *node); 283 void SetThis(const ir::AstNode *node); 284 void LoadVar(const ir::Identifier *node, const binder::ScopeFindResult &result); 285 … void StoreVar(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration); 287 void StLetOrClassToGlobalRecord(const ir::AstNode *node, const util::StringView &name); 288 void StConstToGlobalRecord(const ir::AstNode *node, const util::StringView &name); [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 | 94 function renamePropertiesTransformer(node: Node): Node { 95 collectReservedNames(node); 100 let ret: Node = renameProperties(node); 104 function renameProperties(node: Node): Node { 105 if (isConstructorDeclaration(node)) { 109 if (NodeUtils.isClassPropertyInConstructorParams(node)) { 110 currentConstructorParams.add((node as Identifier).escapedText.toString()); 111 return renameProperty(node, false); 114 if (NodeUtils.isClassPropertyInConstructorBody(node, currentConstructorParams)) { 115 if (currentConstructorParams.has((node as Identifier).escapedText.toString())) { [all …]
|
| D | ShorthandPropertyTransformer.ts | 51 function shorthandPropertyTransformer(node: Node): Node { 52 return setParentRecursive(transformShortHandProperty(node), true); 55 function transformShortHandProperty(node: Node): Node { 61 if (isShorthandPropertyAssignment((node))) { 63 … return factory.createPropertyAssignment(factory.createIdentifier(node.name.text), node.name); 73 if (isObjectBindingPattern(node) && NodeUtils.isObjectBindingPatternAssignment(node)) { 74 return node; 81 if (isElementsInObjectBindingPattern(node) && !node.propertyName && !node.dotDotDotToken) { 82 …return factory.createBindingElement(node.dotDotDotToken, factory.createIdentifier((node.name as Id… 83 node.name, node.initializer); [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 …]
|
| D | util.ts | 54 export function hasExportKeywordModifier(node: ts.Node): boolean { 56 if (node.modifiers) { 57 node.modifiers.forEach((mod) => { 67 export function hasDefaultKeywordModifier(node: ts.Node): boolean { 69 if (node.modifiers) { 70 node.modifiers.forEach((mod) => { 125 export function isBindingPattern(node: ts.Node): boolean { 126 return ts.isArrayBindingPattern(node) || ts.isObjectBindingPattern(node); 129 export function isObjectBindingOrAssignmentPattern(node: ts.Node): boolean { 130 return ts.isObjectLiteralExpression(node) || ts.isObjectBindingPattern(node); [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/base/ |
| D | lexenv.cpp | 29 static bool CheckTdz(const ir::AstNode *node) in CheckTdz() argument 31 return node->IsIdentifier() && node->AsIdentifier()->IsTdz(); in CheckTdz() 34 static void CheckConstAssignment(PandaGen *pg, const ir::AstNode *node, binder::Variable *variable) in CheckConstAssignment() argument 40 pg->ThrowConstAssignment(node, variable->Name()); in CheckConstAssignment() 45 static void ExpandLoadLexVar(PandaGen *pg, const ir::AstNode *node, const binder::ScopeFindResult &… in ExpandLoadLexVar() argument 47 …pg->LoadLexicalVar(node, result.lexLevel, result.variable->AsLocalVariable()->LexIdx(), result.var… in ExpandLoadLexVar() 50 pg->ThrowUndefinedIfHole(node, result.variable->Name()); in ExpandLoadLexVar() 54 static void ExpandLoadNormalVar(PandaGen *pg, const ir::AstNode *node, const binder::ScopeFindResul… in ExpandLoadNormalVar() argument 58 if (CheckTdz(node)) { in ExpandLoadNormalVar() 59 pg->LoadConst(node, Constant::JS_HOLE); in ExpandLoadNormalVar() [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/expression/ |
| D | memberAccessExpression.ts | 24 export function compileMemberAccessExpression(node: ts.ElementAccessExpression | ts.PropertyAccessE… 29 let { obj: obj, prop: property } = getObjAndProp(node, objReg, propReg, compiler); 31 if (jshelpers.isSuperProperty(node)) { 34 compileSuperProperty(compiler, node, thisReg, property); 38 ts.isPropertyAccessExpression(node) ? node.name : node.argumentExpression, 47 export function getObjAndProp(node: ts.ElementAccessExpression | ts.PropertyAccessExpression, 54 if (!jshelpers.isSuperProperty(node)) { 55 compiler.compileExpression(node.expression); 56 pandaGen.storeAccumulator(node.expression, objReg); 59 if (ts.isPropertyAccessExpression(node)) { [all …]
|