• Home
  • Raw
  • Download

Lines Matching refs:ts

16 import ts from 'typescript';
39 export function getInitConstructor(members: ts.NodeArray<ts.Node>, parentComponentName: ts.Identifi…
40 ): ts.ConstructorDeclaration {
42 return ts.isConstructorDeclaration(item);
50 export function updateConstructor(ctorNode: ts.ConstructorDeclaration, para: ts.ParameterDeclaratio…
51 …addStatements: ts.Statement[], decoratorComponentParent: ts.IfStatement[], isSuper: boolean = fals…
52 isAdd: boolean = false, parentComponentName?: ts.Identifier): ts.ConstructorDeclaration {
53 let modifyPara: ts.ParameterDeclaration[];
60 let modifyBody: ts.Statement[];
75 let ctorPara: ts.ParameterDeclaration[] | ts.NodeArray<ts.ParameterDeclaration> =
80 ctorNode = ts.factory.updateConstructorDeclaration(ctorNode,
81 ts.getModifiers(ctorNode), modifyPara || ctorNode.parameters,
82 ts.factory.createBlock(modifyBody || ctorNode.body.statements, true));
87 function initConstructorParams(node: ts.ConstructorDeclaration, parentComponentName: ts.Identifier):
88 ts.ConstructorDeclaration {
89 if (!ts.isIdentifier(parentComponentName)) {
105 const newParameters: ts.ParameterDeclaration[] = Array.from(node.parameters);
111 newParameters.push(ts.factory.createParameterDeclaration(undefined, undefined,
112 ts.factory.createIdentifier(paramName), undefined, undefined,
114ts.factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, ts.factory.createNumericLiteral('…
115 ts.factory.createIdentifier(COMPONENT_IF_UNDEFINED) : undefined));
118 …return ts.factory.updateConstructorDeclaration(node, ts.getModifiers(node), newParameters, node.bo…
121 function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.ParameterDeclaration[],
122 parentComponentName: ts.Identifier): ts.ParameterDeclaration[] {
123 const tsPara: ts.ParameterDeclaration[] | ts.NodeArray<ts.ParameterDeclaration> =
125 const newTSPara: ts.ParameterDeclaration[] = [];
127 let parameter: ts.ParameterDeclaration = item;
130 parameter = ts.factory.updateParameterDeclaration(item, ts.getModifiers(item),
132 ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), item.initializer);
135 parameter = ts.factory.createParameterDeclaration(ts.getModifiers(item),
137 ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(
142 parameter = ts.factory.updateParameterDeclaration(item, ts.getModifiers(item),
144 ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(
148 … parameter = ts.factory.createParameterDeclaration(ts.getModifiers(item), item.dotDotDotToken,
149 …item.name, ts.factory.createToken(ts.SyntaxKind.QuestionToken), ts.factory.createTypeReferenceNode(
150ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_LOCALSTORAGE_TYPE_PU), undefined), item.initiali…
158 export function addConstructor(ctorNode: any, watchMap: Map<string, ts.Node>,
159 parentComponentName: ts.Identifier): ts.ConstructorDeclaration {
160 const watchStatements: ts.ExpressionStatement[] = [];
162 const watchNode: ts.ExpressionStatement = ts.factory.createExpressionStatement(
163 ts.factory.createCallExpression(
164 ts.factory.createPropertyAccessExpression(
165 ts.factory.createThis(),
166 ts.factory.createIdentifier(COMPONENT_WATCH_FUNCTION)
170 ts.factory.createStringLiteral(key),
171 ts.isStringLiteral(value) ?
172 ts.factory.createPropertyAccessExpression(ts.factory.createThis(),
173 ts.factory.createIdentifier(value.text)) : value as ts.PropertyAccessExpression
178 const callSuperStatement: ts.Statement = createCallSuperStatement();
179 const updateWithValueParamsStatement: ts.Statement = createUPdWithValStatement();
184 function createCallSuperStatement(): ts.Statement {
186 return ts.factory.createExpressionStatement(ts.factory.createCallExpression(
187 ts.factory.createSuper(), undefined,
188 [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_ID),
189 ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARENT),
190 ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_LOCALSTORAGE)]));
192 return ts.factory.createExpressionStatement(
193 ts.factory.createCallExpression(ts.factory.createSuper(), undefined,
194 [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARENT),
195 ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_LOCALSTORAGE_PU),
196 ts.factory.createIdentifier(ELMTID),
197 ts.factory.createIdentifier(CUSTOM_COMPONENT_EXTRAINFO)]));
201 function createUPdWithValStatement(): ts.Statement {
202 return ts.factory.createExpressionStatement(
203 ts.factory.createCallExpression(
204 ts.factory.createPropertyAccessExpression(
205 ts.factory.createThis(),
206 ts.factory.createIdentifier(
212 [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)]