From dc94c16b03a54594a91d6d50ca57f0c550fc7a2d Mon Sep 17 00:00:00 2001 From: Qrakhen Date: Sun, 9 Nov 2025 20:04:34 +0100 Subject: [PATCH] faster number check --- Qrakhen.Qamp.Core/Compilation/Digester.cs | 3 ++- Qrakhen.Qamp.Core/Logging/ILogger.cs | 1 - Qrakhen.Qamp.Core/Values/Value.cs | 7 ++++++- Qrakhen.Qamp.Core/Values/ValueType.cs | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Qrakhen.Qamp.Core/Compilation/Digester.cs b/Qrakhen.Qamp.Core/Compilation/Digester.cs index 7d29cae..411e469 100644 --- a/Qrakhen.Qamp.Core/Compilation/Digester.cs +++ b/Qrakhen.Qamp.Core/Compilation/Digester.cs @@ -198,7 +198,7 @@ public class Digester : ISteppable } if (canAssign && Match(T.Equal)) - ErrorAtCurrent("Invalid assignment target."); + ErrorAtCurrent("Invalid assignment target."); } internal void DeclareClass() @@ -559,6 +559,7 @@ public class Digester : ISteppable internal long IdentifierConstant(string? name) { + _logger.Method(name); return MakeConstant(String.Make(name ?? throw new TokenException("Empty string value for identifier detected", _reader, Current))); } diff --git a/Qrakhen.Qamp.Core/Logging/ILogger.cs b/Qrakhen.Qamp.Core/Logging/ILogger.cs index 5e9c08e..41f8ac0 100644 --- a/Qrakhen.Qamp.Core/Logging/ILogger.cs +++ b/Qrakhen.Qamp.Core/Logging/ILogger.cs @@ -1,6 +1,5 @@ using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Xml.XPath; namespace Qrakhen.Qamp.Core.Logging; diff --git a/Qrakhen.Qamp.Core/Values/Value.cs b/Qrakhen.Qamp.Core/Values/Value.cs index eb64c00..e702a12 100644 --- a/Qrakhen.Qamp.Core/Values/Value.cs +++ b/Qrakhen.Qamp.Core/Values/Value.cs @@ -47,7 +47,7 @@ public readonly struct Value : IValue, ISerialize, IDebug public T ValueType => Type; - public bool IsNumber => IsSigned || IsUnsigned || IsDecimal; + public bool IsNumber => Type <= T.Decimal; public bool IsSigned => Is(T.Signed); public bool IsUnsigned => Is(T.Unsigned); public bool IsDecimal => Is(T.Decimal); @@ -92,6 +92,11 @@ public readonly struct Value : IValue, ISerialize, IDebug return new Value(); } + + public void __gcMark() + { + if (IsObj && Ptr.Value != null) { } + } public override bool Equals([NotNullWhen(true)] object? obj) { diff --git a/Qrakhen.Qamp.Core/Values/ValueType.cs b/Qrakhen.Qamp.Core/Values/ValueType.cs index 2f0b51b..e1766bf 100644 --- a/Qrakhen.Qamp.Core/Values/ValueType.cs +++ b/Qrakhen.Qamp.Core/Values/ValueType.cs @@ -11,8 +11,8 @@ public enum ValueType Void = 0x0000, Unsigned = 0x0001, Signed = 0x0002, - Char = 0x0004, - Decimal = 0x0008, + Decimal = 0x0004, + Char = 0x0008, Bool = 0x0010, Number = Unsigned | Signed | Decimal,