faster number check
This commit is contained in:
parent
0b350ff4ec
commit
dc94c16b03
|
|
@ -198,7 +198,7 @@ public class Digester : ISteppable<Token>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canAssign && Match(T.Equal))
|
if (canAssign && Match(T.Equal))
|
||||||
ErrorAtCurrent("Invalid assignment target.");
|
ErrorAtCurrent("Invalid assignment target.");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void DeclareClass()
|
internal void DeclareClass()
|
||||||
|
|
@ -559,6 +559,7 @@ public class Digester : ISteppable<Token>
|
||||||
|
|
||||||
internal long IdentifierConstant(string? name)
|
internal long IdentifierConstant(string? name)
|
||||||
{
|
{
|
||||||
|
_logger.Method(name);
|
||||||
return MakeConstant(String.Make(name ??
|
return MakeConstant(String.Make(name ??
|
||||||
throw new TokenException("Empty string value for identifier detected", _reader, Current)));
|
throw new TokenException("Empty string value for identifier detected", _reader, Current)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Xml.XPath;
|
|
||||||
|
|
||||||
namespace Qrakhen.Qamp.Core.Logging;
|
namespace Qrakhen.Qamp.Core.Logging;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public readonly struct Value : IValue, ISerialize<Value>, IDebug<string>
|
||||||
|
|
||||||
public T ValueType => Type;
|
public T ValueType => Type;
|
||||||
|
|
||||||
public bool IsNumber => IsSigned || IsUnsigned || IsDecimal;
|
public bool IsNumber => Type <= T.Decimal;
|
||||||
public bool IsSigned => Is(T.Signed);
|
public bool IsSigned => Is(T.Signed);
|
||||||
public bool IsUnsigned => Is(T.Unsigned);
|
public bool IsUnsigned => Is(T.Unsigned);
|
||||||
public bool IsDecimal => Is(T.Decimal);
|
public bool IsDecimal => Is(T.Decimal);
|
||||||
|
|
@ -92,6 +92,11 @@ public readonly struct Value : IValue, ISerialize<Value>, IDebug<string>
|
||||||
|
|
||||||
return new Value();
|
return new Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void __gcMark()
|
||||||
|
{
|
||||||
|
if (IsObj && Ptr.Value != null) { }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Equals([NotNullWhen(true)] object? obj)
|
public override bool Equals([NotNullWhen(true)] object? obj)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ public enum ValueType
|
||||||
Void = 0x0000,
|
Void = 0x0000,
|
||||||
Unsigned = 0x0001,
|
Unsigned = 0x0001,
|
||||||
Signed = 0x0002,
|
Signed = 0x0002,
|
||||||
Char = 0x0004,
|
Decimal = 0x0004,
|
||||||
Decimal = 0x0008,
|
Char = 0x0008,
|
||||||
Bool = 0x0010,
|
Bool = 0x0010,
|
||||||
|
|
||||||
Number = Unsigned | Signed | Decimal,
|
Number = Unsigned | Signed | Decimal,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue