Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/back-ends/c++-gen/gen-code.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,12 @@ static bool PrintROSEInvoke(FILE* hdr, FILE* src, Module* m, int bEvents, ValueD
*/
static void PrintCxxSimpleDef(FILE* hdr, FILE* src, Module* m, CxxRules* r, TypeDef* td, const int genCxxCode_EnumClasses)
{
// The root type is deprecated
if (IsDeprecatedNoOutputSequence(m, td->type->cxxTypeRefInfo->className))
return;
// The type itself is deprecated
if (IsDeprecatedNoOutputSequence(m, td->definedName))
return;

fprintf(hdr, "// [%s]\n", __FUNCTION__);

Expand Down
24 changes: 19 additions & 5 deletions compiler/back-ends/ts-gen/gen-ts-code.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,26 @@ void PrintTSChoiceDefCode(FILE* src, ModuleList* mods, Module* m, TypeDef* td, T

FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;

const char* szPropertyName = "";
BasicType* type = ResolveBasicTypeReferences(e->type->basicType, &szPropertyName);
enum BasicTypeChoiceId choiceId = type->choiceId;

char szOptionalParam[128] = {0};
int id = GetContextID(e->type);
if (id >= 0)
sprintf_s(szOptionalParam, sizeof(szOptionalParam), ", idBlock: { optionalID: %i }", id);
{
if (choiceId == BASICTYPE_ANY)
strcpy_s(szOptionalParam, sizeof(szOptionalParam), ", optional: true");
else
sprintf_s(szOptionalParam, sizeof(szOptionalParam), ", idBlock: { optionalID: %i }", id);
}

if (choice->basicType->a.sequence->curr->prev)
fprintf(src, ",\n");
const char* szFieldName = e->fieldName;
const char* szPropertyName = "";
BasicType* type = ResolveBasicTypeReferences(e->type->basicType, &szPropertyName);
enum BasicTypeChoiceId choiceId = type->choiceId;

if (choiceId == BASICTYPE_SEQUENCEOF || choiceId == BASICTYPE_SETOF)
{
Expand All @@ -404,8 +413,13 @@ void PrintTSChoiceDefCode(FILE* src, ModuleList* mods, Module* m, TypeDef* td, T
/* Write out properties */
FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;
if (choice->basicType->a.sequence->curr->prev)
fprintf(src, "\n");

printMemberComment(src, m, td, e->fieldName, "\t", COMMENTSTYLE_TYPESCRIPT);

fprintf(src, "\t");
{
char* szConverted2 = FixName(e->fieldName);
Expand Down Expand Up @@ -585,7 +599,7 @@ void PrintTSSeqDefCode(FILE* src, ModuleList* mods, Module* m, TypeDef* td, Type
if (bOptional)
{
iOptionalID = GetContextID(e->type);
if (iOptionalID > -1)
if (iOptionalID > -1 && choiceId != BASICTYPE_ANY)
sprintf_s(szOptionalParam, sizeof(szOptionalParam), ", idBlock: { optionalID: %i }", iOptionalID);
else
sprintf_s(szOptionalParam, sizeof(szOptionalParam), "%s", ", optional: true");
Expand Down
3 changes: 3 additions & 0 deletions compiler/back-ends/ts-gen/gen-ts-combined.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "gen-ts-combined.h"
#include "gen-ts-converter.h"
#include "../../core/snacc-util.h"
#include "../str-util.h"
#include "../structure-util.h"
Expand Down Expand Up @@ -137,6 +138,8 @@ void PrintTSImports(FILE* src, ModuleList* mods, Module* mod, bool bIncludeConve
Module* referencedModule = GetModuleForImportModule(mods, impMod);
if (referencedModule)
{
if (!ContainsConverters(referencedModule))
continue;
const char* szNameSpace = GetNameSpace(referencedModule);
if (strstr(szAlreadyAdded, szNameSpace) == NULL)
{
Expand Down
8 changes: 8 additions & 0 deletions compiler/back-ends/ts-gen/gen-ts-converter.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ void Print_JSON_EncoderChoiceDefCode(FILE* src, ModuleList* mods, Module* m, Typ
NamedType* e;
FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;
fprintf(src, "\t\t");
if (bCurly)
{
Expand Down Expand Up @@ -386,6 +388,8 @@ void Print_BER_EncoderChoiceDefCode(FILE* src, ModuleList* mods, Module* m, Type
NamedType* e;
FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;
Type* type = e->type;
enum BasicTypeChoiceId choiceId = type->basicType->choiceId;
if (choiceId == BASICTYPE_LOCALTYPEREF || choiceId == BASICTYPE_IMPORTTYPEREF)
Expand Down Expand Up @@ -434,6 +438,8 @@ void Print_JSON_DecoderChoiceDefCode(FILE* src, ModuleList* mods, Module* m, Typ
NamedType* e;
FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;
BasicType* type = e->type->basicType;
const char* szOptional = e->type->optional ? "true" : "false";
const char* szTypeName = NULL;
Expand Down Expand Up @@ -516,6 +522,8 @@ void Print_BER_DecoderChoiceDefCode(FILE* src, ModuleList* mods, Module* m, Type
NamedType* e;
FOR_EACH_LIST_ELMT(e, choice->basicType->a.sequence)
{
if (IsDeprecatedFlaggedMember(m, td, e->fieldName))
continue;
BasicType* pBasicType = ResolveBasicTypeReferences(e->type->basicType, NULL);
enum BasicTypeChoiceId choiceId = pBasicType->choiceId;
const char* szOptional = e->type->optional ? "true" : "false";
Expand Down
6 changes: 6 additions & 0 deletions samples/ts-microservice/client/check-pm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const userAgent = process.env.npm_config_user_agent || "";
if (!userAgent.startsWith("pnpm"))
{
console.error("\nERROR: You must use pnpm (preferably via Corepack).\n\n");
process.exit(1);
}
Loading
Loading