Skip to content

Commit

Permalink
UPD preparing enum naming convention change (not working yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Oct 16, 2024
1 parent e00e6c2 commit 9cc7352
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/ldtk/macro/TypeBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,49 @@ class TypeBuilder {
static function createLocalEnums() {
timer("localEnums");
for(e in json.defs.enums) {
var enumTypeDef : TypeDefinition = {
// Old naming convention
var legacyEnumTypeDef : TypeDefinition = {
name: "Enum_"+e.identifier,
pack: modPack,
doc: "Enumeration of all possible "+e.identifier+" values",
kind: TDEnum,
pos: curPos,
// meta: [
// { name:":noCompletion", pos:curPos },
// { name:":deprecated", params:[macro "Use "+modName+"_Enum_"+e.identifier], pos:curPos },
// ],
fields: e.values.map( function(json) : Field {
return {
name: sanitizeIdentifier(json.id),
pos: curPos,
kind: FVar(null, null),
// meta: [
// { name:":noCompletion", pos:curPos },
// { name:":deprecated", params:[macro "Use "+modName+"_Enum_"+e.identifier], pos:curPos },
// ],
}
}),
}
localEnums.set(e.uid, enumTypeDef);
registerTypeDefinitionModule(enumTypeDef, projectFilePath);
localEnums.set(e.uid, legacyEnumTypeDef);
registerTypeDefinitionModule(legacyEnumTypeDef, projectFilePath);

// // New naming convention
// var newEnumTypeDef : TypeDefinition = {
// name: modName+"_Enum_"+e.identifier,
// pack: modPack,
// doc: "Enumeration of all possible "+e.identifier+" values",
// kind: TDEnum,
// pos: curPos,
// fields: e.values.map( function(json) : Field {
// return {
// name: sanitizeIdentifier(json.id),
// pos: curPos,
// kind: FVar(null, null),
// }
// }),
// }
// localEnums.set(e.uid, newEnumTypeDef);
// registerTypeDefinitionModule(newEnumTypeDef, projectFilePath);
}
}

Expand Down

0 comments on commit 9cc7352

Please sign in to comment.