Commit c8bea5db authored by Jesse McGrew's avatar Jesse McGrew
Browse files

Fixed "=" showing up as "Eq" in printed form of ComplexPropDef. [ZILF-207]

parent 1f065342926e
......@@ -72,6 +72,25 @@ namespace Zilf.Interpreter.Values.Tied
}
static readonly ObList detachedObList = new();
static readonly Dictionary<StdAtom, string> stdAtomNames = new();
static ZilTiedListBase()
{
var names = Enum.GetNames<StdAtom>();
foreach (var pname in names)
{
var sa = Enum.Parse<StdAtom>(pname);
if (sa == StdAtom.None)
continue;
var attr = typeof(StdAtom).GetField(pname)!.GetCustomAttributes<AtomAttribute>(false).SingleOrDefault();
if (attr != null && attr.Name != pname)
stdAtomNames.Add(sa, attr.Name);
}
}
protected static ZilAtom GetStdAtom(StdAtom stdAtom)
{
......@@ -81,7 +100,12 @@ namespace Zilf.Interpreter.Values.Tied
if (Diagnostics.DiagnosticContext.Current.Frame?.Context is Context ctx)
return ctx.GetStdAtom(stdAtom);
return detachedObList[stdAtom.ToString()];
var pname = stdAtomNames.GetValueOrDefault(stdAtom) ?? stdAtom.ToString();
if (!detachedObList.Contains(pname))
detachedObList[pname] = new ZilAtom(pname, detachedObList, stdAtom);
return detachedObList[pname];
}
protected static ZilObject FALSE
......
......@@ -48,7 +48,7 @@ namespace Zilf.ZModel.Values
Atom
}
struct InputElement
readonly struct InputElement
{
public readonly InputElementType Type;
public readonly ZilAtom? Variable;
......@@ -111,7 +111,7 @@ namespace Zilf.ZModel.Values
String
}
struct OutputElement
readonly struct OutputElement
{
public readonly OutputElementType Type;
public readonly ZilAtom? Constant, Variable, PartOfSpeech;
......@@ -212,7 +212,7 @@ namespace Zilf.ZModel.Values
}
}
struct Pattern
readonly struct Pattern
{
public readonly InputElement[] Inputs;
public readonly OutputElement[] Outputs;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment