Skip to content

Commit

Permalink
Add Architecture constructor for clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
player-03 committed Jun 4, 2024
1 parent 3c35487 commit 04f9a6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/lime/tools/Architecture.hx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ import hxp.HostArchitecture;
}
}

/**
Returns the given `Architecture` if available, or `null` otherwise.
**/
public inline function new(name:String)
{
this = fromString(name.toUpperCase());
}

public inline function is64():Bool
{
return this == ARM64 || this == X64;
Expand Down
4 changes: 2 additions & 2 deletions src/lime/tools/ProjectXMLParser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ class ProjectXMLParser extends HXProject
case "architecture":
if (element.has.name)
{
var name:Architecture = substitute(element.att.name).toUpperCase();
var name = new Architecture(substitute(element.att.name));

if (name != null)
{
Expand All @@ -1170,7 +1170,7 @@ class ProjectXMLParser extends HXProject

if (element.has.exclude)
{
var exclude:Architecture = substitute(element.att.exclude).toUpperCase();
var exclude = new Architecture(substitute(element.att.exclude));

if (exclude != null)
{
Expand Down
2 changes: 1 addition & 1 deletion tools/CommandLineTools.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ class CommandLineTools
{
if (argument.substr(0, 4) == "-arm")
{
var value:Architecture = argument.substr(1).toUpperCase();
var value = new Architecture(argument.substr(1));

if (value != null)
{
Expand Down

0 comments on commit 04f9a6c

Please sign in to comment.