• Home
  • Raw
  • Download

Lines Matching full:astnode

193    * @param astNode
195 const visitExport = function (astNode, isSystemApi: boolean): void {
202 if (isExportAssignment(astNode)) {
203 let nodeName = astNode.expression.getText();
210 if (isExportDeclaration(astNode) && astNode.exportClause) {
216 if (isNamedExports(astNode.exportClause)) {
217 for (const element of astNode.exportClause.elements) {
228 if (isNamespaceExport(astNode.exportClause)) {
229 const exportElementName = astNode.exportClause.name.getText();
242 let {hasExport, hasDeclare} = getKeyword(astNode.modifiers);
247 if (astNode.name) {
248 let nodeName = astNode.name.getText();
256 if (hasDeclare && astNode.declarationList) {
257 astNode.declarationList.declarations.forEach((declaration) => {
266 const isCollectedExportNames = function (astNode): boolean {
267 if (astNode.name && !mCurrentExportNameSet.has(astNode.name.getText())) {
271 if (astNode.name === undefined) {
272 let {hasDeclare} = getKeyword(astNode.modifiers);
273 if (hasDeclare && astNode.declarationList &&
274 !mCurrentExportNameSet.has(astNode.declarationList.declarations[0].name.getText())) {
284 * @param astNode
286 const visitChildNode = function (astNode, isSdkApi: boolean = false): void {
287 if (!astNode) {
290 if (astNode.name !== undefined && !mCurrentExportedPropertySet.has(astNode.name.getText())) {
292 if (!notAddParameter || (!isParameter(astNode) && !isTypeParameterDeclaration(astNode))) {
293 … const nameToAdd = isStringLiteral(astNode.name) ? astNode.name.text : astNode.name.getText();
298 astNode.forEachChild((childNode) => {
305 const visitNodeForConstructorProperty = function (astNode): void {
306 if (!astNode) {
310 if (isConstructorDeclaration(astNode)) {
325 astNode?.parameters?.forEach((param) => {
330 astNode.forEachChild((childNode) => {
337 * @param astNode node of ast
339 const visitPropertyAndNameForSdk = function (astNode): void {
340 if (!isCollectedExportNames(astNode)) {
343 * @param astNode elements of sourcefile
345 collectPropertyNames(astNode);
349 visitChildNode(astNode, true);
364 …const addCommonJsExports = function (astNode: Node, isRemoteHarOrSystemApi: boolean = false): void…
365 if (!isExpressionStatement(astNode) || !astNode.expression) {
369 const expression = astNode.expression;
489 * @param astNode
491 const visitProjectExport = function (astNode, isRemoteHarFile: boolean): void {
492 if (isExportAssignment(astNode)) {
493 handleExportAssignment(astNode);
497 if (isExportDeclaration(astNode)) {
498 handleExportDeclaration(astNode, isRemoteHarFile);
502 let {hasExport} = getKeyword(astNode.modifiers);
504 addCommonJsExports(astNode, isRemoteHarFile);
505 forEachChild(astNode, node => visitProjectExport(node, isRemoteHarFile));
509 if (astNode.name) {
510 if (!mCurrentExportNameSet.has(astNode.name.getText())) {
511 mCurrentExportNameSet.add(astNode.name.getText());
512 mCurrentExportedPropertySet.add(astNode.name.getText());
515 forEachChild(astNode, node => visitProjectExport(node, isRemoteHarFile));
519 if (isClassDeclaration(astNode)) {
520 getClassProperties(astNode, mCurrentExportedPropertySet);
524 if (isVariableStatement(astNode)) {
525 astNode.declarationList.forEachChild((child) => {
535 forEachChild(astNode, node => visitProjectExport(node, isRemoteHarFile));
538 function handleExportAssignment(astNode): void {
540 if (isBinaryExpression(astNode.expression)) {
541 if (isObjectLiteralExpression(astNode.expression.right)) {
542 getObjectProperties(astNode.expression.right, mCurrentExportedPropertySet);
546 if (isClassExpression(astNode.expression.right)) {
547 getClassProperties(astNode.expression.right, mCurrentExportedPropertySet);
555 if (isIdentifier(astNode.expression)) {
556 if (!mCurrentExportNameSet.has(astNode.expression.getText())) {
557 mCurrentExportNameSet.add(astNode.expression.getText());
558 mCurrentExportedPropertySet.add(astNode.expression.getText());
563 if (isObjectLiteralExpression(astNode.expression)) {
564 getObjectProperties(astNode.expression, mCurrentExportedPropertySet);
568 function handleExportDeclaration(astNode: ExportDeclaration, isRemoteHarFile: boolean): void {
569 if (astNode.exportClause) {
570 if (astNode.exportClause.kind === SyntaxKind.NamedExports) {
571 astNode.exportClause.forEachChild((child) => {
578 if (isRemoteHarFile || astNode.moduleSpecifier) {
606 if (astNode.exportClause.kind === SyntaxKind.NamespaceExport) {
607 mCurrentExportedPropertySet.add(astNode.exportClause.name.getText());
619 * @param astNode
621 const visitProjectNode = function (astNode): void {
623 let nodeName: string | undefined = astNode.name?.text;
624 if ((isClassDeclaration(astNode) || isStructDeclaration(astNode))) {
625 getClassProperties(astNode, currentPropsSet);
626 } else if (isEnumDeclaration(astNode)) { // collect export enum structure properties
627 getEnumProperties(astNode, currentPropsSet);
628 } else if (isVariableDeclaration(astNode)) {
629 if (astNode.initializer) {
630 if (isObjectLiteralExpression(astNode.initializer)) {
631 getObjectProperties(astNode.initializer, currentPropsSet);
632 } else if (isClassExpression(astNode.initializer)) {
633 getClassProperties(astNode.initializer, currentPropsSet);
636 nodeName = astNode.name?.getText();
637 } else if (isInterfaceDeclaration(astNode)) {
638 getInterfaceProperties(astNode, currentPropsSet);
639 } else if (isTypeAliasDeclaration(astNode)) {
640 getTypeAliasProperties(astNode, currentPropsSet);
641 } else if (isElementAccessExpression(astNode)) {
642 getElementAccessExpressionProperties(astNode);
643 } else if (isIndexedAccessTypeNode(astNode)) {
644 getIndexedAccessTypeProperties(astNode);
645 } else if (isObjectLiteralExpression(astNode)) {
646 getObjectProperties(astNode, currentPropsSet);
647 } else if (isClassExpression(astNode)) {
648 getClassProperties(astNode, currentPropsSet);
651 addPropWhiteList(nodeName, astNode, currentPropsSet);
653 forEachChild(astNode, visitProjectNode);
656 …function addPropWhiteList(nodeName: string | undefined, astNode: Node, currentPropsSet: Set<string…
661 …jectConfig.isHarCompiled && scanProjectConfig.mPropertyObfuscation && isEnumDeclaration(astNode)) {
971 * @param astNode Nodes of the AST.
973 function collectPropertyNames(astNode: Node): void {
974 visitElementsWithProperties(astNode);