• Home
  • Raw
  • Download

Lines Matching full:this

4  * you may not use this file except in compliance with the License.
21 * This file should not contain import from irnodes.ts.
141 this.rootNode = node;
142 this.pandaGen = pandaGen;
143 this.compilerDriver = compilerDriver;
144 this.recorder = recorder;
145 this.funcBuilder = new FunctionBuilder(pandaGen);
147 …// At the beginning of function compile, alloc pandagen.local for 4funcObj/newTarget/this/paramete…
148 // maybe no one used this parameter, will get undefined for RA
149 this.scope = this.pandaGen.getScope()!;
150 let parameters = (<VariableScope>this.scope).getParameters();
153 this.pandaGen.getVregForVariable(parameters[i]);
157 getVregisterCache(this.pandaGen, CacheList.LEXENV);
159 this.pandaGen.loadAccFromArgs(this.rootNode);
163 this.storeFuncObj2LexEnvIfNeeded();
164 this.compileLexicalBindingForArrowFunction();
166 if (this.rootNode.kind === ts.SyntaxKind.SourceFile) {
167 this.compileSourceFileOrBlock(<ts.SourceFile>this.rootNode);
169 this.compileFunctionLikeDeclaration(<ts.FunctionLikeDeclaration>this.rootNode);
174 this.envUnion.push(env);
178 this.envUnion.pop();
182 return this.envUnion[this.envUnion.length - 1];
186 let rootNode = this.rootNode;
190 let functionScope = this.recorder.getScopeOfNode(rootNode);
195 this.pandaGen.loadAccumulator(NodeKind.FIRST_NODE_OF_FUNCTION,
196 getVregisterCache(this.pandaGen, CacheList.FUNC));
197this.pandaGen.storeAccToLexEnv(NodeKind.FIRST_NODE_OF_FUNCTION, v.scope, v.level, v.v, true);
203 let rootNode = this.rootNode;
208 this.storeMandatoryArgToLexEnv(MandatoryFuncObj);
209 this.storeMandatoryArgToLexEnv(MandatoryNewTarget);
210 this.storeMandatoryArgToLexEnv(MandatoryThis);
212 let rootScope: VariableScope = <VariableScope>this.recorder.getScopeOfNode(rootNode);
214 this.storeMandatoryArgToLexEnv(MandatoryArguments);
219 let v = this.scope.findLocal(arg);
227 let vreg = arg === MandatoryFuncObj ? getVregisterCache(this.pandaGen, CacheList.FUNC) :
228 this.pandaGen.getVregForVariable(v);
229 this.pandaGen.storeLexicalVar(this.rootNode, 0, v.lexIndex(), vreg);
237 compileDefaultInitClassMembers(this, body.parent);
241 this.compileStatement(stmt);
248 compileReturnThis4Ctor(this, body.parent, unreachableFlag);
255 this.funcBuilder.implicitReturn(NodeKind.INVALID);
259 let pandaGen = this.pandaGen;
262 this.pushScope(body);
263 this.compileSourceFileOrBlock(<ts.Block>body);
264 this.popScope();
266 this.compileExpression(<ts.Expression>body);
271 …if (this.funcBuilder instanceof AsyncFunctionBuilder || this.funcBuilder instanceof AsyncGenerator…
272 this.funcBuilder.resolve(body, retValue);
280 … throw new Error("Node " + this.getNodeName(body) + " is unimplemented as a function body");
285 let pandaGen = this.pandaGen;
290 let paramRef = LReference.generateLReference(this, parameter, true);
297 variable = <Variable>this.scope.find(paramName).v;
302 let scope = this.pandaGen.getScope();
319 this.compileExpression(param.initializer);
333 let pandaGen = this.pandaGen;
340 return new AsyncGeneratorFunctionBuilder(pandaGen, this);
349 return new GeneratorFunctionBuilder(pandaGen, this);
356 let pandaGen = this.pandaGen;
357 this.compileFunctionParameterDeclaration(decl);
362 compileDefaultConstructor(this, decl);
374 this.funcBuilder = this.createFuncBuilder(decl);
375 this.funcBuilder.prepare(decl);
377 this.compileFunctionBody(decl.kind, decl.body);
380 this.funcBuilder.cleanUp(decl);
386 this.pandaGen.setFirstStmt(stmt);
389 LOGD(this.debugTag, "compile statement: " + this.getNodeName(stmt));
392 this.compileBlock(<ts.Block>stmt);
397 this.compileVariableStatement(<ts.VariableStatement>stmt);
400 this.compileExpression((<ts.ExpressionStatement>stmt).expression);
403 this.compileIfStatement(<ts.IfStatement>stmt);
406 compileDoStatement(<ts.DoStatement>stmt, this);
409 compileWhileStatement(<ts.WhileStatement>stmt, this);
412 compileForStatement(<ts.ForStatement>stmt, this);
415 compileForInStatement(<ts.ForInStatement>stmt, this);
418 compileForOfStatement(<ts.ForOfStatement>stmt, this);
421 this.compileContinueStatement(<ts.ContinueStatement>stmt);
424 this.compileBreakStatement(<ts.BreakStatement>stmt);
427 compileReturnStatement(<ts.ReturnStatement>stmt, this);
430 compileSwitchStatement(<ts.SwitchStatement>stmt, this);
433 this.compileLabeledStatement(<ts.LabeledStatement>stmt);
436 this.compileThrowStatement(<ts.ThrowStatement>stmt);
439 this.compileTryStatement(<ts.TryStatement>stmt);
442 this.pandaGen.debugger(stmt);
445 this.compileFunctionDeclaration(<ts.FunctionDeclaration>stmt);
448 compileClassDeclaration(this, <ts.ClassLikeDeclaration>stmt);
452 this.compileExportAssignment(<ts.ExportAssignment>stmt);
463 throw new Error("Statement " + this.getNodeName(stmt) + " is unimplemented");
468 this.pushScope(block);
469 hoistFunctionInBlock(this.scope, this.pandaGen, isStrictMode(block), this);
471 block.statements.forEach((stmt) => this.compileStatement(stmt));
473 this.popScope();
479 this.compileVariableDeclaration(decl)
484 let lref = LReference.generateLReference(this, decl.name, true);
486 this.compileExpression(decl.initializer);
495this.pandaGen.loadAccumulator(decl, getVregisterCache(this.pandaGen, CacheList.UNDEFINED));
502 this.pushScope(stmt);
506 this.compileCondition(stmt.expression, stmt.elseStatement ? ifElseLabel : ifEndLabel);
507 this.compileStatement(stmt.thenStatement);
509 this.pandaGen.branch(DebugInfo.getLastNode(), ifEndLabel);
510 this.pandaGen.label(stmt, ifElseLabel);
511 this.compileStatement(stmt.elseStatement);
513 this.pandaGen.label(stmt, ifEndLabel);
514 this.popScope();
519 this.pandaGen.popLexicalEnv(node);
529 this.popLoopEnv(node, loopEnvLevel - 1);
536 this.popLoopEnv(node, popTimes);
543 this.popLoopEnv(node, loopEnvLevel);
551 this.popLoopEnv(node, loopEnvLevel);
559 this.compileFinallyBeforeCFC(
567 this.popLoopEnvWhenContinueOrBreak(continueLabelTarget, true);
570 this.pandaGen.branch(stmt, continueLabelTarget.getContinueTargetLabel()!);
576 this.compileFinallyBeforeCFC(
584 this.popLoopEnvWhenContinueOrBreak(breakLabelTarget, false);
587 this.pandaGen.branch(stmt, breakLabelTarget.getBreakTargetLabel());
591 this.pushScope(stmt);
604 this.compileStatement(stmt.statement);
607 this.pandaGen.label(stmt, blockEndLabel);
612 this.popScope();
616 let pandaGen = this.pandaGen;
618 this.compileExpression(stmt.expression);
625 this.popLoopEnv(stmt, popTimes);
634 let currentScope = this.scope;
645 this.pandaGen.label(startTry.getStatement(), inlineFinallyBegin);
647 this.pandaGen.label(startTry.getStatement(), inlineFinallyEnd);
674 this.scope = currentScope;
678 let pandaGen = this.pandaGen;
697 let loopScope = <LoopScope>this.getRecorder().getScopeOfNode(node);
714 this.pushScope(stmt);
718 stmt = transformTryCatchFinally(stmt, this.recorder);
721 let tryBuilder = new TryBuilder(this, this.pandaGen, stmt);
722 this.constructTry(stmt, tryBuilder);
723 this.popScope();
728 if (hasExportKeywordModifier(decl) && this.scope instanceof ModuleScope) {
736 this.compileExpression(stmt.expression);
737 … let defaultV: ModuleVariable = <ModuleVariable>(this.pandaGen.getScope().findLocal("*default*"));
738 this.pandaGen.storeModuleVariable(stmt, defaultV);
742 let pandaGen = this.pandaGen;
755 // This is a special case
759 // the goal of this method is to merge these two sequences of instructions.
761 this.compileExpression(binExpr.left);
763 this.compileExpression(binExpr.right);
769 this.compileExpression(binExpr.left);
771 this.compileExpression(binExpr.right);
777 this.compileExpression(binExpr.left);
779 this.compileExpression(binExpr.right);
790 this.compileExpression(expr);
796 LOGD(this.debugTag, "compile expr: " + ts.SyntaxKind[expr.kind] + " " + expr.kind);
799 compileNumericLiteral(this.pandaGen, <ts.NumericLiteral>expr);
802 compileBigIntLiteral(this.pandaGen, <ts.BigIntLiteral>expr);
805 compileStringLiteral(this.pandaGen, <ts.StringLiteral>expr);
808 compileRegularExpressionLiteral(this, <ts.RegularExpressionLiteral>expr);
811 this.compileIdentifier(<ts.Identifier>expr);
815 this.compileBooleanLiteral(<ts.BooleanLiteral>expr);
818 compileCallExpression(<ts.CallExpression>expr, this);
821this.pandaGen.loadAccumulator(expr, getVregisterCache(this.pandaGen, CacheList.NULL));
824 this.compileThisKeyword(expr);
827 compileMetaProperty(<ts.MetaProperty>expr, this);
830 compileArrayLiteralExpression(this, <ts.ArrayLiteralExpression>expr);
833 compileObjectLiteralExpression(this, <ts.ObjectLiteralExpression>expr);
837 …ompileMemberAccessExpression(<ts.ElementAccessExpression | ts.PropertyAccessExpression>expr, this);
840 compileNewExpression(<ts.NewExpression>expr, this);
843this.compileExpression(findInnerExprOfParenthesis(<ts.ParenthesizedExpression>expr));
846 this.compileFunctionExpression(<ts.FunctionExpression>expr);
849 this.compileDeleteExpression(<ts.DeleteExpression>expr);
852 this.compileTypeOfExpression(<ts.TypeOfExpression>expr);
855 this.compileVoidExpression(<ts.VoidExpression>expr);
858 this.compileAwaitExpression(<ts.AwaitExpression>expr);
861 this.compilePrefixUnaryExpression(<ts.PrefixUnaryExpression>expr);
864 this.compilePostfixUnaryExpression(<ts.PostfixUnaryExpression>expr);
867 this.compileBinaryExpression(<ts.BinaryExpression>expr);
870 this.compileConditionalExpression(<ts.ConditionalExpression>expr);
873 compileYieldExpression(this, <ts.YieldExpression>expr);
876 this.compileArrowFunction(<ts.ArrowFunction>expr);
879 this.compileTemplateExpression(<ts.TemplateExpression>expr);
884 this.compileNoSubstitutionTemplateLiteral(<ts.NoSubstitutionTemplateLiteral>expr);
887 this.compileTaggedTemplateExpression(<ts.TaggedTemplateExpression>expr);
894 compileClassDeclaration(this, <ts.ClassLikeDeclaration>expr);
897 this.compileExpression((<ts.PartiallyEmittedExpression>expr).expression);
900 compileCommaListExpression(this, <ts.CommaListExpression>expr);
903 … throw new Error("Expression of type " + this.getNodeName(expr) + " is unimplemented");
909 let { scope, level, v } = this.scope.find(name);
913 this.compileUnscopedIdentifier(id);
915 this.loadTarget(id, { scope, level, v });
921 let pandaGen = this.pandaGen;
925 pandaGen.loadAccumulator(id, getVregisterCache(this.pandaGen, CacheList.NAN));
928 pandaGen.loadAccumulator(id, getVregisterCache(this.pandaGen, CacheList.INFINITY));
931 pandaGen.loadAccumulator(id, getVregisterCache(this.pandaGen, CacheList.GLOBAL));
934 pandaGen.loadAccumulator(id, getVregisterCache(this.pandaGen, CacheList.UNDEFINED));
953 this.pandaGen.loadAccumulator(lit, getVregisterCache(this.pandaGen, CacheList.TRUE));
955 this.pandaGen.loadAccumulator(lit, getVregisterCache(this.pandaGen, CacheList.FALSE));
969 if (arg.text.match(/ *return +this[;]? *$/) === null) {
972this.pandaGen.loadAccumulator(expr, getVregisterCache(this.pandaGen, CacheList.GLOBAL));
982 let pandaGen = this.pandaGen;
984 checkValidUseSuperBeforeSuper(this, node);
986 let { scope, level, v } = this.scope.find(MandatoryThis);
989 throw new Error("\"this\" not found");
1002 throw new Error("\"this\" must be a local variable");
1006 let internalName = this.compilerDriver.getFuncInternalName(expr, this.recorder);
1007 this.pandaGen.defineFunction(expr, expr, internalName);
1011 let pandaGen = this.pandaGen;
1017 // Check if this is a known variable.
1019 let { scope, v } = this.scope.find(name);
1045 …ndProp(<ts.PropertyAccessExpression | ts.ElementAccessExpression>unaryExpr, objReg, propReg, this);
1064 this.compileExpression(unaryExpr);
1073 this.compileExpression(expr.expression);
1074 this.pandaGen.typeOf(expr);
1078 let pandaGen = this.pandaGen;
1081 this.compileExpression(expr.expression);
1086 let pandaGen = this.pandaGen;
1088 …if (!(this.funcBuilder instanceof AsyncFunctionBuilder || this.funcBuilder instanceof AsyncGenerat…
1093 this.compileExpression(expr.expression);
1094 this.funcBuilder.await(expr);
1097 this.funcBuilder.await(expr);
1102 let pandaGen = this.pandaGen;
1109 let lref = LReference.generateLReference(this, expr.operand, false);
1120 this.compileExpression(expr.operand);
1132 let pandaGen = this.pandaGen;
1135 let lref = LReference.generateLReference(this, expr.operand, false);
1156 let pandaGen = this.pandaGen;
1164 this.compileExpression(expr.left);
1169 this.compileExpression(expr.right);
1183 this.compileExpression(expr.left);
1188 this.compileExpression(expr.right);
1201 this.compileExpression(expr.left);
1212 this.compileExpression(expr.right);
1217 …throw new Error("BinaryExpression with operatorToken " + this.getNodeName(expr.operatorToken) + " …
1224this.compileAssignmentExpression(expr.left, expr.right, <AssignmentOperator>expr.operatorToken.kin…
1231 this.compileLogicalExpression(expr);
1235 let pandaGen = this.pandaGen;
1237 this.compileExpression(expr.left);
1239 this.compileExpression(expr.right);
1252 this.compileCondition(expr.condition, falseLabel);
1253 this.compileExpression(expr.whenTrue);
1254 this.pandaGen.branch(expr, endLabel);
1255 this.pandaGen.label(expr, falseLabel);
1256 this.compileExpression(expr.whenFalse);
1257 this.pandaGen.label(expr, endLabel);
1261 let internalName = this.compilerDriver.getFuncInternalName(expr, this.recorder);
1262 this.pandaGen.defineFunction(expr, expr, internalName);
1267 this.compileExpression(span);
1269 let lrh = this.pandaGen.getTemp();
1273 this.pandaGen.storeAccumulator(expr, lrh);
1274 this.pandaGen.loadAccumulatorString(expr, text);
1275 this.pandaGen.binary(expr, ts.SyntaxKind.PlusToken, lrh);
1278 this.pandaGen.freeTemps(lrh);
1282 let pandaGen = this.pandaGen;
1292 this.compileTemplateSpan(spanExp);
1302 this.pandaGen.loadAccumulatorString(expr, text);
1306 let pandaGen = this.pandaGen;
1312 …s: argRegs, passThis: passThis } = getHiddenParameters(expr.tag, this); // +3 for function and this
1321 this.compileExpression(spanExp.expression);
1334 let lref = LReference.generateLReference(this, lhs, false);
1337 let lhsVreg = this.pandaGen.getTemp();
1340 this.pandaGen.storeAccumulator(lhs, lhsVreg);
1341 this.compileExpression(rhs);
1342 this.pandaGen.binary(lhs.parent, operator, lhsVreg);
1343 this.pandaGen.freeTemps(lhsVreg);
1345 this.compileExpression(rhs);
1352 let scope = <Scope>this.recorder.getScopeOfNode(node);
1353 this.scope = scope;
1355 DebugInfo.addDebugIns(scope, this.pandaGen, true);
1360 DebugInfo.addDebugIns(this.scope, this.pandaGen, false);
1361 this.scope = <Scope>this.scope.getParent();
1369 let pandaGen = this.pandaGen;
1370 let thisInfo = this.getCurrentScope().find(MandatoryThis);
1384 let pandaGen = this.pandaGen;
1385 let thisInfo = this.getCurrentScope().find(MandatoryThis);
1399 return this.pandaGen;
1403 return this.scope;
1407 return this.compilerDriver;
1411 return this.recorder;
1415 return this.funcBuilder;
1426 this.pandaGen.stLetOrClassToGlobalRecord(node, variable.v.getName());
1428 this.pandaGen.stConstToGlobalRecord(node, variable.v.getName());
1435 this.pandaGen.tryStoreGlobalByName(node, variable.v.getName());
1439this.pandaGen.storeAccToLexEnv(node, variable.scope!, variable.level, variable.v, isDeclaration);
1442 this.pandaGen.tryStoreGlobalByName(node, variable.v.getName());
1444 this.pandaGen.storeGlobalVar(node, variable.v.getName());
1449 let nameReg = this.pandaGen.getTemp();
1450 this.pandaGen.loadAccumulatorString(node, variable.v.getName());
1451 this.pandaGen.storeAccumulator(node, nameReg);
1452 this.pandaGen.throwConstAssignment(node, nameReg);
1453 this.pandaGen.freeTemps(nameReg);
1462 let valueReg = this.pandaGen.getTemp();
1463 this.pandaGen.storeAccumulator(node, valueReg);
1464 this.pandaGen.loadModuleVariable(node, variable.v, true);
1465 this.pandaGen.throwUndefinedIfHole(node, variable.v.getName());
1466 this.pandaGen.loadAccumulator(node, valueReg);
1467 this.pandaGen.freeTemps(valueReg);
1470 this.pandaGen.storeModuleVariable(node, variable.v);
1480 this.pandaGen.tryLoadGlobalByName(node, variable.v.getName());
1485this.pandaGen.loadAccFromLexEnv(node, variable.scope!, variable.level, (<LocalVariable>variable.v)…
1491this.pandaGen.loadByNameViaDebugger(node, variable.v.getName(), CacheList.FALSE) :
1492this.pandaGen.loadObjProperty(node, getVregisterCache(this.pandaGen, CacheList.GLOBAL),
1495 this.pandaGen.tryLoadGlobalByName(node, variable.v.getName());
1498 this.pandaGen.loadGlobalVar(node, variable.v.getName());
1502 this.pandaGen.loadModuleVariable(node, variable.v, isLocal);
1504 this.pandaGen.throwUndefinedIfHole(node, variable.v.getName());