• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import ts from 'typescript';
17
18import {
19  LogInfo,
20  LogType,
21  addLog,
22  removeDecorator
23} from './utils';
24import {
25  COMPONENT_CONSTRUCTOR_PARENT,
26  COMPONENT_CONSTRUCTOR_PARAMS,
27  COMPONENT_CONSTRUCTOR_LOCALSTORAGE_PU,
28  ELMTID,
29  COMPONENT_PARAMS_LAMBDA_FUNCTION,
30  CUSTOM_COMPONENT_EXTRAINFO,
31  COMPONENT_CONSTRUCTOR_UNDEFINED
32} from './pre_define';
33import constantDefine from './constant_define';
34import createAstNodeUtils from './create_ast_node_utils';
35import {
36  updateHeritageClauses,
37  processComponentMethod,
38  BuildCount,
39  addRerenderFunc,
40  validateBuildMethodCount,
41  getEntryNameFunction,
42  FreezeParamType,
43  decoratorAssignParams
44} from './process_component_class';
45import { judgeBuilderParamAssignedByBuilder } from './process_component_member';
46import {
47  componentCollection,
48  builderParamObjectCollection
49} from './validate_ui_syntax';
50
51export class ParamDecoratorInfo {
52  initializer: ts.Expression;
53  hasRequire: boolean = false;
54}
55
56export class StructInfo {
57  isComponentV1: boolean = false;
58  isComponentV2: boolean = false;
59  isCustomDialog: boolean = false;
60  isReusable: boolean = false;
61  structName: string = '';
62  updatePropsDecoratorsV1: string[] = [];
63  linkDecoratorsV1: string[] = [];
64  paramDecoratorMap: Map<string, ParamDecoratorInfo> = new Map();
65  eventDecoratorSet: Set<string> = new Set();
66  localDecoratorSet: Set<string> = new Set();
67  providerDecoratorSet: Set<string> = new Set();
68  consumerDecoratorSet: Set<string> = new Set();
69  builderParamDecoratorSet: Set<string> = new Set();
70  regularSet: Set<string> = new Set();
71  propertiesMap: Map<string, ts.Expression> = new Map();
72  staticPropertySet: Set<string> = new Set();
73}
74
75const structMapInEts: Map<string, StructInfo> = new Map();
76
77function getOrCreateStructInfo(key: string): StructInfo {
78  let structInfo: StructInfo = structMapInEts.get(key);
79  if (!structInfo) {
80    structInfo = new StructInfo();
81    structInfo.structName = key;
82    structMapInEts.set(key, structInfo);
83  }
84  return structInfo;
85}
86
87/**
88 * import * as a from './common'
89 * a.struct()
90 */
91function getAliasStructInfo(node: ts.CallExpression): StructInfo {
92  let aliasStructInfo: StructInfo;
93  if (node.expression && structMapInEts.has(node.expression.getText())) {
94    aliasStructInfo = structMapInEts.get(node.expression.getText());
95  }
96  return aliasStructInfo;
97}
98
99function processStructComponentV2(node: ts.StructDeclaration, log: LogInfo[],
100  context: ts.TransformationContext): ts.ClassDeclaration {
101  return ts.factory.createClassDeclaration(ts.getModifiers(node), node.name,
102    node.typeParameters, updateHeritageClauses(node, log, true),
103    processStructMembersV2(node, context, log));
104}
105
106function processStructMembersV2(node: ts.StructDeclaration, context: ts.TransformationContext,
107  log: LogInfo[]): ts.ClassElement[] {
108  const structName: string = node.name.getText();
109  const newMembers: ts.ClassElement[] = [];
110  const buildCount: BuildCount = { count: 0 };
111  const structInfo: StructInfo = getOrCreateStructInfo(structName);
112  const addStatementsInConstructor: ts.Statement[] = [];
113  const paramStatementsInStateVarsMethod: ts.Statement[] = [];
114  const structDecorators: readonly ts.Decorator[] = ts.getAllDecorators(node);
115  const freezeParam: FreezeParamType = { componentFreezeParam: undefined };
116  decoratorAssignParams(structDecorators, context, freezeParam);
117  traverseStructInfo(structInfo, addStatementsInConstructor, paramStatementsInStateVarsMethod);
118  node.members.forEach((member: ts.ClassElement) => {
119    if (ts.isConstructorDeclaration(member)) {
120      processStructConstructorV2(node.members, newMembers, addStatementsInConstructor, freezeParam);
121      return;
122    } else if (ts.isPropertyDeclaration(member)) {
123      newMembers.push(processComponentProperty(member, structInfo, log));
124      return;
125    } else if (ts.isMethodDeclaration(member) && member.name) {
126      const newMethodNode: ts.MethodDeclaration = processComponentMethod(member, context, log, buildCount);
127      if (newMethodNode) {
128        newMembers.push(newMethodNode);
129      }
130      return;
131    }
132    newMembers.push(member);
133  });
134  validateBuildMethodCount(buildCount, node.name, log);
135  updateStateVarsMethodNode(paramStatementsInStateVarsMethod, newMembers);
136  newMembers.push(addRerenderFunc([]));
137  if (componentCollection.entryComponent === structName) {
138    newMembers.push(getEntryNameFunction(componentCollection.entryComponent));
139  }
140  return newMembers;
141}
142
143function traverseStructInfo(structInfo: StructInfo,
144  addStatementsInConstructor: ts.Statement[], paramStatementsInStateVarsMethod: ts.Statement[]): void {
145  const needInitFromParams: string[] = [...structInfo.builderParamDecoratorSet,
146    ...structInfo.eventDecoratorSet];
147  for (const property of structInfo.propertiesMap) {
148    if (!structInfo.staticPropertySet.has(property[0])) {
149      setPropertyStatement(structInfo, addStatementsInConstructor, property[0], property[1],
150        needInitFromParams);
151    }
152  }
153  for (const param of structInfo.paramDecoratorMap) {
154    if (!structInfo.staticPropertySet.has(param[0])) {
155      paramStatementsInStateVarsMethod.push(updateParamNode(param[0]));
156    }
157  }
158}
159
160function setPropertyStatement(structInfo: StructInfo, addStatementsInConstructor: ts.Statement[],
161  propName: string, initializer: ts.Expression, needInitFromParams: string[]): void {
162  if (needInitFromParams.includes(propName)) {
163    if (structInfo.eventDecoratorSet.has(propName)) {
164      addStatementsInConstructor.push(
165        createPropertyAssignNode(propName, initializer || getDefaultValueForEvent(), true));
166    } else {
167      addStatementsInConstructor.push(createPropertyAssignNode(propName, initializer, true));
168    }
169  } else if (structInfo.paramDecoratorMap.has(propName)) {
170    const paramProperty: ParamDecoratorInfo = structInfo.paramDecoratorMap.get(propName);
171    addStatementsInConstructor.push(createInitParam(propName, paramProperty.initializer));
172  } else {
173    addStatementsInConstructor.push(createPropertyAssignNode(propName, initializer, false));
174  }
175}
176
177function getDefaultValueForEvent(): ts.Expression {
178  return ts.factory.createArrowFunction(undefined, undefined, [], undefined,
179    ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
180    ts.factory.createBlock([], false));
181}
182
183function createPropertyAssignNode(propName: string, initializer: ts.Expression,
184  initFromParams: boolean): ts.ExpressionStatement {
185  return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression(
186    ts.factory.createPropertyAccessExpression(
187      ts.factory.createThis(),
188      ts.factory.createIdentifier(propName)
189    ),
190    ts.factory.createToken(ts.SyntaxKind.EqualsToken),
191    setInitValue(propName, initializer, initFromParams)
192  ));
193}
194
195function processComponentProperty(member: ts.PropertyDeclaration, structInfo: StructInfo,
196  log: LogInfo[]): ts.PropertyDeclaration {
197  const propName: string = member.name.getText();
198  const decorators: readonly ts.Decorator[] = ts.getAllDecorators(member);
199  let initializer: ts.Expression;
200  if (!structInfo.regularSet.has(propName) && !member.type) {
201    checkV2ComponentMemberType(member.name, propName, log);
202  }
203  if (structInfo.staticPropertySet.has(propName)) {
204    initializer = member.initializer;
205  }
206  if (structInfo.paramDecoratorMap.has(propName)) {
207    return processParamProperty(member, decorators, initializer);
208  }
209  if (structInfo.builderParamDecoratorSet.has(propName)) {
210    return processBuilderParamProperty(member, log, decorators, initializer);
211  }
212  return ts.factory.updatePropertyDeclaration(member,
213    ts.concatenateDecoratorsAndModifiers(decorators, ts.getModifiers(member)),
214    member.name, member.questionToken, member.type, initializer);
215}
216
217function checkV2ComponentMemberType(node: ts.Node, propName: string, log: LogInfo[]): void {
218  log.push({
219    type: LogType.ERROR,
220    message: `The property '${propName}' must specify a type.`,
221    pos: node.getStart()
222  });
223}
224
225function processParamProperty(member: ts.PropertyDeclaration,
226  decorators: readonly ts.Decorator[], initializer: ts.Expression): ts.PropertyDeclaration {
227  const newDecorators: readonly ts.Decorator[] = removeDecorator(decorators, constantDefine.REQUIRE);
228  return ts.factory.updatePropertyDeclaration(member,
229    ts.concatenateDecoratorsAndModifiers(newDecorators, ts.getModifiers(member)),
230    member.name, member.questionToken, member.type, initializer);
231}
232
233function processBuilderParamProperty(member: ts.PropertyDeclaration, log: LogInfo[],
234  decorators: readonly ts.Decorator[], initializer: ts.Expression): ts.PropertyDeclaration {
235  if (judgeBuilderParamAssignedByBuilder(member)) {
236    log.push({
237      type: LogType.ERROR,
238      message: 'BuilderParam property can only initialized by Builder function.',
239      pos: member.getStart()
240    });
241  }
242  const newDecorators: readonly ts.Decorator[] = removeDecorator(decorators, constantDefine.BUILDER_PARAM);
243  return ts.factory.updatePropertyDeclaration(member,
244    ts.concatenateDecoratorsAndModifiers(newDecorators, ts.getModifiers(member)),
245    member.name, member.questionToken, member.type, initializer);
246}
247
248function setInitValue(propName: string, initializer: ts.Expression,
249  initFromParams: boolean): ts.Expression {
250  let initNode: ts.Expression = initializer ||
251    ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED);
252  if (initFromParams) {
253    initNode = createInitNode(propName, initNode);
254  }
255  return initNode;
256}
257
258function createInitNode(propName: string, defaultValue: ts.Expression): ts.Expression {
259  return ts.factory.createConditionalExpression(
260    ts.factory.createBinaryExpression(
261      ts.factory.createStringLiteral(propName),
262      ts.factory.createToken(ts.SyntaxKind.InKeyword),
263      ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)
264    ),
265    ts.factory.createToken(ts.SyntaxKind.QuestionToken),
266    ts.factory.createPropertyAccessExpression(
267      ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS),
268      ts.factory.createIdentifier(propName)
269    ),
270    ts.factory.createToken(ts.SyntaxKind.ColonToken),
271    defaultValue
272  );
273}
274
275function parseComponentProperty(node: ts.StructDeclaration, structInfo: StructInfo, log: LogInfo[],
276  sourceFileNode: ts.SourceFile): void {
277  node.members.forEach((member: ts.ClassElement) => {
278    if (ts.isPropertyDeclaration(member)) {
279      const decorators: readonly ts.Decorator[] = ts.getAllDecorators(member);
280      const modifiers: readonly ts.Modifier[] = ts.getModifiers(member);
281      structInfo.propertiesMap.set(member.name.getText(), member.initializer);
282      parsePropertyDecorator(member, decorators, structInfo, log, sourceFileNode);
283      parsePropertyModifiers(member.name.getText(), structInfo, modifiers);
284    }
285  });
286}
287
288function parsePropertyModifiers(propName: string, structInfo: StructInfo,
289  modifiers: readonly ts.Modifier[]): void {
290  if (modifiers && modifiers.length) {
291    const isStatic: boolean = modifiers.some((item: ts.Modifier) => {
292      return item.kind === ts.SyntaxKind.StaticKeyword;
293    });
294    if (isStatic) {
295      structInfo.staticPropertySet.add(propName);
296    }
297  }
298}
299
300class PropertyDecorator {
301  hasParam: boolean = false;
302  hasRequire: boolean = false;
303  hasOnce: boolean = false;
304  hasEvent: boolean = false;
305}
306
307const decoratorsFunc: Record<string, Function> = {
308  'Param': parseParamDecorator,
309  'Event': parseEventDecorator,
310  'Require': parseRequireDecorator,
311  'Once': parseOnceDecorator,
312  'Local': parseLocalDecorator,
313  'BuilderParam': parseBuilderParamDecorator,
314  'Provider': parseProviderDecorator,
315  'Consumer': parseConsumerDecorator
316};
317
318function parsePropertyDecorator(member: ts.PropertyDeclaration, decorators: readonly ts.Decorator[],
319  structInfo: StructInfo, log: LogInfo[], sourceFileNode: ts.SourceFile): void {
320  const propertyDecorator: PropertyDecorator = new PropertyDecorator();
321  let isRegular: boolean = true;
322  for (let i = 0; i < decorators.length; i++) {
323    const originalName: string = decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim();
324    const name: string = originalName.replace('@', '').trim();
325    if (decoratorsFunc[name]) {
326      decoratorsFunc[name](propertyDecorator, member, structInfo);
327    }
328    if (constantDefine.COMPONENT_MEMBER_DECORATOR_V2.includes(originalName) ||
329      originalName === constantDefine.DECORATOR_BUILDER_PARAM) {
330      isRegular = false;
331    }
332  }
333  if (isRegular) {
334    structInfo.regularSet.add(member.name.getText());
335  }
336  checkPropertyDecorator(propertyDecorator, member, log, sourceFileNode);
337}
338
339function checkPropertyDecorator(propertyDecorator: PropertyDecorator,
340  member: ts.PropertyDeclaration, log: LogInfo[], sourceFileNode: ts.SourceFile): void {
341  if (log && sourceFileNode) {
342    checkParamDecorator(propertyDecorator, member, log, sourceFileNode);
343  }
344}
345
346function parseParamDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
347  structInfo: StructInfo): void {
348  propertyDecorator.hasParam = true;
349  let paramDecoratorInfo: ParamDecoratorInfo = structInfo.paramDecoratorMap.get(member.name.getText());
350  if (!paramDecoratorInfo) {
351    paramDecoratorInfo = new ParamDecoratorInfo();
352  }
353  paramDecoratorInfo.initializer = member.initializer;
354  structInfo.paramDecoratorMap.set(member.name.getText(), paramDecoratorInfo);
355}
356
357function parseEventDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
358  structInfo: StructInfo): void {
359  propertyDecorator.hasEvent = true;
360  structInfo.eventDecoratorSet.add(member.name.getText());
361}
362
363function parseRequireDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
364  structInfo: StructInfo): void {
365  propertyDecorator.hasRequire = true;
366  let paramDecoratorInfo: ParamDecoratorInfo = structInfo.paramDecoratorMap.get(member.name.getText());
367  if (!paramDecoratorInfo) {
368    paramDecoratorInfo = new ParamDecoratorInfo();
369  }
370  paramDecoratorInfo.hasRequire = true;
371  structInfo.paramDecoratorMap.set(member.name.getText(), paramDecoratorInfo);
372}
373
374function parseOnceDecorator(propertyDecorator: PropertyDecorator): void {
375  propertyDecorator.hasOnce = true;
376}
377
378function parseLocalDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
379  structInfo: StructInfo): void {
380  structInfo.localDecoratorSet.add(member.name.getText());
381}
382
383function parseProviderDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
384  structInfo: StructInfo): void {
385  structInfo.providerDecoratorSet.add(member.name.getText());
386}
387
388function parseConsumerDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
389  structInfo: StructInfo): void {
390  structInfo.consumerDecoratorSet.add(member.name.getText());
391}
392
393function parseBuilderParamDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration,
394  structInfo: StructInfo): void {
395  let builderParamSet: Set<string> = builderParamObjectCollection.get(structInfo.structName);
396  if (!builderParamSet) {
397    builderParamSet = new Set();
398  }
399  builderParamSet.add(member.name.getText());
400  builderParamObjectCollection.set(structInfo.structName, builderParamSet);
401  structInfo.builderParamDecoratorSet.add(member.name.getText());
402}
403
404function checkParamDecorator(propertyDecorator: PropertyDecorator, member: ts.PropertyDeclaration, log: LogInfo[],
405  sourceFileNode: ts.SourceFile): void {
406  if (propertyDecorator.hasParam && !member.initializer && !propertyDecorator.hasRequire) {
407    const message: string = 'When a variable decorated with @Param is not assigned a default value, ' +
408      'it must also be decorated with @Require.';
409    addLog(LogType.ERROR, message, member.getStart(), log, sourceFileNode);
410  }
411  if (propertyDecorator.hasOnce && !propertyDecorator.hasParam) {
412    const message: string = 'When a variable decorated with @Once, it must also be decorated with @Param.';
413    addLog(LogType.ERROR, message, member.getStart(), log, sourceFileNode);
414  }
415  if (propertyDecorator.hasRequire && !propertyDecorator.hasParam) {
416    const message: string = 'In a struct decorated with @ComponentV2, @Require can only be used with @Param.';
417    addLog(LogType.ERROR, message, member.getStart(), log, sourceFileNode);
418  }
419}
420
421function processStructConstructorV2(members: ts.NodeArray<ts.ClassElement>, newMembers: ts.ClassElement[],
422  paramStatements: ts.Statement[], freezeParam: FreezeParamType): void {
423  const freezeParamNode: ts.Expression = freezeParam.componentFreezeParam ?
424    freezeParam.componentFreezeParam : undefined;
425  const constructorIndex: number = members.findIndex((item: ts.ClassElement) => {
426    return ts.isConstructorDeclaration(item);
427  });
428  if (constructorIndex !== -1) {
429    const constructorNode: ts.ConstructorDeclaration = members[constructorIndex] as ts.ConstructorDeclaration;
430    newMembers.splice(constructorIndex, 0, ts.factory.updateConstructorDeclaration(constructorNode, ts.getModifiers(constructorNode),
431      createConstructorParams(), updateConstructorBody(constructorNode.body, paramStatements, freezeParamNode)));
432  }
433}
434
435function createConstructorParams(): ts.ParameterDeclaration[] {
436  const paramNames: string[] = [COMPONENT_CONSTRUCTOR_PARENT, COMPONENT_CONSTRUCTOR_PARAMS,
437    COMPONENT_CONSTRUCTOR_LOCALSTORAGE_PU, ELMTID, COMPONENT_PARAMS_LAMBDA_FUNCTION,
438    CUSTOM_COMPONENT_EXTRAINFO];
439  return paramNames.map((name: string) => {
440    return createAstNodeUtils.createParameterDeclaration(name);
441  });
442}
443
444function updateConstructorBody(node: ts.Block, paramStatements: ts.Statement[],
445  freezeParamNode: ts.Expression): ts.Block {
446  const body: ts.Statement[] = [createSuperV2()];
447  if (node.statements) {
448    body.push(...node.statements);
449  }
450  body.push(...paramStatements, createAstNodeUtils.createFinalizeConstruction(freezeParamNode));
451  return ts.factory.createBlock(body, true);
452}
453
454function createSuperV2(): ts.Statement {
455  const paramNames: string[] = [COMPONENT_CONSTRUCTOR_PARENT, ELMTID, CUSTOM_COMPONENT_EXTRAINFO];
456  return ts.factory.createExpressionStatement(ts.factory.createCallExpression(
457    ts.factory.createSuper(), undefined, paramNames.map((name: string) => {
458      return ts.factory.createIdentifier(name);
459    })));
460}
461
462function createInitParam(propName: string, initializer: ts.Expression): ts.ExpressionStatement {
463  return ts.factory.createExpressionStatement(ts.factory.createCallExpression(
464    ts.factory.createPropertyAccessExpression(ts.factory.createThis(),
465      ts.factory.createIdentifier(constantDefine.INIT_PARAM)),
466    undefined,
467    [
468      ts.factory.createStringLiteral(propName),
469      ts.factory.createConditionalExpression(ts.factory.createParenthesizedExpression(
470        ts.factory.createBinaryExpression(ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS),
471          ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken),
472          createParamBinaryNode(propName)
473        )),
474      ts.factory.createToken(ts.SyntaxKind.QuestionToken),
475      ts.factory.createPropertyAccessExpression(
476        ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS), ts.factory.createIdentifier(propName)
477      ),
478      ts.factory.createToken(ts.SyntaxKind.ColonToken),
479      initializer || ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED)
480      )
481    ]));
482}
483
484function updateParamNode(propName: string): ts.IfStatement {
485  return ts.factory.createIfStatement(createParamBinaryNode(propName),
486    ts.factory.createBlock([
487      ts.factory.createExpressionStatement(ts.factory.createCallExpression(
488        ts.factory.createPropertyAccessExpression(ts.factory.createThis(),
489          ts.factory.createIdentifier(constantDefine.UPDATE_PARAM)),
490        undefined,
491        [
492          ts.factory.createStringLiteral(propName),
493          ts.factory.createPropertyAccessExpression(
494            ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS), ts.factory.createIdentifier(propName)
495          )
496        ]))], true));
497}
498
499function createParamBinaryNode(propName: string): ts.BinaryExpression {
500  return ts.factory.createBinaryExpression(
501    ts.factory.createStringLiteral(propName),
502    ts.factory.createToken(ts.SyntaxKind.InKeyword),
503    ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)
504  );
505}
506
507function updateStateVarsMethodNode(paramStatements: ts.Statement[], newMembers: ts.ClassElement[]): void {
508  if (paramStatements.length) {
509    newMembers.push(ts.factory.createMethodDeclaration([ts.factory.createToken(ts.SyntaxKind.PublicKeyword)],
510      undefined, ts.factory.createIdentifier(constantDefine.UPDATE_STATE_VARS), undefined, undefined,
511      [createAstNodeUtils.createParameterDeclaration(COMPONENT_CONSTRUCTOR_PARAMS)], undefined,
512      ts.factory.createBlock([emptyJudgeForParamsNode(), ...paramStatements], true)));
513  }
514}
515
516function emptyJudgeForParamsNode(): ts.IfStatement {
517  return ts.factory.createIfStatement(ts.factory.createBinaryExpression(
518    ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS),
519    ts.factory.createToken(ts.SyntaxKind.EqualsEqualsEqualsToken),
520    ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED)
521  ), ts.factory.createBlock([ts.factory.createReturnStatement(undefined)], true), undefined);
522}
523
524function resetStructMapInEts(): void {
525  structMapInEts.clear();
526}
527
528export default {
529  getOrCreateStructInfo: getOrCreateStructInfo,
530  processStructComponentV2: processStructComponentV2,
531  parseComponentProperty: parseComponentProperty,
532  resetStructMapInEts: resetStructMapInEts,
533  getAliasStructInfo: getAliasStructInfo
534};
535