• Home
  • Raw
  • Download

Lines Matching refs:node

143 export function processComponentClass(node: ts.StructDeclaration, context: ts.TransformationContext,
145 const decoratorNode: readonly ts.Decorator[] = ts.getAllDecorators(node);
147 … processMembers(node.members, node.name, context, decoratorNode, log, program, checkPreview(node));
148 return ts.factory.createClassDeclaration(ts.getModifiers(node), node.name,
149 node.typeParameters, updateHeritageClauses(node, log), memberNode);
152 function checkPreview(node: ts.StructDeclaration): boolean {
154 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
155 if (node && decorators) {
478 function createLocalStroageCallExpression(node: ts.PropertyDeclaration, name: string,
480 const decorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
481 if (isSingleKey(node)) {
489node.initializer ? node.initializer : ts.factory.createNumericLiteral(COMPONENT_CONSTRUCTOR_UNDEFI… constant
510 [node.type],
516 function processComponentMethod(node: ts.MethodDeclaration, parentComponentName: ts.Identifier,
518 let updateItem: ts.MethodDeclaration = node;
519 const name: string = node.name.getText();
531 if (node.parameters.length) {
535 pos: node.getStart()
538 const buildNode: ts.MethodDeclaration = processComponentBuild(node, log);
540 } else if (node.body && ts.isBlock(node.body)) {
542 updateItem = ts.factory.updateMethodDeclaration(node, ts.getModifiers(node),
543 node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters,
544 node.type, processComponentBlock(node.body, false, log, true));
545 } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR, customBuilder)) {
550 builderTypeParameter.params = getPossibleBuilderTypeParameter(node.parameters);
551 …s: ts.NodeArray<ts.ParameterDeclaration> = ts.factory.createNodeArray(Array.from(node.parameters));
556 const modifiers = ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined;
557 const builderNode: ts.MethodDeclaration = ts.factory.updateMethodDeclaration(node,
558 …ecoratorsAndModifiers(customBuilder, modifiers), node.asteriskToken, node.name, node.questionToken…
559 parameters, node.type, processComponentBlock(node.body, false, log, false, true));
563 } else if (hasDecorator(node, COMPONENT_STYLES_DECORATOR)) {
564 if (node.parameters && node.parameters.length === 0) {
565 if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length) {
566 INNER_STYLE_FUNCTION.set(name, node.body);
575 pos: node.getStart()
590 export function processBuildMember(node: ts.MethodDeclaration | ts.FunctionDeclaration, context: ts…
592 return ts.visitNode(node, visitBuild);
593 function visitBuild(node: ts.Node): ts.Node {
594 if (isGeometryView(node)) {
595 node = processGeometryView(node as ts.ExpressionStatement, log);
597 if (isProperty(node)) {
598 node = createReference(node as ts.PropertyAssignment, log, isBuilder);
600 if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) &&
601 …stateObjectCollection.has(checkStateName(node)) && node.parent && ts.isCallExpression(node.parent)…
602 ts.isPropertyAccessExpression(node.parent.expression) && node !== node.parent.expression &&
603 node.parent.expression.name.escapedText.toString() !== FOREACH_GET_RAW_OBJECT) {
606 ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [node]);
608 return ts.visitEachChild(node, visitBuild, context);
610 function checkStateName(node: ts.PropertyAccessExpression): string {
611 if (node.expression && !node.expression.expression && node.name && ts.isIdentifier(node.name)) {
612 return node.name.escapedText.toString();
618 function isGeometryView(node: ts.Node): boolean {
619 if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression)) {
620 const call: ts.CallExpression = node.expression;
633 function processGeometryView(node: ts.ExpressionStatement,
635 const exp: ts.CallExpression = node.expression as ts.CallExpression;
638 return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression(exp,
644 function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpression,
647 if (ts.isBlock(node.body)) {
648 blockNode = node.body;
649 } else if (ts.isArrowFunction(node) && ts.isCallExpression(node.body)) {
650 blockNode = ts.factory.createBlock([ts.factory.createExpressionStatement(node.body)]);
655 function updateHeritageClauses(node: ts.StructDeclaration, log: LogInfo[])
657 if (node.heritageClauses && !checkHeritageClauses(node)) {
661 pos: node.heritageClauses.pos
670 function checkHeritageClauses(node: ts.StructDeclaration): boolean {
671 if (node.heritageClauses.length === 1 && node.heritageClauses[0].types &&
672 node.heritageClauses[0].types.length === 1) {
673 const expressionNode: ts.ExpressionWithTypeArguments = node.heritageClauses[0].types[0];
682 export function isProperty(node: ts.Node): Boolean {
683 if (judgmentParentType(node)) {
684 if (node.parent.parent.expression && ts.isIdentifier(node.parent.parent.expression) &&
685 !BUILDIN_STYLE_NAMES.has(node.parent.parent.expression.escapedText.toString()) &&
687 node.parent.parent.expression.escapedText.toString())) {
689 } else if (ts.isPropertyAccessExpression(node.parent.parent.expression) &&
690 ts.isIdentifier(node.parent.parent.expression.expression) &&
692 node.parent.parent.expression.name.escapedText.toString())) {
699 function judgmentParentType(node: ts.Node): boolean {
700 return ts.isPropertyAssignment(node) && node.name && ts.isIdentifier(node.name) &&
701 node.parent && ts.isObjectLiteralExpression(node.parent) && node.parent.parent &&
702 (ts.isCallExpression(node.parent.parent) || ts.isEtsComponentExpression(node.parent.parent));
705 export function createReference(node: ts.PropertyAssignment, log: LogInfo[], isBuilder = false,
707 const linkParentComponent: string[] = getParentNode(node, linkCollection).slice(1);
708 const propertyName: ts.Identifier = node.name as ts.Identifier;
711 if (isRecycleComponent && ts.isShorthandPropertyAssignment(node)) {
712 return node;
714 const initExpression: ts.Expression = node.initializer;
733node = addDoubleUnderline(node, propertyName, initText, is$$, isParamsLambda, isRecycleComponent);
735 return node;
745 function addDoubleUnderline(node: ts.PropertyAssignment, propertyName: ts.Identifier,
747 return ts.factory.updatePropertyAssignment(node, propertyName,
753 function getParentNode(node: ts.PropertyAssignment, collection: Map<string, Set<string>>): string[]…
754 const grandparentNode: ts.NewExpression = node.parent.parent as ts.NewExpression;