Skip to content

Commit

Permalink
Don't use operators introduced in Haxe 4.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
player-03 committed Oct 22, 2024
1 parent 28f2256 commit 65437a1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/echoes/macro/ComponentStorageBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ class ComponentStorageBuilder {

//If a custom singleton is defined, use that instead.
final componentBaseType:BaseType = componentComplexType.toType().toBaseType();
switch(componentBaseType?.meta?.extract(":echoes_storage")) {
case null, []:
case x if(componentBaseType.params.length > 0):
Context.error("@:echoes_storage doesn't work with type params, for type " + new Printer().printComplexType(componentComplexType), Context.currentPos());
case [_.params => [customSingleton]]:
getInstance = customSingleton;
default:
final meta:MetaAccess = componentBaseType != null ? componentBaseType.meta : null;
if(meta != null) {
switch(meta.extract(":echoes_storage")) {
case null, []:
case x if(componentBaseType.params.length > 0):
Context.error("@:echoes_storage doesn't work with type params, for type " + new Printer().printComplexType(componentComplexType), Context.currentPos());
case [_.params => [customSingleton]]:
getInstance = customSingleton;
default:
}
}

final def:TypeDefinition = macro class $storageTypeName {
Expand Down

0 comments on commit 65437a1

Please sign in to comment.