@idlizer/arktscgen 2.1.10-arktscgen-2 → 2.1.10-arktscgen-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/libarkts-copy/generator/options.json5 +89 -6
- package/build/libarkts-copy/native/meson.build +1 -0
- package/build/libarkts-copy/native/src/bridges.cc +10 -4
- package/build/libarkts-copy/native/src/common.cc +0 -12
- package/build/libarkts-copy/native/src/generated/bridges.cc +407 -723
- package/build/libarkts-copy/native/src/memoryTracker.cc +178 -0
- package/build/libarkts-copy/native/src/memoryTracker.h +52 -0
- package/build/libarkts-copy/package.json +1 -1
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +14 -2
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/index.ts +2 -1
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +7 -11
- package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +4 -1
- package/{templates/node-map.ts → build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts} +8 -19
- package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +26 -9
- package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +309 -0
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +7 -21
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +41 -7
- package/build/libarkts-copy/src/arkts-api/visitor.ts +21 -14
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +1 -0
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +85 -172
- package/build/libarkts-copy/src/generated/factory.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +11 -13
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -5
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +12 -14
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +6 -2
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +1 -24
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +26 -20
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +2 -30
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +10 -12
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +12 -14
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +13 -15
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +3 -4
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +10 -16
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +2 -2
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -10
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +5 -6
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -5
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Program.ts +9 -2
- package/build/libarkts-copy/src/generated/peers/Property.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +22 -19
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +2 -1
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -5
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +2 -25
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +14 -38
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +26 -40
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +11 -13
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +2 -3
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +1 -2
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +10 -12
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +11 -20
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -1
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -1
- package/build/libarkts-copy/src/index.ts +2 -1
- package/build/libarkts-copy/src/plugin-utils.ts +0 -10
- package/build/libarkts-copy/src/reexport-for-generated.ts +1 -20
- package/build/libarkts-copy/src/utils.ts +3 -0
- package/lib/index.js +34 -22
- package/package.json +4 -3
- package/templates/factory.ts +0 -1
- package/templates/peer.ts +0 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +0 -79
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -53,13 +52,13 @@ export class TSTypeReference extends TypeNode {
|
|
|
53
52
|
return result
|
|
54
53
|
}
|
|
55
54
|
get typeParams(): TSTypeParameterInstantiation | undefined {
|
|
56
|
-
return unpackNode(global.generatedEs2panda._TSTypeReferenceTypeParamsConst(global.context, this.peer))
|
|
55
|
+
return unpackNode(global.generatedEs2panda._TSTypeReferenceTypeParamsConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_INSTANTIATION)
|
|
57
56
|
}
|
|
58
57
|
get typeName(): Expression | undefined {
|
|
59
58
|
return unpackNode(global.generatedEs2panda._TSTypeReferenceTypeNameConst(global.context, this.peer))
|
|
60
59
|
}
|
|
61
60
|
get baseName(): Identifier | undefined {
|
|
62
|
-
return unpackNode(global.generatedEs2panda._TSTypeReferenceBaseNameConst(global.context, this.peer))
|
|
61
|
+
return unpackNode(global.generatedEs2panda._TSTypeReferenceBaseNameConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_IDENTIFIER)
|
|
63
62
|
}
|
|
64
63
|
protected readonly brandTSTypeReference: undefined
|
|
65
64
|
}
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -55,10 +54,10 @@ export class TaggedTemplateExpression extends Expression {
|
|
|
55
54
|
return unpackNode(global.generatedEs2panda._TaggedTemplateExpressionTagConst(global.context, this.peer))
|
|
56
55
|
}
|
|
57
56
|
get quasi(): TemplateLiteral | undefined {
|
|
58
|
-
return unpackNode(global.generatedEs2panda._TaggedTemplateExpressionQuasiConst(global.context, this.peer))
|
|
57
|
+
return unpackNode(global.generatedEs2panda._TaggedTemplateExpressionQuasiConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_TEMPLATE_LITERAL)
|
|
59
58
|
}
|
|
60
59
|
get typeParams(): TSTypeParameterInstantiation | undefined {
|
|
61
|
-
return unpackNode(global.generatedEs2panda._TaggedTemplateExpressionTypeParamsConst(global.context, this.peer))
|
|
60
|
+
return unpackNode(global.generatedEs2panda._TaggedTemplateExpressionTypeParamsConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_TS_TYPE_PARAMETER_INSTANTIATION)
|
|
62
61
|
}
|
|
63
62
|
protected readonly brandTaggedTemplateExpression: undefined
|
|
64
63
|
}
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -51,7 +50,7 @@ export class TemplateLiteral extends Expression {
|
|
|
51
50
|
return result
|
|
52
51
|
}
|
|
53
52
|
get quasis(): readonly TemplateElement[] {
|
|
54
|
-
return unpackNodeArray(global.generatedEs2panda._TemplateLiteralQuasisConst(global.context, this.peer))
|
|
53
|
+
return unpackNodeArray(global.generatedEs2panda._TemplateLiteralQuasisConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_TEMPLATE_ELEMENT)
|
|
55
54
|
}
|
|
56
55
|
get expressions(): readonly Expression[] {
|
|
57
56
|
return unpackNodeArray(global.generatedEs2panda._TemplateLiteralExpressionsConst(global.context, this.peer))
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -70,7 +69,7 @@ export class TryStatement extends Statement {
|
|
|
70
69
|
return global.generatedEs2panda._TryStatementHasDefaultCatchClauseConst(global.context, this.peer)
|
|
71
70
|
}
|
|
72
71
|
get catchClauses(): readonly CatchClause[] {
|
|
73
|
-
return unpackNodeArray(global.generatedEs2panda._TryStatementCatchClausesConst(global.context, this.peer))
|
|
72
|
+
return unpackNodeArray(global.generatedEs2panda._TryStatementCatchClausesConst(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_CATCH_CLAUSE)
|
|
74
73
|
}
|
|
75
74
|
get finallyCanCompleteNormally(): boolean {
|
|
76
75
|
return global.generatedEs2panda._TryStatementFinallyCanCompleteNormallyConst(global.context, this.peer)
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -35,14 +34,18 @@ import {
|
|
|
35
34
|
import { AnnotationUsage } from "./AnnotationUsage"
|
|
36
35
|
import { Es2pandaAstNodeType } from "./../Es2pandaEnums"
|
|
37
36
|
import { Expression } from "./Expression"
|
|
37
|
+
import { SrcDumper } from "./SrcDumper"
|
|
38
38
|
|
|
39
39
|
export class TypeNode extends Expression {
|
|
40
40
|
constructor(pointer: KNativePointer, astNodeType: Es2pandaAstNodeType) {
|
|
41
41
|
super(pointer, astNodeType)
|
|
42
42
|
}
|
|
43
|
+
get hasAnnotations(): boolean {
|
|
44
|
+
return global.generatedEs2panda._TypeNodeHasAnnotationsConst(global.context, this.peer)
|
|
45
|
+
}
|
|
43
46
|
/** @deprecated */
|
|
44
|
-
|
|
45
|
-
global.generatedEs2panda.
|
|
47
|
+
emplaceAnnotation(source?: AnnotationUsage): this {
|
|
48
|
+
global.generatedEs2panda._TypeNodeEmplaceAnnotation(global.context, this.peer, passNode(source))
|
|
46
49
|
return this
|
|
47
50
|
}
|
|
48
51
|
/** @deprecated */
|
|
@@ -51,15 +54,15 @@ export class TypeNode extends Expression {
|
|
|
51
54
|
return this
|
|
52
55
|
}
|
|
53
56
|
/** @deprecated */
|
|
54
|
-
|
|
55
|
-
global.generatedEs2panda.
|
|
57
|
+
dumpAnnotations(dumper?: SrcDumper): this {
|
|
58
|
+
global.generatedEs2panda._TypeNodeDumpAnnotationsConst(global.context, this.peer, passNode(dumper))
|
|
56
59
|
return this
|
|
57
60
|
}
|
|
58
61
|
get annotationsForUpdate(): readonly AnnotationUsage[] {
|
|
59
|
-
return unpackNodeArray(global.generatedEs2panda._TypeNodeAnnotationsForUpdate(global.context, this.peer))
|
|
62
|
+
return unpackNodeArray(global.generatedEs2panda._TypeNodeAnnotationsForUpdate(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_ANNOTATION_USAGE)
|
|
60
63
|
}
|
|
61
64
|
get annotations(): readonly AnnotationUsage[] {
|
|
62
|
-
return unpackNodeArray(global.generatedEs2panda._TypeNodeAnnotations(global.context, this.peer))
|
|
65
|
+
return unpackNodeArray(global.generatedEs2panda._TypeNodeAnnotations(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_ANNOTATION_USAGE)
|
|
63
66
|
}
|
|
64
67
|
/** @deprecated */
|
|
65
68
|
setAnnotations(annotationList: readonly AnnotationUsage[]): this {
|
|
@@ -71,11 +74,6 @@ export class TypeNode extends Expression {
|
|
|
71
74
|
global.generatedEs2panda._TypeNodeSetAnnotations1(global.context, this.peer, passNodeArray(annotationList), annotationList.length)
|
|
72
75
|
return this
|
|
73
76
|
}
|
|
74
|
-
/** @deprecated */
|
|
75
|
-
addAnnotations(annotations?: AnnotationUsage): this {
|
|
76
|
-
global.generatedEs2panda._TypeNodeAddAnnotations(global.context, this.peer, passNode(annotations))
|
|
77
|
-
return this
|
|
78
|
-
}
|
|
79
77
|
protected readonly brandTypeNode: undefined
|
|
80
78
|
}
|
|
81
79
|
export function isTypeNode(node: object | undefined): node is TypeNode {
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
unpackNonNullableNode,
|
|
25
25
|
unpackNode,
|
|
26
26
|
unpackNodeArray,
|
|
27
|
-
assertValidPeer,
|
|
28
27
|
AstNode,
|
|
29
28
|
KNativePointer,
|
|
30
29
|
nodeByType,
|
|
@@ -33,9 +32,9 @@ import {
|
|
|
33
32
|
} from "../../reexport-for-generated"
|
|
34
33
|
|
|
35
34
|
import { AnnotationUsage } from "./AnnotationUsage"
|
|
36
|
-
import { Decorator } from "./Decorator"
|
|
37
35
|
import { Es2pandaAstNodeType } from "./../Es2pandaEnums"
|
|
38
36
|
import { Es2pandaVariableDeclarationKind } from "./../Es2pandaEnums"
|
|
37
|
+
import { SrcDumper } from "./SrcDumper"
|
|
39
38
|
import { Statement } from "./Statement"
|
|
40
39
|
import { VariableDeclarator } from "./VariableDeclarator"
|
|
41
40
|
|
|
@@ -62,23 +61,20 @@ export class VariableDeclaration extends Statement {
|
|
|
62
61
|
return result
|
|
63
62
|
}
|
|
64
63
|
get declarators(): readonly VariableDeclarator[] {
|
|
65
|
-
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationDeclarators(global.context, this.peer))
|
|
64
|
+
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationDeclarators(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR)
|
|
66
65
|
}
|
|
67
66
|
get declaratorsForUpdate(): readonly VariableDeclarator[] {
|
|
68
|
-
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationDeclaratorsForUpdate(global.context, this.peer))
|
|
67
|
+
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationDeclaratorsForUpdate(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_VARIABLE_DECLARATOR)
|
|
69
68
|
}
|
|
70
69
|
get kind(): Es2pandaVariableDeclarationKind {
|
|
71
70
|
return global.generatedEs2panda._VariableDeclarationKindConst(global.context, this.peer)
|
|
72
71
|
}
|
|
73
|
-
get
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
get decoratorsForUpdate(): readonly Decorator[] {
|
|
77
|
-
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationDecoratorsForUpdate(global.context, this.peer))
|
|
72
|
+
get hasAnnotations(): boolean {
|
|
73
|
+
return global.generatedEs2panda._VariableDeclarationHasAnnotationsConst(global.context, this.peer)
|
|
78
74
|
}
|
|
79
75
|
/** @deprecated */
|
|
80
|
-
|
|
81
|
-
global.generatedEs2panda.
|
|
76
|
+
emplaceAnnotation(source?: AnnotationUsage): this {
|
|
77
|
+
global.generatedEs2panda._VariableDeclarationEmplaceAnnotation(global.context, this.peer, passNode(source))
|
|
82
78
|
return this
|
|
83
79
|
}
|
|
84
80
|
/** @deprecated */
|
|
@@ -87,15 +83,15 @@ export class VariableDeclaration extends Statement {
|
|
|
87
83
|
return this
|
|
88
84
|
}
|
|
89
85
|
/** @deprecated */
|
|
90
|
-
|
|
91
|
-
global.generatedEs2panda.
|
|
86
|
+
dumpAnnotations(dumper?: SrcDumper): this {
|
|
87
|
+
global.generatedEs2panda._VariableDeclarationDumpAnnotationsConst(global.context, this.peer, passNode(dumper))
|
|
92
88
|
return this
|
|
93
89
|
}
|
|
94
90
|
get annotationsForUpdate(): readonly AnnotationUsage[] {
|
|
95
|
-
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationAnnotationsForUpdate(global.context, this.peer))
|
|
91
|
+
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationAnnotationsForUpdate(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_ANNOTATION_USAGE)
|
|
96
92
|
}
|
|
97
93
|
get annotations(): readonly AnnotationUsage[] {
|
|
98
|
-
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationAnnotations(global.context, this.peer))
|
|
94
|
+
return unpackNodeArray(global.generatedEs2panda._VariableDeclarationAnnotations(global.context, this.peer), Es2pandaAstNodeType.AST_NODE_TYPE_ANNOTATION_USAGE)
|
|
99
95
|
}
|
|
100
96
|
/** @deprecated */
|
|
101
97
|
setAnnotations(annotationList: readonly AnnotationUsage[]): this {
|
|
@@ -107,11 +103,6 @@ export class VariableDeclaration extends Statement {
|
|
|
107
103
|
global.generatedEs2panda._VariableDeclarationSetAnnotations1(global.context, this.peer, passNodeArray(annotationList), annotationList.length)
|
|
108
104
|
return this
|
|
109
105
|
}
|
|
110
|
-
/** @deprecated */
|
|
111
|
-
addAnnotations(annotations?: AnnotationUsage): this {
|
|
112
|
-
global.generatedEs2panda._VariableDeclarationAddAnnotations(global.context, this.peer, passNode(annotations))
|
|
113
|
-
return this
|
|
114
|
-
}
|
|
115
106
|
protected readonly brandVariableDeclaration: undefined
|
|
116
107
|
}
|
|
117
108
|
export function isVariableDeclaration(node: object | undefined): node is VariableDeclaration {
|
|
@@ -19,12 +19,12 @@ export * from "./reexport-for-generated"
|
|
|
19
19
|
export * from "./generated/Es2pandaEnums"
|
|
20
20
|
export * from "./generated"
|
|
21
21
|
|
|
22
|
+
export * from "./arkts-api/utilities/performance"
|
|
22
23
|
export * from "./arkts-api/utilities/private"
|
|
23
24
|
export * from "./arkts-api/utilities/public"
|
|
24
25
|
export * from "./arkts-api/factory/nodeFactory"
|
|
25
26
|
export * from "./arkts-api/visitor"
|
|
26
27
|
export * from "./arkts-api/AbstractVisitor"
|
|
27
|
-
export * from "./arkts-api/ChainExpressionFilter"
|
|
28
28
|
export * from "./arkts-api/plugins"
|
|
29
29
|
export * from "./arkts-api/ImportStorage"
|
|
30
30
|
export * from "./arkts-api/ProgramProvider"
|
|
@@ -38,6 +38,7 @@ export { GlobalContext } from "./arkts-api/peers/Context"
|
|
|
38
38
|
export * from "./arkts-api/peers/ExternalSource"
|
|
39
39
|
export * from "./arkts-api/peers/ImportPathManager"
|
|
40
40
|
export * from "./arkts-api/peers/Options"
|
|
41
|
+
export * from "./arkts-api/peers/DiagnosticKind"
|
|
41
42
|
export { global as arktsGlobal } from "./arkts-api/static/global"
|
|
42
43
|
export * from "./arkts-api/static/globalUtils"
|
|
43
44
|
export * as arkts from "./arkts-api"
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
PluginContext,
|
|
19
19
|
ImportStorage,
|
|
20
20
|
arktsGlobal,
|
|
21
|
-
ChainExpressionFilter,
|
|
22
21
|
ProgramTransformer,
|
|
23
22
|
Program,
|
|
24
23
|
ProgramProvider,
|
|
@@ -80,9 +79,6 @@ export function runTransformerOnProgram(program: Program, options: CompilationOp
|
|
|
80
79
|
// Run the plugin itself
|
|
81
80
|
transform?.(program, options, pluginContext)
|
|
82
81
|
|
|
83
|
-
// Run some common plugins that should be run after plugin usage and depends on the current state
|
|
84
|
-
stateSpecificPostFilters(program, options.state)
|
|
85
|
-
|
|
86
82
|
// Update internal import information based on import modification by plugin
|
|
87
83
|
importStorage.update()
|
|
88
84
|
|
|
@@ -117,12 +113,6 @@ export function runTransformer(prog: Program, state: Es2pandaContextState, trans
|
|
|
117
113
|
}
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
function stateSpecificPostFilters(program: Program, state: Es2pandaContextState) {
|
|
121
|
-
if (state == Es2pandaContextState.ES2PANDA_STATE_CHECKED) {
|
|
122
|
-
program.setAst(new ChainExpressionFilter().visitor(program.ast))
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
116
|
function isProgramForCodegeneration(
|
|
127
117
|
program: Program,
|
|
128
118
|
isMainProgram: boolean,
|
|
@@ -22,30 +22,11 @@ export {
|
|
|
22
22
|
unpackNodeArray,
|
|
23
23
|
passNodeArray,
|
|
24
24
|
unpackNode,
|
|
25
|
-
unpackNonNullableObject,
|
|
26
25
|
unpackString,
|
|
27
|
-
unpackObject,
|
|
28
26
|
assertValidPeer,
|
|
29
27
|
updateNodeByNode
|
|
30
28
|
} from "./arkts-api/utilities/private"
|
|
31
29
|
export { nodeByType } from "./arkts-api/class-by-peer"
|
|
32
30
|
export { global } from "./arkts-api/static/global"
|
|
33
31
|
export { Es2pandaMemberExpressionKind } from "./generated/Es2pandaEnums"
|
|
34
|
-
export
|
|
35
|
-
extension_ETSModuleGetNamespaceFlag,
|
|
36
|
-
extension_MethodDefinitionOnUpdate,
|
|
37
|
-
extension_MethodDefinitionSetChildrenParentPtr,
|
|
38
|
-
extension_ScriptFunctionGetSignaturePointer,
|
|
39
|
-
extension_ScriptFunctionSetSignaturePointer,
|
|
40
|
-
extension_ScriptFunctionGetPreferredReturnTypePointer,
|
|
41
|
-
extension_ScriptFunctionSetPreferredReturnTypePointer,
|
|
42
|
-
extension_ExpressionGetPreferredTypePointer,
|
|
43
|
-
extension_ExpressionSetPreferredTypePointer,
|
|
44
|
-
extension_ProgramGetExternalSources,
|
|
45
|
-
extension_SourcePositionGetCol,
|
|
46
|
-
extension_SourcePositionGetLine,
|
|
47
|
-
extension_SourcePositionToString,
|
|
48
|
-
extension_NumberLiteralValue,
|
|
49
|
-
extension_ScriptFunctionSetParams,
|
|
50
|
-
extension_ClassDefinitionSetBody,
|
|
51
|
-
} from "./arkts-api/utilities/extensions"
|
|
32
|
+
export * from "./arkts-api/utilities/extensions"
|
package/lib/index.js
CHANGED
|
@@ -3838,6 +3838,7 @@ var IDLExtendedAttributes;
|
|
|
3838
3838
|
IDLExtendedAttributes["OriginalGenericName"] = "OriginalGenericName";
|
|
3839
3839
|
IDLExtendedAttributes["Predefined"] = "Predefined";
|
|
3840
3840
|
IDLExtendedAttributes["Protected"] = "Protected";
|
|
3841
|
+
IDLExtendedAttributes["Abstract"] = "Abstract";
|
|
3841
3842
|
IDLExtendedAttributes["Synthetic"] = "Synthetic";
|
|
3842
3843
|
IDLExtendedAttributes["Throws"] = "Throws";
|
|
3843
3844
|
IDLExtendedAttributes["TraceKey"] = "TraceKey";
|
|
@@ -5410,7 +5411,9 @@ class LanguageWriter {
|
|
|
5410
5411
|
fs__namespace.writeFileSync(file, this.getOutput().join("\n"));
|
|
5411
5412
|
}
|
|
5412
5413
|
writeLines(lines) {
|
|
5413
|
-
|
|
5414
|
+
if (typeof lines === 'string')
|
|
5415
|
+
lines = lines.split("\n");
|
|
5416
|
+
lines.forEach(it => this.print(it));
|
|
5414
5417
|
}
|
|
5415
5418
|
writeGetterImplementation(method, op) {
|
|
5416
5419
|
var _a;
|
|
@@ -6155,12 +6158,12 @@ class FatalParserException extends Error {
|
|
|
6155
6158
|
}
|
|
6156
6159
|
var TokenKind;
|
|
6157
6160
|
(function (TokenKind) {
|
|
6158
|
-
TokenKind["Words"] = "Words";
|
|
6159
|
-
TokenKind["Literal"] = "Literal";
|
|
6160
|
-
TokenKind["Symbol"] = "Symbol";
|
|
6161
|
-
TokenKind["Comment"] = "Comment";
|
|
6162
|
-
TokenKind["Whitespace"] = "
|
|
6163
|
-
TokenKind["End"] = "End";
|
|
6161
|
+
TokenKind[TokenKind["Words"] = 0] = "Words";
|
|
6162
|
+
TokenKind[TokenKind["Literal"] = 1] = "Literal";
|
|
6163
|
+
TokenKind[TokenKind["Symbol"] = 2] = "Symbol";
|
|
6164
|
+
TokenKind[TokenKind["Comment"] = 3] = "Comment";
|
|
6165
|
+
TokenKind[TokenKind["Whitespace"] = 4] = "Whitespace";
|
|
6166
|
+
TokenKind[TokenKind["End"] = 5] = "End";
|
|
6164
6167
|
})(TokenKind || (TokenKind = {}));
|
|
6165
6168
|
const supportedDeclarations = new Set(["attribute", "callback", "const", "constructor", "dictionary",
|
|
6166
6169
|
"enum", "import", "interface", "namespace", "package", "typedef", "version"]);
|
|
@@ -6170,10 +6173,6 @@ const interfaceContent = new Set([IDLKind.Constructor, IDLKind.Const, IDLKind.Pr
|
|
|
6170
6173
|
const globalContent = new Set([IDLKind.Namespace, IDLKind.Interface, IDLKind.Enum, IDLKind.Method, IDLKind.Typedef, IDLKind.Callback, IDLKind.Import, IDLKind.Version, IDLKind.Const]);
|
|
6171
6174
|
const havingBlocks = new Set([IDLKind.Namespace, IDLKind.Interface, IDLKind.Enum]);
|
|
6172
6175
|
const modifierTokens = new Set(["static", "readonly", "async"]);
|
|
6173
|
-
// Uncomment in case of parser debugging
|
|
6174
|
-
function trac(s) {
|
|
6175
|
-
// console.log(s)
|
|
6176
|
-
}
|
|
6177
6176
|
class Parser {
|
|
6178
6177
|
constructor(fileName, content) {
|
|
6179
6178
|
var _a, _b;
|
|
@@ -6214,11 +6213,14 @@ class Parser {
|
|
|
6214
6213
|
var _a;
|
|
6215
6214
|
const previousDiagnosticsCount = DiagnosticMessageGroup.allGroupsEntries.length;
|
|
6216
6215
|
try {
|
|
6217
|
-
trac("parseIDL");
|
|
6218
6216
|
this._lexerNext();
|
|
6219
6217
|
this._prevToken = this._curToken;
|
|
6220
6218
|
let file = this.parseFile();
|
|
6221
6219
|
file.text = this.content;
|
|
6220
|
+
if (DiagnosticMessageGroup.allGroupsEntries.length != previousDiagnosticsCount) {
|
|
6221
|
+
// Empty for now, messages will be added in following `catch`.
|
|
6222
|
+
throw new FatalParserException();
|
|
6223
|
+
}
|
|
6222
6224
|
return file;
|
|
6223
6225
|
}
|
|
6224
6226
|
catch (e) {
|
|
@@ -7298,6 +7300,7 @@ class IDLDeserializer {
|
|
|
7298
7300
|
toIDLConstructor(file, node) {
|
|
7299
7301
|
return this.withInfo(node, createConstructor(node.arguments.map(it => this.toIDLParameter(file, it)), undefined, {
|
|
7300
7302
|
documentation: this.makeDocs(node),
|
|
7303
|
+
extendedAttributes: this.toExtendedAttributes(node.extAttrs),
|
|
7301
7304
|
}));
|
|
7302
7305
|
}
|
|
7303
7306
|
toIDLParameter(file, node) {
|
|
@@ -9039,6 +9042,12 @@ class ETSLanguageWriter extends TSLanguageWriter {
|
|
|
9039
9042
|
super(printer, resolver, typeConvertor, Language.ARKTS);
|
|
9040
9043
|
this.arrayConvertor = arrayConvertor;
|
|
9041
9044
|
}
|
|
9045
|
+
pushNamespace(namespace, options) {
|
|
9046
|
+
if (options.isDefault) {
|
|
9047
|
+
this.print(`export default ${namespace}`);
|
|
9048
|
+
}
|
|
9049
|
+
super.pushNamespace(namespace, options);
|
|
9050
|
+
}
|
|
9042
9051
|
fork(options) {
|
|
9043
9052
|
var _a;
|
|
9044
9053
|
return new ETSLanguageWriter(new IndentedPrinter([], this.indentDepth()), (_a = options === null || options === void 0 ? void 0 : options.resolver) !== null && _a !== void 0 ? _a : this.resolver, this.typeConvertor, this.arrayConvertor);
|
|
@@ -9323,7 +9332,7 @@ class AggregateConvertor extends BaseArgConvertor {
|
|
|
9323
9332
|
statements.push(assigneer(writer.makeString(bufferName)));
|
|
9324
9333
|
}
|
|
9325
9334
|
else if (writer.language == Language.CJ) {
|
|
9326
|
-
const resultExpression = writer.makeString(`${writer.getNodeName(this.idlType)}(${this.decl.properties.map(prop => `${bufferName}
|
|
9335
|
+
const resultExpression = writer.makeString(`${writer.getNodeName(this.idlType)}(${this.decl.properties.map(prop => `${bufferName}${capitalize(prop.name)}`).join(", ")})`);
|
|
9327
9336
|
statements.push(assigneer(resultExpression));
|
|
9328
9337
|
}
|
|
9329
9338
|
else if (writer.language == Language.KOTLIN) {
|
|
@@ -12887,19 +12896,22 @@ class BridgesPrinter extends InteropPrinter {
|
|
|
12887
12896
|
writer.writeStatements(writer.makeStatement(nativeCall), writer.makeReturn(writer.makeString('')));
|
|
12888
12897
|
}
|
|
12889
12898
|
else {
|
|
12890
|
-
writer.writeStatements(writer.makeAssign(BridgesConstructions.result, undefined, nativeCall, true, false), writer.makeReturn(
|
|
12899
|
+
writer.writeStatements(writer.makeAssign(BridgesConstructions.result, undefined, nativeCall, true, false), writer.makeReturn(this.makeReturnExpression(node)));
|
|
12891
12900
|
}
|
|
12892
12901
|
}
|
|
12893
|
-
makeReturnExpression(
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
|
|
12902
|
+
makeReturnExpression(node) {
|
|
12903
|
+
const makeStringCtor = () => BridgesConstructions.stringConstructor(BridgesConstructions.result);
|
|
12904
|
+
const makeSequenceCtor = () => BridgesConstructions.sequenceConstructor(BridgesConstructions.result, BridgesConstructions.sequenceLengthUsage);
|
|
12905
|
+
const expr = this.maybeDropConst(node, isSequence(node.returnType) ? makeSequenceCtor() :
|
|
12906
|
+
isString(node.returnType) ? makeStringCtor() :
|
|
12907
|
+
BridgesConstructions.result);
|
|
12908
|
+
if (isSequence(node.returnType)) {
|
|
12909
|
+
// writer.makeTernary annoys by adding the extra parentheses
|
|
12910
|
+
return this.writer.makeString(`${BridgesConstructions.sequenceLengthUsage} ? ${expr} : nullptr`);
|
|
12899
12911
|
}
|
|
12900
|
-
return
|
|
12912
|
+
return this.writer.makeString(expr);
|
|
12901
12913
|
}
|
|
12902
|
-
maybeDropConst(
|
|
12914
|
+
maybeDropConst(node, value) {
|
|
12903
12915
|
if (this.typechecker.isConstReturnValue(node)) {
|
|
12904
12916
|
return BridgesConstructions.dropConstCast(value);
|
|
12905
12917
|
}
|