Lines Matching refs:node
303 export function isObservedClass(node: ts.Node): boolean {
304 if (ts.isClassDeclaration(node) && hasDecorator(node, COMPONENT_OBSERVED_DECORATOR)) {
310 export function isCustomDialogClass(node: ts.Node): boolean {
311 if (ts.isStructDeclaration(node) && hasDecorator(node, COMPONENT_DECORATOR_CUSTOM_DIALOG)) {
323 …component: ts.Identifier, log: LogInfo[], sourceFile: ts.SourceFile, node: ts.StructDeclaration): …
336 checkEntryComponent(node, log, sourceFile);
339 componentCollection.entryComponentPos = node.getStart();
397 function checkConcurrentDecorator(node: ts.FunctionDeclaration | ts.MethodDeclaration, log: LogInfo…
399 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
404 if (ts.isMethodDeclaration(node)) {
408 if (node.asteriskToken) {
410 const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined;
419 function collectLocalStorageName(node: ts.Decorator): void {
420 if (node && node.expression && ts.isCallExpression(node.expression)) {
421 if (node.expression.arguments && node.expression.arguments.length) {
422 node.expression.arguments.forEach((item: ts.Node, index: number) => {
448 function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponentNames: Set<string>,
451 if (ts.isStructDeclaration(node) && node.name && ts.isIdentifier(node.name)) {
453 const structName: string = node.name.escapedText.toString();
456 processStructComponentV2.parseComponentProperty(node, structInfo, log, sourceFileNode);
459 collectComponentProps(node, structInfo);
462 if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) {
464 …[isObservedV1Class, isObservedClass, isSendableClass] = parseClassDecorator(node, sourceFileNode, …
466 if (ts.isMethodDeclaration(node) || ts.isFunctionDeclaration(node)) {
467 methodDecoratorCollect(node);
468 if (hasDecorator(node, COMPONENT_CONCURRENT_DECORATOR)) {
470 checkConcurrentDecorator(node, log, sourceFileNode);
472 validateFunction(node, sourceFileNode, log);
474 checkDecoratorCount(node, sourceFileNode, log);
475 …checkDecorator(sourceFileNode, node, log, structContext, classContext, isObservedClass, isComponen…
477 …ts.forEachChild(node, (child: ts.Node) => visitAllNode(child, sourceFileNode, allComponentNames, l…
531 function validatePropertyType(node: ts.TypeNode, classResult: ClassDecoratorResult): void {
532 if (ts.isUnionTypeNode(node) && node.types && node.types.length) {
533 node.types.forEach((item: ts.TypeNode) => {
537 if (ts.isTypeReferenceNode(node) && node.typeName) {
538 const typeNode: ts.Type = globalProgram.checker.getTypeAtLocation(node.typeName);
563 function checkDecoratorCount(node: ts.Node, sourceFileNode: ts.SourceFile, log: LogInfo[]): void {
564 if (ts.isPropertyDeclaration(node) || ts.isGetAccessor(node) || ts.isMethodDeclaration(node)) {
565 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
595 …getMessageCollection().checkLocalBuilderDecoratorCount(node, sourceFileNode, checkDecoratorCount, …
598 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
606 …addLog(v1Duplicate ? LogType.WARN : LogType.ERROR, duplicateMessage, node.getStart(), log, sourceF…
611 function methodDecoratorCollect(node: ts.MethodDeclaration | ts.FunctionDeclaration): void {
617 if (isBuilderOrLocalBuilder(node, builderCondition)) {
619 CUSTOM_BUILDER_METHOD.add(node.name.getText());
620 if (ts.isFunctionDeclaration(node)) {
621 GLOBAL_CUSTOM_BUILDER_METHOD.add(node.name.getText());
623 INNER_CUSTOM_BUILDER_METHOD.add(node.name.getText());
626 INNER_CUSTOM_LOCALBUILDER_METHOD.add(node.name.getText());
628 } else if (ts.isFunctionDeclaration(node) && isExtendFunction(node, extendResult)) {
630 collectExtend(EXTEND_ATTRIBUTE, extendResult.componentName, node.name.getText());
634 extendResult.componentName, node.name.getText());
636 } else if (hasDecorator(node, COMPONENT_STYLES_DECORATOR)) {
637 collectStyles(node);
641 function collectStyles(node: ts.FunctionLikeDeclarationBase): void {
642 if (ts.isBlock(node.body) && node.body.statements) {
643 if (ts.isFunctionDeclaration(node)) {
644 GLOBAL_STYLE_FUNCTION.set(node.name.getText(), node.body);
646 INNER_STYLE_FUNCTION.set(node.name.getText(), node.body);
648 STYLES_ATTRIBUTE.add(node.name.getText());
649 BUILDIN_STYLE_NAMES.add(node.name.getText());
653 function validateFunction(node: ts.MethodDeclaration | ts.FunctionDeclaration,
655 if (ts.isFunctionDeclaration(node)) {
656 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
669 addLog(LogType.WARN, message, node.getStart(), log, sourceFileNode);
675 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
680 function checkDecorator(sourceFileNode: ts.SourceFile, node: ts.Node,
683 if (ts.isIdentifier(node) && (ts.isDecorator(node.parent) ||
684 (ts.isCallExpression(node.parent) && ts.isDecorator(node.parent.parent)))) {
685 const decoratorName: string = node.escapedText.toString();
687 validateStructDecorator(sourceFileNode, node, log, structContext, decoratorName, isComponentV2);
688 validateMethodDecorator(sourceFileNode, node, log, structContext, decoratorName);
689 validateClassDecorator(sourceFileNode, node, log, classContext, decoratorName, isObservedClass,
691 validatePropertyInStruct(structContext, node, decoratorName, sourceFileNode, log);
694 if (ts.isDecorator(node)) {
695 validateSingleDecorator(node, sourceFileNode, log, isComponentV2);
705 function validateSingleDecorator(node: ts.Decorator, sourceFileNode: ts.SourceFile,
707 const decoratorName: string = node.getText().replace(/\([^\(\)]*\)/, '');
708 …if (decoratorName === constantDefine.COMPUTED_DECORATOR && node.parent && !ts.isGetAccessor(node.p…
710 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
714 if (partialDecoratorCollection.includes(decoratorName) && node.parent &&
715 !ts.isMethodDeclaration(node.parent)) {
717 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
720 if (isMemberForComponentV2(decoratorName, isComponentV2) && node.parent &&
721 !ts.isPropertyDeclaration(node.parent)) {
723 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
737 function validTypeCallback(node: ts.Identifier): boolean {
740 const symbolObj: ts.Symbol = getSymbolIfAliased(node);
754 function validateClassDecorator(sourceFileNode: ts.SourceFile, node: ts.Identifier, log: LogInfo[],
757 const isTypeFromSdk: boolean = validTypeCallback(node);
760 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
762 …validateMemberInClass(isObservedClass, decoratorName, node, log, sourceFileNode, isObservedV1Class…
766 function validateMemberInClass(isObservedClass: boolean, decoratorName: string, node: ts.Identifier,
771 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
777 validType(sourceFileNode, node, log, decoratorName, isObservedV1Class, isSendableClass);
781 if (!isObservedClass || !isPropertyForTrace(node, decoratorName)) {
784 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
789 function validType(sourceFileNode: ts.SourceFile, node: ts.Identifier, log: LogInfo[], decoratorNam…
793 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
797 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
799 …if (ts.isDecorator(node.parent?.parent) && !ts.isPropertyDeclaration(node.parent?.parent?.parent))…
801 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
805 function isPropertyForTrace(node: ts.Identifier, decoratorName: string): boolean {
806 if (decoratorName === CLASS_MIN_TRACK_DECORATOR && ts.isDecorator(node.parent) &&
807 !ts.isPropertyDeclaration(node.parent.parent)) {
819 function parseClassDecorator(node: ts.ClassDeclaration, sourceFileNode: ts.SourceFile,
821 const classResult: ClassDecoratorResult = getClassDecoratorResult(node);
822 validateMutilObserved(node, classResult, sourceFileNode, log);
824 parseInheritClass(node, classResult, sourceFileNode, log);
829 function getClassDecoratorResult(node: ts.ClassDeclaration): ClassDecoratorResult {
831 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
850 function validateMutilObserved(node: ts.ClassDeclaration, classResult: ClassDecoratorResult,
854 addLog(LogType.ERROR, message, node.getStart(), log, sourceFileNode);
858 function parseInheritClass(node: ts.ClassDeclaration, childClassResult: ClassDecoratorResult,
860 if (globalProgram.checker && process.env.compileTool === 'rollup' && node.heritageClauses) {
861 for (const heritageClause of node.heritageClauses) {
864 … getClassNode(heritageClause.types[0].expression, childClassResult, node, sourceFileNode, log);
889 function parseShorthandPropertyForClass(node: ts.ShorthandPropertyAssignment, childClassResult: Cla…
891 const shortSymbol: ts.Symbol = globalProgram.checker.getShorthandAssignmentValueSymbol(node);
897 function getSymbolIfAliased(node: ts.Node): ts.Symbol {
898 const symbol: ts.Symbol = globalProgram.checker.getSymbolAtLocation(node);
922 function validateStructDecorator(sourceFileNode: ts.SourceFile, node: ts.Identifier, log: LogInfo[],
929 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
933 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
937 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
941 function validateMethodDecorator(sourceFileNode: ts.SourceFile, node: ts.Identifier, log: LogInfo[],
944 if (ts.isMethodDeclaration(node.parent.parent) ||
945 (ts.isDecorator(node.parent.parent) && ts.isMethodDeclaration(node.parent.parent.parent))) {
953 addLog(LogType.ERROR, message, node.pos, log, sourceFileNode);
981 node: ts.EtsComponentExpression,
986 if (ts.isIdentifier(node.expression)) {
987 checkNoChildComponent(node, sourceFileNode, log);
988 checkOneChildComponent(node, allComponentNames, sourceFileNode, log);
989 checkSpecificChildComponent(node, allComponentNames, sourceFileNode, log);
998 function checkNoChildComponent(node: ts.EtsComponentExpression, sourceFileNode: ts.SourceFile, log:…
1000 if (hasChild(node, isCheckType)) {
1001 const componentName: string = (node.expression as ts.Identifier).escapedText.toString();
1002 const pos: number = node.expression.getStart();
1011 function hasChild(node: ts.EtsComponentExpression, isCheckType: ParamType): boolean {
1012 const nodeName: ts.Identifier = node.expression as ts.Identifier;
1013 …if ((AUTOMIC_COMPONENT.has(nodeName.escapedText.toString()) || judgeComponentType(nodeName, node, …
1014 getNextNode(node)) {
1044 function getNextNode(node: ts.EtsComponentExpression): ts.Block {
1045 if (node.body && ts.isBlock(node.body)) {
1046 const statementsArray: ts.Block = node.body;
1052 function checkOneChildComponent(node: ts.EtsComponentExpression, allComponentNames: Set<string>,
1055 if (hasNonSingleChild(node, allComponentNames, isCheckType)) {
1056 const componentName: string = (node.expression as ts.Identifier).escapedText.toString();
1057 const pos: number = node.expression.getStart();
1066 function hasNonSingleChild(node: ts.EtsComponentExpression, allComponentNames: Set<string>,
1068 const nodeName: ts.Identifier = node.expression as ts.Identifier;
1069 const blockNode: ts.Block = getNextNode(node);
1070 …MPONENT.has(nodeName.escapedText.toString()) || !judgeComponentType(nodeName, node, isCheckType) &&
1124 function isComponent(node: ts.EtsComponentExpression | ts.CallExpression, allComponentNames: Set<st…
1125 if (ts.isIdentifier(node.expression) &&
1126 allComponentNames.has(node.expression.escapedText.toString())) {
1132 function isForEachComponent(node: ts.EtsComponentExpression | ts.CallExpression): boolean {
1133 if (ts.isIdentifier(node.expression)) {
1134 const componentName: string = node.expression.escapedText.toString();
1147 function getStatementCount(node: ts.Node, allComponentNames: Set<string>): number {
1149 if (!node) {
1151 } else if (ts.isBlock(node)) {
1152 maxCount = getBlockChildrenCount(node, allComponentNames);
1153 } else if (ts.isIfStatement(node)) {
1154 maxCount = getIfChildrenCount(node, allComponentNames);
1155 } else if (ts.isExpressionStatement(node) && ts.isEtsComponentExpression(node.expression) &&
1156 isForEachComponent(node.expression)) {
1158 } else if (ts.isExpressionStatement(node) && ts.isEtsComponentExpression(node.expression) &&
1159 !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames)) {
1165 function checkSpecificChildComponent(node: ts.EtsComponentExpression, allComponentNames: Set<string…
1167 if (hasNonspecificChild(node, allComponentNames)) {
1168 const componentName: string = (node.expression as ts.Identifier).escapedText.toString();
1169 const pos: number = node.expression.getStart();
1178 function hasNonspecificChild(node: ts.EtsComponentExpression,
1180 const nodeName: ts.Identifier = node.expression as ts.Identifier;
1182 const blockNode: ts.Block = getNextNode(node);
1233 function isNonspecificChildIf(node: ts.IfStatement, specificChildSet: Set<string>,
1235 return isNonspecificChildIfStatement(node.thenStatement, specificChildSet, allComponentNames) ||
1236 isNonspecificChildIfStatement(node.elseStatement, specificChildSet, allComponentNames);
1239 function isNonspecificChildForEach(node: ts.EtsComponentExpression, specificChildSet: Set<string>,
1241 if (ts.isCallExpression(node) && node.arguments &&
1242 node.arguments.length > 1 && ts.isArrowFunction(node.arguments[1])) {
1243 const arrowFunction: ts.ArrowFunction = node.arguments[1] as ts.ArrowFunction;
1268 function isNonspecificChildNonForEach(node: ts.EtsComponentExpression,
1270 if (ts.isIdentifier(node.expression) &&
1271 !specificChildSet.has(node.expression.escapedText.toString())) {
1277 function isNonspecificChildIfStatement(node: ts.Node, specificChildSet: Set<string>,
1279 if (!node) {
1282 if (ts.isBlock(node) && isNonspecificChildBlock(node, specificChildSet, allComponentNames)) {
1285 if (ts.isIfStatement(node) && isNonspecificChildIf(node, specificChildSet, allComponentNames)) {
1288 if (ts.isExpressionStatement(node) && ts.isEtsComponentExpression(node.expression) &&
1289 isForEachComponent(node.expression) &&
1290 isNonspecificChildForEach(node.expression, specificChildSet, allComponentNames)) {
1293 if (ts.isExpressionStatement(node) && ts.isEtsComponentExpression(node.expression) &&
1294 !isForEachComponent(node.expression) && isComponent(node.expression, allComponentNames) &&
1295 isNonspecificChildNonForEach(node.expression, specificChildSet)) {
1301 function collectComponentProps(node: ts.StructDeclaration, structInfo: StructInfo): void {
1302 const componentName: string = node.name.getText();
1303 const componentSet: IComponentSet = getComponentSet(node, true);
1332 export function getComponentSet(node: ts.StructDeclaration, uiCheck: boolean = false): IComponentSe…
1334 traversalComponentProps(node, componentSet, uiCheck);
1347 function traversalComponentProps(node: ts.StructDeclaration, componentSet: IComponentSet,
1350 if (node.members) {
1352 node.members.forEach(item => {
1386 collectCurrentClassMethod(node, currentMethodCollection);
1388 isStaticViewCollection.set(node.name.getText(), isStatic);
1391 function collectCurrentClassMethod(node: ts.StructDeclaration, currentMethodCollection: Set<string>…
1393 componentMethodCollection.set(node.name.getText(), currentMethodCollection);
1394 const sourceFile: ts.SourceFile = node.getSourceFile();
1400 } else if (!pageMethodCollection.get(node.name.getText())) {
1401 pageMethodCollection.set(node.name.getText(), currentMethodCollection);
1412 function validateAccessQualifier(node: ts.PropertyDeclaration, propertyName: string,
1420 pos: node.getStart()
1428 pos: node.getStart()
1435 pos: node.getStart()
1458 function getAccessQualifier(node: ts.PropertyDeclaration, uiCheck: boolean = false): AccessQualifie…
1459 const modifiers: readonly ts.Modifier[] = ts.getModifiers(node);
1473 pos: node.getStart()
1507 function collectionStates(node: ts.Decorator, decorator: string, name: string,
1542 collectionlocalStorageParam(node, name, componentSet.localStorageLink);
1545 collectionlocalStorageParam(node, name, componentSet.localStorageProp);
1553 function collectionlocalStorageParam(node: ts.Decorator, name: string,
1556 if (node && ts.isCallExpression(node.expression) && node.expression.arguments &&
1557 node.expression.arguments.length) {
1559 node.expression.arguments[0].getText()));
1751 function checkEntryComponent(node: ts.StructDeclaration, log: LogInfo[], sourceFile: ts.SourceFile)…
1752 const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined;
1758 addLog(LogType.WARN, message, node.getStart(), log, sourceFile);
1765 function validateStateVariable(node: ts.MethodDeclaration): void {
1766 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);