• Home
  • Raw
  • Download

Lines Matching refs:node

139 export function processComponentClass(node: ts.StructDeclaration, context: ts.TransformationContext,
142 processMembers(node.members, node.name, context, log, program, checkPreview(node));
143 return ts.factory.createClassDeclaration(undefined, node.modifiers, node.name,
144 node.typeParameters, updateHeritageClauses(node, log), memberNode);
147 function checkPreview(node: ts.ClassDeclaration) {
149 if (node && node.decorators) {
150 for (let i = 0; i < node.decorators.length; i++) {
151 const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim();
375 function createLocalStroageCallExpression(node: ts.PropertyDeclaration, name: string,
384node.initializer ? node.initializer : ts.factory.createNumericLiteral(COMPONENT_CONSTRUCTOR_UNDEFI…
404 [node.type],
409 function processComponentMethod(node: ts.MethodDeclaration, parentComponentName: ts.Identifier,
411 let updateItem: ts.MethodDeclaration = node;
412 const name: string = node.name.getText();
416 if (node.parameters.length) {
420 pos: node.getStart()
423 const buildNode: ts.MethodDeclaration = processComponentBuild(node, log);
425 } else if (node.body && ts.isBlock(node.body)) {
427 updateItem = ts.factory.updateMethodDeclaration(node, node.decorators, node.modifiers,
428 node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters,
429 node.type, processComponentBlock(node.body, false, log, true));
430 } else if (hasDecorator(node, COMPONENT_BUILDER_DECORATOR, customBuilder)) {
433 builderTypeParameter.params = getPossibleBuilderTypeParameter(node.parameters);
434 …s: ts.NodeArray<ts.ParameterDeclaration> = ts.factory.createNodeArray(Array.from(node.parameters));
436 … const builderNode: ts.MethodDeclaration = ts.factory.updateMethodDeclaration(node, customBuilder,
437 node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters,
438 parameters, node.type, processComponentBlock(node.body, false, log, false, true));
441 } else if (hasDecorator(node, COMPONENT_STYLES_DECORATOR)) {
442 if (node.parameters && node.parameters.length === 0) {
443 if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length) {
444 INNER_STYLE_FUNCTION.set(name, node.body);
453 pos: node.getStart()
468 export function processBuildMember(node: ts.MethodDeclaration | ts.FunctionDeclaration, context: ts…
470 return ts.visitNode(node, visitBuild);
471 function visitBuild(node: ts.Node): ts.Node {
472 if (isGeometryView(node)) {
473 node = processGeometryView(node as ts.ExpressionStatement, log);
475 if (isProperty(node)) {
476 node = createReference(node as ts.PropertyAssignment, log, isBuilder);
478 if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) &&
479 …stateObjectCollection.has(checkStateName(node)) && node.parent && ts.isCallExpression(node.parent)…
480 ts.isPropertyAccessExpression(node.parent.expression) && node !== node.parent.expression &&
481 node.parent.expression.name.escapedText.toString() !== FOREACH_GET_RAW_OBJECT) {
484 ts.factory.createIdentifier(FOREACH_GET_RAW_OBJECT)), undefined, [node]);
486 return ts.visitEachChild(node, visitBuild, context);
488 function checkStateName(node: ts.PropertyAccessExpression): string {
489 if (node.expression && !node.expression.expression && node.name && ts.isIdentifier(node.name)) {
490 return node.name.escapedText.toString();
496 function isGeometryView(node: ts.Node): boolean {
497 if (ts.isExpressionStatement(node) && ts.isCallExpression(node.expression)) {
498 const call: ts.CallExpression = node.expression;
511 function processGeometryView(node: ts.ExpressionStatement,
513 const exp: ts.CallExpression = node.expression as ts.CallExpression;
516 return ts.factory.updateExpressionStatement(node, ts.factory.updateCallExpression(exp,
522 function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpression,
525 if (ts.isBlock(node.body)) {
526 blockNode = node.body;
527 } else if (ts.isArrowFunction(node) && ts.isCallExpression(node.body)) {
528 blockNode = ts.factory.createBlock([ts.factory.createExpressionStatement(node.body)]);
533 function updateHeritageClauses(node: ts.StructDeclaration, log: LogInfo[])
535 if (node.heritageClauses && !checkHeritageClauses(node)) {
539 pos: node.heritageClauses.pos
548 function checkHeritageClauses(node: ts.StructDeclaration): boolean {
549 if (node.heritageClauses.length === 1 && node.heritageClauses[0].types &&
550 node.heritageClauses[0].types.length === 1) {
551 const expressionNode: ts.ExpressionWithTypeArguments = node.heritageClauses[0].types[0];
560 export function isProperty(node: ts.Node): Boolean {
561 if (judgmentParentType(node)) {
562 if (node.parent.parent.expression && ts.isIdentifier(node.parent.parent.expression) &&
563 !BUILDIN_STYLE_NAMES.has(node.parent.parent.expression.escapedText.toString()) &&
565 node.parent.parent.expression.escapedText.toString())) {
567 } else if (ts.isPropertyAccessExpression(node.parent.parent.expression) &&
568 ts.isIdentifier(node.parent.parent.expression.expression) &&
570 node.parent.parent.expression.name.escapedText.toString())) {
577 function judgmentParentType(node: ts.Node): boolean {
578 return ts.isPropertyAssignment(node) && node.name && ts.isIdentifier(node.name) &&
579 node.parent && ts.isObjectLiteralExpression(node.parent) && node.parent.parent &&
580 (ts.isCallExpression(node.parent.parent) || ts.isEtsComponentExpression(node.parent.parent));
583 export function createReference(node: ts.PropertyAssignment, log: LogInfo[], isBuilder = false,
585 const linkParentComponent: string[] = getParentNode(node, linkCollection).slice(1);
586 const propParentComponent: string[] = getParentNode(node, propCollection).slice(1);
587 const propertyName: ts.Identifier = node.name as ts.Identifier;
590 if (isRecycleComponent && ts.isShorthandPropertyAssignment(node)) {
591 return node;
593 const initExpression: ts.Expression = node.initializer;
612node = addDoubleUnderline(node, propertyName, initText, is$$, isParamsLambda, isRecycleComponent);
614 return node;
624 function addDoubleUnderline(node: ts.PropertyAssignment, propertyName: ts.Identifier,
626 return ts.factory.updatePropertyAssignment(node, propertyName,
632 function getParentNode(node: ts.PropertyAssignment, collection: Map<string, Set<string>>): string[]…
633 const grandparentNode: ts.NewExpression = node.parent.parent as ts.NewExpression;