Prexonite, a .NET hosted scripting language with a focus on meta-programming and embedded DSLs
0

Configure Feed

Select the types of activity you want to include in your feed.

eliminate span warnings

Christian Klauser (Sep 20, 2025, 6:19 PM +0200) 27552fd2 24e29da9

+333 -349
+3 -3
Prexonite/Application.cs
··· 103 103 104 104 #region Construction 105 105 106 - public static readonly MetaEntry DefaultImport = new(new MetaEntry[] { nameof(System) }); 106 + public static readonly MetaEntry DefaultImport = new([nameof(System)]); 107 107 108 108 /// <summary> 109 109 /// Creates a new application with a GUID as its Id. ··· 318 318 _InitializationFunction.CreateFunctionContext 319 319 ( 320 320 targetEngine, 321 - Array.Empty<PValue>(), // \init has no arguments 322 - Array.Empty<PVariable>(), // \init is not a closure 321 + [], // \init has no arguments 322 + [], // \init is not a closure 323 323 true // don't initialize. That's what WE are trying to do here. 324 324 ); 325 325
+2 -1
Prexonite/CilFunctionContext.cs
··· 41 41 } 42 42 43 43 internal static MethodInfo NewMethod { get; } = typeof (CilFunctionContext).GetMethod( 44 - nameof(New), new[] {typeof (StackContext), typeof (PFunction)})!; 44 + nameof(New), 45 + [typeof (StackContext), typeof (PFunction)])!; 45 46 46 47 CilFunctionContext(Engine parentEngine, Application parentApplication, 47 48 SymbolCollection importedNamespaces)
+3 -3
Prexonite/Commands/Concurrency/AsyncSeq.cs
··· 117 117 118 118 wait: 119 119 Select.RunStatically( 120 - _sctxCarrier.StackContext, new[] 121 - { 120 + _sctxCarrier.StackContext, 121 + [ 122 122 new KeyValuePair<Channel?, PValue> 123 123 ( 124 124 rset, pfunc( ··· 148 148 })), 149 149 new KeyValuePair<Channel?, PValue> 150 150 (null, PType.Null), 151 - }, false); 151 + ], false); 152 152 153 153 //We loop until the dispose command is explicitly given. 154 154 // -> This way, a reset command can be issued after
+1 -1
Prexonite/Commands/Concurrency/CallAsync.cs
··· 69 69 PValue result; 70 70 try 71 71 { 72 - result = args[0].IndirectCall(sctx, iargs.ToArray()); 72 + result = args[0].IndirectCall(sctx, [..iargs]); 73 73 } 74 74 catch (Exception ex) 75 75 {
+2 -2
Prexonite/Commands/Concurrency/Chan.cs
··· 60 60 } 61 61 62 62 static readonly ConstructorInfo _channelCtor = 63 - typeof (Channel).GetConstructor(Array.Empty<Type>())!; 63 + typeof (Channel).GetConstructor([])!; 64 64 65 65 static readonly ConstructorInfo _newPValue = 66 - typeof (PValue).GetConstructor(new[] {typeof (object), typeof (PType)})!; 66 + typeof (PValue).GetConstructor([typeof (object), typeof (PType)])!; 67 67 68 68 void ICilCompilerAware.ImplementInCil(CompilerState state, Instruction ins) 69 69 {
+2 -2
Prexonite/Commands/Concurrency/Select.cs
··· 116 116 return performSubCall 117 117 ? CallSubPerform.RunStatically(sctx, handler, handlerArgv, 118 118 useIndirectCallAsFallback: true) 119 - : handler.IndirectCall(sctx, handlerArgv); 119 + : handler.IndirectCall(sctx, handlerArgv.AsSpan()); 120 120 } 121 121 122 122 static readonly PType _chanType = PType.Object[typeof (Channel)]; ··· 138 138 return null; 139 139 else if (key.Value == null) 140 140 return null; 141 - else if (Runtime.ExtractBool(key.IndirectCall(sctx, Array.Empty<PValue>()), 141 + else if (Runtime.ExtractBool(key.IndirectCall(sctx), 142 142 sctx)) 143 143 return kvp.Value; 144 144 else
+2 -3
Prexonite/Commands/Core/Call.cs
··· 24 24 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 25 // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 26 27 - using System.Diagnostics; 28 27 using Prexonite.Commands.List; 29 28 using Prexonite.Compiler.Cil; 30 29 using Prexonite.Compiler.Macro; ··· 92 91 93 92 var iargs = FlattenArguments(sctx, args, 1); 94 93 95 - return args[0].IndirectCall(sctx, iargs.ToArray()); 94 + return args[0].IndirectCall(sctx, [..iargs.AsReadOnly()]); 96 95 } 97 96 98 97 /// <summary> ··· 166 165 public static StackContext CreateStackContext(StackContext sctx, PValue callable, 167 166 PValue[] args) 168 167 { 169 - if (callable.Type is ObjectPType && callable.Value is IStackAware sa) 168 + if (callable is { Type: ObjectPType, Value: IStackAware sa }) 170 169 return sa.CreateStackContext(sctx, args); 171 170 else 172 171 return new IndirectCallContext(sctx, callable, args);
+2 -2
Prexonite/Commands/Core/CallSubPerform.cs
··· 89 89 if ((func ?? fpv.Value as PFunction) is { CilImplementation: { } cilImpl} pFunc) 90 90 { 91 91 cilImpl.Invoke( 92 - pFunc, CilFunctionContext.New(sctx, pFunc), iargs, sharedVars ?? Array.Empty<PVariable>(), 92 + pFunc, CilFunctionContext.New(sctx, pFunc), iargs, sharedVars ?? [], 93 93 out result, out returnMode); 94 94 } 95 95 else if (fpv.Value is IStackAware f) ··· 123 123 } 124 124 else if (useIndirectCallAsFallback) 125 125 { 126 - result = fpv.IndirectCall(sctx, iargs); 126 + result = fpv.IndirectCall(sctx, [..iargs.AsReadOnly()]); 127 127 returnMode = ReturnMode.Exit; 128 128 } 129 129 else
+1 -1
Prexonite/Commands/Core/Call_Member.cs
··· 76 76 { 77 77 if (sctx == null) 78 78 throw new ArgumentNullException(nameof(sctx)); 79 - if (args == null || args.Length < 2 || args[0] == null) 79 + if (args.Length < 2 || args[0] == null) 80 80 throw new ArgumentException( 81 81 "The command callmember has the signature(obj, [isSet,] id [, arg1, arg2,...,argn])."); 82 82
+3 -3
Prexonite/Commands/Core/Call_Tail.cs
··· 58 58 if (sctx == null) 59 59 throw new ArgumentNullException(nameof(sctx)); 60 60 61 - if (args == null || args.Length < 1 || args[0] == null || args[0].IsNull) 61 + if (args.IsEmpty || (PValue?)args[0] == null || args[0].IsNull) 62 62 return PType.Null; 63 63 64 64 var iargs = make_tailcall(sctx, args); 65 65 66 - return args[0].IndirectCall(sctx, iargs.ToArray()); 66 + return args[0].IndirectCall(sctx, [..iargs.AsReadOnly()]); 67 67 } 68 68 69 69 public override StackContext CreateStackContext(StackContext sctx, PValue[]? args) ··· 71 71 if (sctx == null) 72 72 throw new ArgumentNullException(nameof(sctx)); 73 73 74 - if (args == null || args.Length < 1 || args[0] == null || args[0].IsNull) 74 + if (args == null || args.Length < 1 || (PValue?)args[0] == null || args[0].IsNull) 75 75 return new NullContext(sctx); 76 76 77 77 var iargs = make_tailcall(sctx, args);
+1 -1
Prexonite/Commands/Core/Caller.cs
··· 86 86 } 87 87 88 88 static readonly MethodInfo GetCallerFromCilFunctionMethod = 89 - typeof (Caller).GetMethod(nameof(GetCallerFromCilFunction), new[] {typeof (StackContext)})!; 89 + typeof (Caller).GetMethod(nameof(GetCallerFromCilFunction), [typeof (StackContext)])!; 90 90 91 91 #region ICilCompilerAware Members 92 92
+1 -1
Prexonite/Commands/Core/CompileToCil.cs
··· 84 84 { 85 85 if (sctx == null) 86 86 throw new ArgumentNullException(nameof(sctx)); 87 - args ??= Array.Empty<PValue>(); 87 + args ??= []; 88 88 89 89 var linking = FunctionLinking.FullyStatic; 90 90 switch (args.Length)
+3 -3
Prexonite/Commands/Core/ConsolePrintLine.cs
··· 89 89 90 90 //Fix #10 91 91 internal static readonly MethodInfo ConsoleWriteLineMethodString = 92 - typeof (Console).GetMethod("WriteLine", new[] {typeof (string)})!; 92 + typeof (Console).GetMethod("WriteLine", [typeof (string)])!; 93 93 94 94 internal static readonly MethodInfo ConsoleWriteLineMethod = 95 95 typeof (Console).GetMethod("WriteLine", Type.EmptyTypes)!; 96 96 97 97 internal static readonly MethodInfo ConsoleWriteMethod = 98 - typeof (Console).GetMethod("Write", new[] {typeof (string)})!; 98 + typeof (Console).GetMethod("Write", [typeof (string)])!; 99 99 100 100 internal static readonly MethodInfo PValueCallToString = 101 - typeof (PValue).GetMethod("CallToString", new[] {typeof (StackContext)})!; 101 + typeof (PValue).GetMethod("CallToString", [typeof (StackContext)])!; 102 102 103 103 /// <summary> 104 104 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Core/Const.cs
··· 76 76 get 77 77 { 78 78 return _createConstFunctionInfoCache ??= typeof (Const).GetMethod(nameof(CreateConstFunction), 79 - new[] {typeof (PValue), typeof (StackContext)})!; 79 + [typeof (PValue), typeof (StackContext)])!; 80 80 } 81 81 } 82 82
+2 -1
Prexonite/Commands/Core/Debug.cs
··· 45 45 foreach (var arg in args) 46 46 { 47 47 println.Run( 48 - sctx, new PValue[] {string.Concat("DEBUG ??? = ", arg.CallToString(sctx))}); 48 + sctx, 49 + string.Concat("DEBUG ??? = ", arg.CallToString(sctx))); 49 50 } 50 51 return debugging; 51 52 }
+1 -1
Prexonite/Commands/Core/Dispose.cs
··· 127 127 state.EmitLoadLocal(state.SctxLocal); 128 128 var run = 129 129 typeof (Dispose).GetMethod(nameof(RunStatically), 130 - new[] {typeof (PValue), typeof (StackContext)})!; 130 + [typeof (PValue), typeof (StackContext)])!; 131 131 state.Il.EmitCall(OpCodes.Call, run, null); 132 132 if (!ins.JustEffect) 133 133 state.EmitLoadNullAsPValue();
+1 -1
Prexonite/Commands/Core/LoadAssembly.cs
··· 56 56 { 57 57 if (sctx == null) 58 58 throw new ArgumentNullException(nameof(sctx)); 59 - args ??= Array.Empty<PValue>(); 59 + args ??= []; 60 60 61 61 var eng = sctx.ParentEngine; 62 62 foreach (var arg in args)
+1 -1
Prexonite/Commands/Core/Meta.cs
··· 72 72 { 73 73 if (sctx == null) 74 74 throw new ArgumentNullException(nameof(sctx)); 75 - if (args != null && args.Length > 0) 75 + if (args.Length > 0) 76 76 throw new PrexoniteException("The meta command no longer accepts arguments."); 77 77 78 78 if (sctx is not FunctionContext fctx)
+1 -1
Prexonite/Commands/Core/Operators/BinaryOperatorBase.cs
··· 65 65 { 66 66 //Both operands are constants (remember: static args can also be references) 67 67 //=> Apply the operator at compile time. 68 - var result = Run(state, new[] {left, right}); 68 + var result = Run(state, left, right); 69 69 switch (result.Type.ToBuiltIn()) 70 70 { 71 71 case PType.BuiltIn.Real:
+2 -2
Prexonite/Commands/Core/PartialApplication/FlippedFunctionalPartialCallCommand.cs
··· 65 65 { 66 66 get 67 67 { 68 - return _functionPartialCallCtorCache ??= typeof(FlippedFunctionalPartialCall).GetConstructor(new[] 69 - { typeof(PValue), typeof(PValue[]) }) ?? throw new InvalidOperationException( 68 + return _functionPartialCallCtorCache ??= typeof(FlippedFunctionalPartialCall).GetConstructor([typeof(PValue), typeof(PValue[]), 69 + ]) ?? throw new InvalidOperationException( 70 70 $"Could not find constructor for {nameof(FlippedFunctionalPartialCall)} with (PValue, PValue[])."); 71 71 } 72 72 }
+2 -2
Prexonite/Commands/Core/PartialApplication/FunctionalPartialCallCommand.cs
··· 64 64 { 65 65 get 66 66 { 67 - return _functionPartialCallCtorCache ??= typeof (FunctionalPartialCall).GetConstructor(new[] 68 - {typeof (PValue), typeof (PValue[])}) 67 + return _functionPartialCallCtorCache ??= typeof (FunctionalPartialCall).GetConstructor([typeof (PValue), typeof (PValue[]), 68 + ]) 69 69 ?? throw new InvalidOperationException($"Could not find constructor for {nameof(FunctionalPartialCall)} with (PValue, PValue[])."); 70 70 } 71 71 }
+1 -1
Prexonite/Commands/Core/PartialApplication/PartialApplicationBase.cs
··· 55 55 get 56 56 { 57 57 return _mappings.Array == null 58 - ? Enumerable.Empty<int>() 58 + ? [] 59 59 : Enumerable.Range(_mappings.Offset, _mappings.Count).Select(i => _mappings.Array[i]); 60 60 } 61 61 }
+5 -5
Prexonite/Commands/Core/PartialApplication/PartialApplicationCommandBase.cs
··· 34 34 public abstract class PartialApplicationCommandBase : PCommand 35 35 { 36 36 protected static readonly MethodInfo ExtractMappings32Method = typeof (PartialApplicationCommandBase) 37 - .GetMethod(nameof(ExtractMappings32), new[] {typeof (int[])}) 37 + .GetMethod(nameof(ExtractMappings32), [typeof (int[])]) 38 38 ?? throw new InvalidOperationException("Method PartialApplicationCommandBase.ExtractMappings32 not found."); 39 39 40 40 /// <summary> ··· 75 75 public static int[] ExtractMappings32(LinkedList<int> rawInput) 76 76 { 77 77 if (rawInput.Count == 0) 78 - return Array.Empty<int>(); 78 + return []; 79 79 80 80 //Extract count 81 81 var int32 = default(ExplicitInt32); ··· 83 83 int count = int32.Byte3; 84 84 var numArgs = CountInt32Required(count); 85 85 if (numArgs > rawInput.Count) 86 - return Array.Empty<int>(); 86 + return []; 87 87 88 88 //remove integers that do not belong to the mapping 89 89 while (numArgs < rawInput.Count) ··· 123 123 // ReSharper restore UnusedMember.Global 124 124 { 125 125 if (rawInput.Length == 0) 126 - return Array.Empty<int>(); 126 + return []; 127 127 128 128 //Extract count 129 129 var int32 = default(ExplicitInt32); ··· 275 275 protected virtual ConstructorInfo GetConstructorCtor(TCompileParam parameter) 276 276 { 277 277 var ty = GetPartialCallRepresentationType(parameter); 278 - return ty.GetConstructor(new[] {typeof (int[]), typeof (PValue[])}) 278 + return ty.GetConstructor([typeof (int[]), typeof (PValue[])]) 279 279 ?? throw new PrexoniteException($"Type {ty} does not have a constructor with the signature (int[], PValue[])"); 280 280 } 281 281
+1 -1
Prexonite/Commands/Core/PartialApplication/PartialConstructionCommand.cs
··· 54 54 { 55 55 var ty = GetPartialCallRepresentationType(parameter); 56 56 return _ptypeConstructCtor ??= ty.GetConstructor( 57 - new[] {typeof (int[]), typeof (PValue[]), typeof (PType)}) 57 + [typeof (int[]), typeof (PValue[]), typeof (PType)]) 58 58 ?? throw new InvalidOperationException($"{ty} does not have an (int[], PValue[], PValue) constructor."); 59 59 } 60 60
+3 -4
Prexonite/Commands/Core/PartialApplication/PartialMemberCallCommand.cs
··· 127 127 state.Il.Emit( 128 128 OpCodes.Newobj, 129 129 _partialMemberCallCtor ??= (typeof (PartialMemberCall).GetConstructor( 130 - new[] 131 - { 132 - typeof (int[]), 130 + [ 131 + typeof (int[]), 133 132 typeof (PValue[]), 134 133 typeof (string), 135 134 typeof (PCall), 136 - })) ?? throw new InvalidOperationException("Constructor PartialMemberCall(int[], PValue[], string, PCall) is missing.")); 135 + ])) ?? throw new InvalidOperationException("Constructor PartialMemberCall(int[], PValue[], string, PCall) is missing.")); 137 136 } 138 137 139 138 #endregion
+2 -3
Prexonite/Commands/Core/PartialApplication/PartialStaticCallCommand.cs
··· 42 42 43 43 protected override ConstructorInfo GetConstructorCtor(CompileTimeStaticCallInfo parameter) 44 44 { 45 - return _partialStaticCallCtor ??= typeof (PartialStaticCall).GetConstructor(new[] 46 - { 45 + return _partialStaticCallCtor ??= typeof (PartialStaticCall).GetConstructor([ 47 46 typeof (int[]), typeof (PValue[]), typeof (PCall), typeof (string), 48 47 typeof (PType), 49 - }) ?? throw new InvalidOperationException($"{nameof(PartialStaticCall)} does not have an (int[], PValue[], PCall, string, PType) constructor."); 48 + ]) ?? throw new InvalidOperationException($"{nameof(PartialStaticCall)} does not have an (int[], PValue[], PCall, string, PType) constructor."); 50 49 } 51 50 52 51 protected override void EmitConstructorCall(CompilerState state, CompileTimeStaticCallInfo parameter)
+2 -2
Prexonite/Commands/Core/PartialApplication/PartialTypeCastCommand.cs
··· 46 46 47 47 protected override ConstructorInfo GetConstructorCtor(CompileTimePTypeInfo parameter) 48 48 { 49 - return _partialTypeCastCtor ??= typeof (PartialTypecast).GetConstructor(new[] 50 - {typeof (int[]), typeof (PValue[]), typeof (PType)}) 49 + return _partialTypeCastCtor ??= typeof (PartialTypecast).GetConstructor([typeof (int[]), typeof (PValue[]), typeof (PType), 50 + ]) 51 51 ?? throw new InvalidOperationException($"{nameof(PartialTypecast)} does not have an (int[], PValue[], PType) constructor."); 52 52 } 53 53
+2 -2
Prexonite/Commands/Core/PartialApplication/PartialTypeCheckCommand.cs
··· 46 46 47 47 protected override ConstructorInfo GetConstructorCtor(CompileTimePTypeInfo parameter) 48 48 { 49 - return _partialTypeCheckCtor ??= typeof (PartialTypeCheck).GetConstructor(new[] 50 - {typeof (int[]), typeof (PValue[]), typeof (PType)}) 49 + return _partialTypeCheckCtor ??= typeof (PartialTypeCheck).GetConstructor([typeof (int[]), typeof (PValue[]), typeof (PType), 50 + ]) 51 51 ?? throw new InvalidOperationException($"{nameof(PartialTypeCheck)} does not have an (int[], PValue[], PType) constructor."); 52 52 } 53 53
+2 -1
Prexonite/Commands/Core/StaticPrint.cs
··· 160 160 typeof (StaticPrint).GetProperty(nameof(Writer))!.GetGetMethod()!; 161 161 162 162 static readonly MethodInfo _textWriterWriteMethod = typeof (TextWriter).GetMethod( 163 - "Write", new[] {typeof (string)})!; 163 + "Write", 164 + [typeof (string)])!; 164 165 165 166 internal static string _ToString(CompileTimeValue value) 166 167 {
+2 -1
Prexonite/Commands/Core/StaticPrintLine.cs
··· 131 131 132 132 static readonly MethodInfo _textWriterWriteLineMethod = typeof (TextWriter). 133 133 GetMethod( 134 - "WriteLine", new[] {typeof (string)})!; 134 + "WriteLine", 135 + [typeof (string)])!; 135 136 136 137 #endregion 137 138 }
-2
Prexonite/Commands/Core/Unbind.cs
··· 86 86 /// <exception cref = "ArgumentNullException">args is null</exception> 87 87 public override PValue Run(StackContext sctx, ReadOnlySpan<PValue> args) 88 88 { 89 - if (args == null) 90 - throw new ArgumentNullException(nameof(args)); 91 89 foreach (var arg in args) 92 90 Run(sctx, arg); 93 91 return PType.Null.CreatePValue();
-2
Prexonite/Commands/CoroutineCommand.cs
··· 40 40 { 41 41 if (sctx == null) 42 42 throw new ArgumentNullException(nameof(sctx)); 43 - if (args == null) 44 - throw new ArgumentNullException(nameof(args)); 45 43 46 44 var carrier = new ContextCarrier(); 47 45 var corctx = new CoroutineContext(sctx, CoroutineRun(carrier, args.ToArray()));
+2 -2
Prexonite/Commands/Lazy/ThunkCommand.cs
··· 171 171 172 172 public PValue Force(StackContext sctx) 173 173 { 174 - return ((IIndirectCall) this).IndirectCall(sctx, Array.Empty<PValue>()); 174 + return ((IIndirectCall) this).IndirectCall(sctx); 175 175 } 176 176 177 177 public bool IsEvaluated => _value != null; ··· 239 239 { 240 240 try 241 241 { 242 - _value = expr.IndirectCall(sctx, dynParameters); 242 + _value = expr.IndirectCall(sctx, dynParameters.AsSpan()); 243 243 } 244 244 catch (Exception ex) 245 245 {
+3 -3
Prexonite/Commands/List/CreateEnumerator.cs
··· 85 85 throw new InvalidOperationException("The enumerator has already been disposed."); 86 86 try 87 87 { 88 - dispose.IndirectCall(sctx, Array.Empty<PValue>()); 88 + dispose.IndirectCall(sctx); 89 89 } 90 90 finally 91 91 { ··· 107 107 /// <filterpriority>2</filterpriority> 108 108 public override bool MoveNext() 109 109 { 110 - return Runtime.ExtractBool(moveNext.IndirectCall(sctx, Array.Empty<PValue>()), 110 + return Runtime.ExtractBool(moveNext.IndirectCall(sctx), 111 111 sctx); 112 112 } 113 113 ··· 121 121 /// <returns> 122 122 /// The element in the collection at the current position of the enumerator. 123 123 /// </returns> 124 - public override PValue Current => current.IndirectCall(sctx, Array.Empty<PValue>()); 124 + public override PValue Current => current.IndirectCall(sctx); 125 125 126 126 #endregion 127 127 }
-2
Prexonite/Commands/List/Exists.cs
··· 32 32 { 33 33 if (sctx == null) 34 34 throw new ArgumentNullException(nameof(sctx)); 35 - if (args == null) 36 - throw new ArgumentNullException(nameof(args)); 37 35 38 36 if (args.Length < 1) 39 37 throw new PrexoniteException("Exists requires at least two arguments");
+1 -4
Prexonite/Commands/List/ForAll.cs
··· 32 32 { 33 33 if (sctx == null) 34 34 throw new ArgumentNullException(nameof(sctx)); 35 - if (args == null) 36 - throw new ArgumentNullException(nameof(args)); 37 - 38 - if (args.Length < 1) 35 + if (args.IsEmpty) 39 36 throw new PrexoniteException("Exists requires at least two arguments"); 40 37 var f = args[0]; 41 38
+2 -2
Prexonite/Commands/List/Map.cs
··· 87 87 static IEnumerable<PValue> _wrapDynamicIEnumerable(StackContext sctx, PValue psource) 88 88 { 89 89 var pvEnumerator = 90 - psource.DynamicCall(sctx, Array.Empty<PValue>(), PCall.Get, "GetEnumerator"). 90 + psource.DynamicCall(sctx, [], PCall.Get, "GetEnumerator"). 91 91 ConvertTo(sctx, typeof (IEnumerator)); 92 92 var enumerator = (IEnumerator) pvEnumerator.Value!; 93 - PValueEnumerator? pvEnum; 94 93 try 95 94 { 95 + PValueEnumerator? pvEnum; 96 96 if ((pvEnum = enumerator as PValueEnumerator) != null) 97 97 { 98 98 while (pvEnum.MoveNext())
+1 -1
Prexonite/Commands/Math/Abs.cs
··· 116 116 } 117 117 118 118 static readonly MethodInfo RunStaticallyMethod = 119 - typeof (Abs).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 119 + typeof (Abs).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 120 120 121 121 /// <summary> 122 122 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Ceiling.cs
··· 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 97 typeof (Ceiling).GetMethod(nameof(RunStatically), 98 - new[] {typeof (PValue), typeof (StackContext)})!; 98 + [typeof (PValue), typeof (StackContext)])!; 99 99 100 100 /// <summary> 101 101 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Cos.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Cos).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Cos).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Exp.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Exp).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Exp).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Floor.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Floor).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Floor).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+2 -2
Prexonite/Commands/Math/Log.cs
··· 103 103 } 104 104 105 105 static readonly MethodInfo RunStaticallyNaturalMethod = 106 - typeof (Log).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 106 + typeof (Log).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 107 107 108 108 static readonly MethodInfo RunStaticallyAnyMethod = 109 109 typeof (Log).GetMethod(nameof(RunStatically), 110 - new[] {typeof (PValue), typeof (PValue), typeof (StackContext)})!; 110 + [typeof (PValue), typeof (PValue), typeof (StackContext)])!; 111 111 112 112 /// <summary> 113 113 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Max.cs
··· 118 118 119 119 static readonly MethodInfo RunStaticallyMethod = 120 120 typeof (Max).GetMethod(nameof(RunStatically), 121 - new[] {typeof (PValue), typeof (PValue), typeof (StackContext)})!; 121 + [typeof (PValue), typeof (PValue), typeof (StackContext)])!; 122 122 123 123 /// <summary> 124 124 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Min.cs
··· 117 117 118 118 static readonly MethodInfo RunStaticallyMethod = 119 119 typeof (Min).GetMethod(nameof(RunStatically), 120 - new[] {typeof (PValue), typeof (PValue), typeof (StackContext)})!; 120 + [typeof (PValue), typeof (PValue), typeof (StackContext)])!; 121 121 122 122 /// <summary> 123 123 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Round.cs
··· 111 111 112 112 static readonly MethodInfo RunStaticallyMethod = 113 113 typeof (Round).GetMethod(nameof(RunStatically), 114 - new[] {typeof (PValue), typeof (PValue), typeof (StackContext)})!; 114 + [typeof (PValue), typeof (PValue), typeof (StackContext)])!; 115 115 116 116 /// <summary> 117 117 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Sin.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Sin).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Sin).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Sqrt.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Sqrt).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Sqrt).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Math/Tan.cs
··· 94 94 } 95 95 96 96 static readonly MethodInfo RunStaticallyMethod = 97 - typeof (Tan).GetMethod(nameof(RunStatically), new[] {typeof (PValue), typeof (StackContext)})!; 97 + typeof (Tan).GetMethod(nameof(RunStatically), [typeof (PValue), typeof (StackContext)])!; 98 98 99 99 /// <summary> 100 100 /// Provides a custom compiler routine for emitting CIL byte code for a specific instruction.
+1 -1
Prexonite/Commands/Text/SetCenterCommand.cs
··· 46 46 // function setright(w,s,f) 47 47 if (sctx == null) 48 48 throw new ArgumentNullException(nameof(sctx)); 49 - args ??= Array.Empty<PValue>(); 49 + args ??= []; 50 50 51 51 string s; 52 52 int w;
+1 -1
Prexonite/Compiler/AST/AstArgumentSplice.cs
··· 60 60 return false; 61 61 } 62 62 63 - public AstExpr[] Expressions => new[] {ArgumentList}; 63 + public AstExpr[] Expressions => [ArgumentList]; 64 64 65 65 public bool IsPlaceholderSplice => ArgumentList is AstPlaceholder; 66 66
+3 -3
Prexonite/Compiler/AST/AstBlock.cs
··· 70 70 Symbols = newStore; 71 71 } 72 72 73 - List<AstNode> _statements = new(); 73 + List<AstNode> _statements = []; 74 74 75 75 public List<AstNode> Statements 76 76 { ··· 331 331 get 332 332 { 333 333 if(Expression == null) 334 - return Array.Empty<AstExpr>(); 334 + return []; 335 335 else 336 - return new[] {Expression}; 336 + return [Expression]; 337 337 } 338 338 } 339 339
+2 -2
Prexonite/Compiler/AST/AstCondition.cs
··· 51 51 52 52 public AstBlock[] Blocks 53 53 { 54 - get { return new AstBlock[] {IfBlock, ElseBlock}; } 54 + get { return [IfBlock, ElseBlock]; } 55 55 } 56 56 57 57 #region IAstHasExpressions Members 58 58 59 59 public AstExpr[] Expressions 60 60 { 61 - get { return new[] {Condition}; } 61 + get { return [Condition]; } 62 62 } 63 63 64 64 #endregion
+1 -1
Prexonite/Compiler/AST/AstFactoryBase.cs
··· 376 376 case BinaryOperator.DeltaRight: 377 377 break; 378 378 case BinaryOperator.Coalescence: 379 - return Coalescence(position, new[] {left, right}); 379 + return Coalescence(position, [left, right]); 380 380 case BinaryOperator.Cast: 381 381 if (right is not AstTypeExpr T) 382 382 {
+1 -1
Prexonite/Compiler/AST/AstForLoop.cs
··· 212 212 213 213 public override AstExpr[] Expressions 214 214 { 215 - get { return Condition != null ? new[] {Condition} : Array.Empty<AstExpr>(); } 215 + get { return Condition != null ? [Condition] : []; } 216 216 } 217 217 218 218 #endregion
+1 -1
Prexonite/Compiler/AST/AstForeachLoop.cs
··· 53 53 54 54 public override AstExpr[] Expressions 55 55 { 56 - get { return List != null ? new[] {List} : Array.Empty<AstExpr>(); } 56 + get { return List != null ? [List] : []; } 57 57 } 58 58 59 59 #endregion
+1 -1
Prexonite/Compiler/AST/AstKeyValuePair.cs
··· 50 50 51 51 #region IAstHasExpressions Members 52 52 53 - public AstExpr[] Expressions => new[] {Key, Value}; 53 + public AstExpr[] Expressions => [Key, Value]; 54 54 55 55 #endregion 56 56
+1 -1
Prexonite/Compiler/AST/AstLoop.cs
··· 40 40 41 41 public virtual AstBlock[] Blocks 42 42 { 43 - get { return new AstBlock[] {Block}; } 43 + get { return [Block]; } 44 44 } 45 45 46 46 #endregion
+1 -1
Prexonite/Compiler/AST/AstReturn.cs
··· 47 47 48 48 #region IAstHasExpressions Members 49 49 50 - public AstExpr[] Expressions => Expression != null ? new[] { Expression } : Array.Empty<AstExpr>(); 50 + public AstExpr[] Expressions => Expression != null ? [Expression] : []; 51 51 52 52 #endregion 53 53
+2 -2
Prexonite/Compiler/AST/AstStringConcatenation.cs
··· 46 46 /// <summary> 47 47 /// The list of arguments for the string concatenation. 48 48 /// </summary> 49 - readonly List<AstExpr> _arguments = new(); 49 + readonly List<AstExpr> _arguments = []; 50 50 51 51 /// <summary> 52 52 /// Creates a new AstStringConcatenation AST node. ··· 64 64 if (multiConcatPrototype == null) 65 65 throw new ArgumentNullException(nameof(multiConcatPrototype)); 66 66 67 - arguments ??= Array.Empty<AstExpr>(); 67 + arguments ??= []; 68 68 69 69 _arguments.AddRange(arguments); 70 70 _simpleConcatPrototype = simpleConcatPrototype;
+1 -1
Prexonite/Compiler/AST/AstThrow.cs
··· 40 40 41 41 public AstExpr[] Expressions 42 42 { 43 - get { return new[] {Expression}; } 43 + get { return [Expression]; } 44 44 } 45 45 46 46 #endregion
+1 -1
Prexonite/Compiler/AST/AstTryCatchFinally.cs
··· 46 46 47 47 public AstBlock[] Blocks 48 48 { 49 - get { return new AstBlock[] {TryBlock, CatchBlock, FinallyBlock}; } 49 + get { return [TryBlock, CatchBlock, FinallyBlock]; } 50 50 } 51 51 52 52 #endregion
+1 -1
Prexonite/Compiler/AST/AstTypeCast.cs
··· 49 49 50 50 public AstExpr[] Expressions 51 51 { 52 - get { return new[] {Subject}; } 52 + get { return [Subject]; } 53 53 } 54 54 55 55 #endregion
+1 -1
Prexonite/Compiler/AST/AstTypecheck.cs
··· 44 44 45 45 public AstExpr[] Expressions 46 46 { 47 - get { return new[] {_subject}; } 47 + get { return [_subject]; } 48 48 } 49 49 50 50 public AstExpr Subject
+1 -1
Prexonite/Compiler/AST/AstUnaryOperator.cs
··· 44 44 45 45 #region IAstHasExpressions Members 46 46 47 - public AstExpr[] Expressions => new[] {Operand}; 47 + public AstExpr[] Expressions => [Operand]; 48 48 49 49 public UnaryOperator Operator { get; } 50 50
+1 -1
Prexonite/Compiler/AST/AstUsing.cs
··· 45 45 46 46 public AstBlock[] Blocks 47 47 { 48 - get { return new AstBlock[] {Block}; } 48 + get { return [Block]; } 49 49 } 50 50 51 51 #region IAstHasExpressions Members
+1 -1
Prexonite/Compiler/AST/AstWhileLoop.cs
··· 46 46 47 47 public override AstExpr[] Expressions 48 48 { 49 - get { return Condition != null ? new[] {Condition} : Array.Empty<AstExpr>(); } 49 + get { return Condition != null ? [Condition] : []; } 50 50 } 51 51 52 52 [MemberNotNullWhen(true, nameof(Condition))]
+3 -3
Prexonite/Compiler/Build/Internal/DefaultModuleTarget.cs
··· 34 34 class DefaultModuleTarget : ITarget 35 35 { 36 36 static readonly IReadOnlyCollection<IResourceDescriptor> _emptyResourceCollection = 37 - Array.Empty<IResourceDescriptor>(); 37 + []; 38 38 39 39 readonly List<Message>? _messages; 40 40 ··· 44 44 Symbols = symbols ?? throw new ArgumentNullException(nameof(symbols)); 45 45 Exception = exception; 46 46 if(messages != null) 47 - _messages = new(messages); 47 + _messages = [..messages]; 48 48 IsSuccessful = exception == null && (_messages == null || _messages.All(m => m.Severity != MessageSeverity.Error)); 49 49 } 50 50 ··· 89 89 90 90 public ModuleName Name => Module.Name; 91 91 92 - internal static readonly Message[] NoMessages = Array.Empty<Message>(); 92 + internal static readonly Message[] NoMessages = []; 93 93 94 94 public IReadOnlyCollection<Message> Messages => (IReadOnlyCollection<Message>?)_messages ?? NoMessages; 95 95
+2 -2
Prexonite/Compiler/Build/Internal/ManualTargetDescription.cs
··· 53 53 _dependencies = new(moduleName); 54 54 _dependencies.AddRange(dependencies); 55 55 if (buildMessages != null) 56 - _buildMessages = new(buildMessages); 56 + _buildMessages = [..buildMessages]; 57 57 } 58 58 59 59 public IReadOnlyCollection<ModuleName> Dependencies => _dependencies; ··· 84 84 if (!_source.TryOpen(out var reader)) 85 85 throw new BuildFailureException(this, 86 86 $"The source for target {Name} could not be opened.", 87 - Enumerable.Empty<Message>()); 87 + []); 88 88 using (reader) 89 89 { 90 90 token.ThrowIfCancellationRequested();
+5 -5
Prexonite/Compiler/Build/Internal/SelfAssemblingPlan.cs
··· 125 125 { 126 126 return CreateDescription(moduleName, Source.FromString(""), 127 127 NoSourcePosition.MissingFileName, 128 - Enumerable.Empty<ModuleName>(), 129 - new[] {errorMessage}); 128 + [], 129 + [errorMessage]); 130 130 } 131 131 else 132 132 { 133 133 throw new BuildFailureException(null, "There {2} {0} {1} while trying to determine dependencies.", 134 - new[] {errorMessage}); 134 + [errorMessage]); 135 135 } 136 136 } 137 137 ··· 141 141 RegisterOnly, 142 142 } 143 143 144 - readonly HashSet<ModuleName> _standardLibrary = new(); 144 + readonly HashSet<ModuleName> _standardLibrary = []; 145 145 public ISet<ModuleName> StandardLibrary => _standardLibrary; 146 146 147 147 ··· 510 510 { 511 511 public volatile ModuleName? ModuleName; 512 512 513 - public readonly List<RefSpec> References = new(); 513 + public readonly List<RefSpec> References = []; 514 514 515 515 public volatile string? ErrorMessage; 516 516
+2 -3
Prexonite/Compiler/Build/Plan.cs
··· 34 34 public static readonly TraceSource Trace = new("Prexonite.Compiler.Build"); 35 35 36 36 /// <summary>List of modules included in the Prexonite assembly. Does not include 'sys' itself.</summary> 37 - static readonly ISource[] _stdLibModules = 38 - { 37 + static readonly ISource[] _stdLibModules = [ 39 38 Source.FromEmbeddedPrexoniteResource("prxlib.prx.prim.pxs"), 40 39 Source.FromEmbeddedPrexoniteResource("prxlib.prx.core.pxs"), 41 40 Source.FromEmbeddedPrexoniteResource("prxlib.sys.pxs"), 42 41 Source.FromEmbeddedPrexoniteResource("prxlib.prx.v1.pxs"), 43 42 Source.FromEmbeddedPrexoniteResource("prxlib.prx.v1.prelude.pxs"), 44 43 Source.FromEmbeddedPrexoniteResource("prxlib.prx.v2.prelude.pxs"), 45 - }; 44 + ]; 46 45 47 46 public static IPlan CreateDefault() 48 47 {
+3 -3
Prexonite/Compiler/Build/ProvidedTarget.cs
··· 62 62 if (symbols != null) 63 63 foreach (var entry in symbols) 64 64 Symbols.Declare(entry.Key, entry.Value); 65 - this.resources = new(); 65 + this.resources = []; 66 66 if (resources != null) 67 67 this.resources.AddRange(resources); 68 68 69 69 Exception = exception; 70 70 71 71 if (messages != null) 72 - this.messages = new(messages); 72 + this.messages = [..messages]; 73 73 74 74 if (buildMessages != null) 75 75 { 76 76 this.buildMessages = new List<Message>(buildMessages); 77 77 78 78 if (this.messages == null) 79 - this.messages = new(this.buildMessages); 79 + this.messages = [..this.buildMessages]; 80 80 else 81 81 this.messages.AddRange(this.buildMessages); 82 82 }
+27 -27
Prexonite/Compiler/Cil/Compiler.cs
··· 594 594 (entry = func.Meta[PFunction.SharedNamesKey]).IsList) 595 595 entries = entry.List; 596 596 else 597 - entries = Array.Empty<MetaEntry>(); 597 + entries = []; 598 598 foreach (var t in entries) 599 599 { 600 600 var symbolName = t.Text; ··· 1211 1211 var func = state.Source.ParentApplication.Functions[id!]!; 1212 1212 entries = func.Meta.TryGetValue(PFunction.SharedNamesKey, out var sharedNamesEntry) 1213 1213 ? sharedNamesEntry.List 1214 - : Array.Empty<MetaEntry>(); 1214 + : []; 1215 1215 var hasSharedVariables = entries.Length > 0; 1216 1216 if (hasSharedVariables) 1217 1217 { ··· 1620 1620 // ReSharper disable InconsistentNaming 1621 1621 1622 1622 public static readonly MethodInfo CreateNativePValue = 1623 - typeof(CilFunctionContext).GetMethod(nameof(CreateNativePValue), new[] { typeof(object) }) 1623 + typeof(CilFunctionContext).GetMethod(nameof(CreateNativePValue), [typeof(object)]) 1624 1624 ?? throw new PrexoniteException("Cannot find method CilFunctionContext.CreateNativePValue(object)."); 1625 1625 1626 1626 internal static readonly MethodInfo GetNullPType = ··· 1636 1636 ?? throw new PrexoniteException("Cannot find property getter for PType.List."); 1637 1637 1638 1638 static ConstructorInfo NewPValueListCtor { get; } = 1639 - typeof(List<PValue>).GetConstructor(new[] { typeof(IEnumerable<PValue>) }) 1639 + typeof(List<PValue>).GetConstructor([typeof(IEnumerable<PValue>)]) 1640 1640 ?? throw new PrexoniteException("Cannot find constructor for List<PValue>(IEnumerable<PValue>)."); 1641 1641 1642 1642 internal static MethodInfo getPTypeNull => GetNullPType; 1643 1643 1644 1644 internal static MethodInfo nullCreatePValue { get; } = 1645 - typeof(NullPType).GetMethod(nameof(NullPType.CreatePValue), Array.Empty<Type>()) 1645 + typeof(NullPType).GetMethod(nameof(NullPType.CreatePValue), []) 1646 1646 ?? throw new PrexoniteException("Cannot find method NullPType.CreatePValue()."); 1647 1647 1648 1648 public static ConstructorInfo NewPVariableCtor { get; } = 1649 - typeof(PVariable).GetConstructor(Array.Empty<Type>()) 1649 + typeof(PVariable).GetConstructor([]) 1650 1650 ?? throw new PrexoniteException("Cannot find constructor for PVariable()."); 1651 1651 1652 1652 public static MethodInfo GetValueMethod { get; } = ··· 1683 1683 1684 1684 public static MethodInfo CreatePValueAsObject { get; } = typeof( 1685 1685 PType.PrexoniteObjectTypeProxy).GetMethod 1686 - ("CreatePValue", new[] { typeof(object) }) 1686 + ("CreatePValue", [typeof(object)]) 1687 1687 ?? throw new PrexoniteException("Cannot find method PType.PrexoniteObjectTypeProxy.CreatePValue(object)."); 1688 1688 1689 1689 1690 1690 public static ConstructorInfo NewPValueKeyValuePair { get; } = 1691 - typeof(PValueKeyValuePair).GetConstructor(new[] { typeof(PValue), typeof(PValue) }) 1691 + typeof(PValueKeyValuePair).GetConstructor([typeof(PValue), typeof(PValue)]) 1692 1692 ?? throw new PrexoniteException("Cannot find constructor for PValueKeyValuePair(PValue, PValue)."); 1693 1693 1694 1694 internal static ConstructorInfo NewPValue { get; } = 1695 - typeof(PValue).GetConstructor(new[] { typeof(object), typeof(PType) }) 1695 + typeof(PValue).GetConstructor([typeof(object), typeof(PType)]) 1696 1696 ?? throw new PrexoniteException("Cannot find constructor for PValue(object, PType)."); 1697 1697 1698 1698 public static MethodInfo PVIncrementMethod { get; } = 1699 - typeof(PValue).GetMethod("Increment", new[] { typeof(StackContext) }) 1699 + typeof(PValue).GetMethod("Increment", [typeof(StackContext)]) 1700 1700 ?? throw new PrexoniteException("Cannot find method PValue.Increment(StackContext)."); 1701 1701 1702 1702 public static MethodInfo PVDecrementMethod { get; } = 1703 - typeof(PValue).GetMethod("Decrement", new[] { typeof(StackContext) }) 1703 + typeof(PValue).GetMethod("Decrement", [typeof(StackContext)]) 1704 1704 ?? throw new PrexoniteException("Cannot find method PValue.Decrement(StackContext)."); 1705 1705 1706 1706 public static MethodInfo PVUnaryNegationMethod { get; } = 1707 - typeof(PValue).GetMethod("UnaryNegation", new[] { typeof(StackContext) }) 1707 + typeof(PValue).GetMethod("UnaryNegation", [typeof(StackContext)]) 1708 1708 ?? throw new PrexoniteException("Cannot find method PValue.UnaryNegation(StackContext)."); 1709 1709 1710 1710 public static MethodInfo PVLogicalNotMethod { get; } = 1711 - typeof(PValue).GetMethod("LogicalNot", new[] { typeof(StackContext) }) 1711 + typeof(PValue).GetMethod("LogicalNot", [typeof(StackContext)]) 1712 1712 ?? throw new PrexoniteException("Cannot find method PValue.LogicalNot(StackContext)."); 1713 1713 1714 1714 public static MethodInfo PVAdditionMethod { get; } = 1715 - typeof(PValue).GetMethod("Addition", new[] { typeof(StackContext), typeof(PValue) }) 1715 + typeof(PValue).GetMethod("Addition", [typeof(StackContext), typeof(PValue)]) 1716 1716 ?? throw new PrexoniteException("Cannot find method PValue.Addition(StackContext, PValue)."); 1717 1717 1718 1718 public static MethodInfo PVSubtractionMethod { get; } = 1719 - typeof(PValue).GetMethod("Subtraction", new[] { typeof(StackContext), typeof(PValue) }) 1719 + typeof(PValue).GetMethod("Subtraction", [typeof(StackContext), typeof(PValue)]) 1720 1720 ?? throw new PrexoniteException("Cannot find method PValue.Subtraction(StackContext, PValue)."); 1721 1721 1722 1722 public static MethodInfo PVMultiplyMethod { get; } = 1723 - typeof(PValue).GetMethod("Multiply", new[] { typeof(StackContext), typeof(PValue) }) 1723 + typeof(PValue).GetMethod("Multiply", [typeof(StackContext), typeof(PValue)]) 1724 1724 ?? throw new PrexoniteException("Cannot find method PValue.Multiply(StackContext, PValue)."); 1725 1725 1726 1726 public static MethodInfo PVDivisionMethod { get; } = 1727 - typeof(PValue).GetMethod("Division", new[] { typeof(StackContext), typeof(PValue) }) 1727 + typeof(PValue).GetMethod("Division", [typeof(StackContext), typeof(PValue)]) 1728 1728 ?? throw new PrexoniteException("Cannot find method PValue.Division(StackContext, PValue)."); 1729 1729 1730 1730 public static MethodInfo PVModulusMethod { get; } = 1731 - typeof(PValue).GetMethod("Modulus", new[] { typeof(StackContext), typeof(PValue) }) 1731 + typeof(PValue).GetMethod("Modulus", [typeof(StackContext), typeof(PValue)]) 1732 1732 ?? throw new PrexoniteException("Cannot find method PValue.Modulus(StackContext, PValue)."); 1733 1733 1734 1734 public static MethodInfo PVBitwiseAndMethod { get; } = 1735 - typeof(PValue).GetMethod("BitwiseAnd", new[] { typeof(StackContext), typeof(PValue) }) 1735 + typeof(PValue).GetMethod("BitwiseAnd", [typeof(StackContext), typeof(PValue)]) 1736 1736 ?? throw new PrexoniteException("Cannot find method PValue.BitwiseAnd(StackContext, PValue)."); 1737 1737 1738 1738 public static MethodInfo PVBitwiseOrMethod { get; } = 1739 - typeof(PValue).GetMethod("BitwiseOr", new[] { typeof(StackContext), typeof(PValue) }) 1739 + typeof(PValue).GetMethod("BitwiseOr", [typeof(StackContext), typeof(PValue)]) 1740 1740 ?? throw new PrexoniteException("Cannot find method PValue.BitwiseOr(StackContext, PValue)."); 1741 1741 1742 1742 public static MethodInfo PVExclusiveOrMethod { get; } = 1743 - typeof(PValue).GetMethod("ExclusiveOr", new[] { typeof(StackContext), typeof(PValue) }) 1743 + typeof(PValue).GetMethod("ExclusiveOr", [typeof(StackContext), typeof(PValue)]) 1744 1744 ?? throw new PrexoniteException("Cannot find method PValue.ExclusiveOr(StackContext, PValue)."); 1745 1745 1746 1746 public static MethodInfo PVEqualityMethod { get; } = 1747 - typeof(PValue).GetMethod("Equality", new[] { typeof(StackContext), typeof(PValue) }) 1747 + typeof(PValue).GetMethod("Equality", [typeof(StackContext), typeof(PValue)]) 1748 1748 ?? throw new PrexoniteException("Cannot find method PValue.Equality(StackContext, PValue)."); 1749 1749 1750 1750 public static MethodInfo PVInequalityMethod { get; } = 1751 - typeof(PValue).GetMethod("Inequality", new[] { typeof(StackContext), typeof(PValue) }) 1751 + typeof(PValue).GetMethod("Inequality", [typeof(StackContext), typeof(PValue)]) 1752 1752 ?? throw new PrexoniteException("Cannot find method PValue.Inequality(StackContext, PValue)."); 1753 1753 1754 1754 public static MethodInfo PVGreaterThanMethod { get; } = 1755 - typeof(PValue).GetMethod("GreaterThan", new[] { typeof(StackContext), typeof(PValue) }) 1755 + typeof(PValue).GetMethod("GreaterThan", [typeof(StackContext), typeof(PValue)]) 1756 1756 ?? throw new PrexoniteException("Cannot find method PValue.GreaterThan(StackContext, PValue)."); 1757 1757 1758 1758 public static MethodInfo PVLessThanMethod { get; } = 1759 - typeof(PValue).GetMethod("LessThan", new[] { typeof(StackContext), typeof(PValue) }) 1759 + typeof(PValue).GetMethod("LessThan", [typeof(StackContext), typeof(PValue)]) 1760 1760 ?? throw new PrexoniteException("Cannot find method PValue.LessThan(StackContext, PValue)."); 1761 1761 1762 1762 public static MethodInfo PVGreaterThanOrEqualMethod { get; } = 1763 - typeof(PValue).GetMethod("GreaterThanOrEqual", new[] { typeof(StackContext), typeof(PValue) }) 1763 + typeof(PValue).GetMethod("GreaterThanOrEqual", [typeof(StackContext), typeof(PValue)]) 1764 1764 ?? throw new PrexoniteException("Cannot find method PValue.GreaterThanOrEqual(StackContext, PValue)."); 1765 1765 1766 1766 public static MethodInfo PVLessThanOrEqualMethod { get; } = 1767 - typeof(PValue).GetMethod("LessThanOrEqual", new[] { typeof(StackContext), typeof(PValue) }) 1767 + typeof(PValue).GetMethod("LessThanOrEqual", [typeof(StackContext), typeof(PValue)]) 1768 1768 ?? throw new PrexoniteException("Cannot find method PValue.LessThanOrEqual(StackContext, PValue)."); 1769 1769 1770 1770 public static MethodInfo PVIsNullMethod { get; } =
+7 -7
Prexonite/Compiler/Cil/CompilerState.cs
··· 69 69 Symbols = new(); 70 70 TryBlocks = new(); 71 71 72 - _ForeachHints = new(); 72 + _ForeachHints = []; 73 73 _CilExtensionOffsets = new(); 74 74 if (source.Meta.TryGetValue(Loader.CilHintsKey, out var cilHints)) 75 75 { ··· 660 660 } 661 661 662 662 static readonly MethodInfo _pTypeConstructMethod = 663 - typeof (PType).GetMethod(nameof(PType.Construct), new[] {typeof (StackContext), typeof (PValue[])}) ?? throw new InvalidOperationException("Method PType.Construct(StackContext, PValue[]) is missing."); 663 + typeof (PType).GetMethod(nameof(PType.Construct), [typeof (StackContext), typeof (PValue[])]) ?? throw new InvalidOperationException("Method PType.Construct(StackContext, PValue[]) is missing."); 664 664 665 665 public void EmitLoadClrType(Type T) 666 666 { ··· 669 669 } 670 670 671 671 static readonly MethodInfo _typeGetTypeFromHandle = 672 - typeof (Type).GetMethod(nameof(Type.GetTypeFromHandle), new[] {typeof (RuntimeTypeHandle)}) ?? throw new InvalidOperationException("Method Type.GetTypeFromHandle(RuntimeTypeHandle) is missing."); 672 + typeof (Type).GetMethod(nameof(Type.GetTypeFromHandle), [typeof (RuntimeTypeHandle)]) ?? throw new InvalidOperationException("Method Type.GetTypeFromHandle(RuntimeTypeHandle) is missing."); 673 673 674 674 #region Early bound command call 675 675 ··· 702 702 public void EmitEarlyBoundCommandCall(Type target, int argc, bool justEffect) 703 703 { 704 704 var run = 705 - target.GetMethod("RunStatically", new[] {typeof (StackContext), typeof (PValue[])}); 705 + target.GetMethod("RunStatically", [typeof (StackContext), typeof (PValue[])]); 706 706 707 707 if (run == null) 708 708 throw new PrexoniteException ··· 1003 1003 { 1004 1004 var cs = new ConstructorInfo[3]; 1005 1005 cs[0] = 1006 - typeof (Version).GetConstructor(new[] {typeof (int), typeof (int)}) 1006 + typeof (Version).GetConstructor([typeof (int), typeof (int)]) 1007 1007 ?? throw new InvalidOperationException("Version(int,int) constructor is missing."); 1008 1008 cs[1] = 1009 - typeof (Version).GetConstructor(new[] {typeof (int), typeof (int), typeof (int)}) 1009 + typeof (Version).GetConstructor([typeof (int), typeof (int), typeof (int)]) 1010 1010 ?? throw new InvalidOperationException("Version(int,int,int) constructor is missing."); 1011 1011 cs[2] = 1012 - typeof (Version).GetConstructor(new[] {typeof (int), typeof (int), typeof (int), typeof (int)}) 1012 + typeof (Version).GetConstructor([typeof (int), typeof (int), typeof (int), typeof (int)]) 1013 1013 ?? throw new InvalidOperationException("Version(int,int,int,int) constructor is missing."); 1014 1014 return cs; 1015 1015 },LazyThreadSafetyMode.None);
+13 -14
Prexonite/Compiler/Cil/Runtime.cs
··· 12 12 typeof (Runtime).GetMethod(nameof(CallFunction))!; 13 13 14 14 public static readonly MethodInfo CheckTypeConstMethod = 15 - typeof (Runtime).GetMethod(nameof(CheckTypeConst), new[] {typeof (PValue), typeof (PType)})!; 15 + typeof (Runtime).GetMethod(nameof(CheckTypeConst), [typeof (PValue), typeof (PType)])!; 16 16 17 17 public static readonly MethodInfo ConstructPTypeMethod = 18 - typeof (StackContext).GetMethod(nameof(StackContext.ConstructPType), new[] {typeof (string)})!; 18 + typeof (StackContext).GetMethod(nameof(StackContext.ConstructPType), [typeof (string)])!; 19 19 20 20 public static readonly MethodInfo DisposeIfPossibleMethod = 21 - typeof (Runtime).GetMethod(nameof(DisposeIfPossible), new[] {typeof (object)})!; 21 + typeof (Runtime).GetMethod(nameof(DisposeIfPossible), [typeof (object)])!; 22 22 23 - public static readonly PValue[] EmptyPValueArray = Array.Empty<PValue>(); 23 + public static readonly PValue[] EmptyPValueArray = []; 24 24 25 25 public static readonly FieldInfo EmptyPValueArrayField = 26 26 typeof (Runtime).GetField(nameof(EmptyPValueArray))!; 27 27 28 28 public static readonly MethodInfo ExtractEnumeratorMethod = 29 29 typeof (Runtime).GetMethod(nameof(ExtractEnumerator), 30 - new[] {typeof (PValue), typeof (StackContext)})!; 30 + [typeof (PValue), typeof (StackContext)])!; 31 31 32 32 public static readonly MethodInfo LoadGlobalVariableReferenceMethod = 33 33 typeof (Runtime).GetMethod(nameof(LoadGlobalVariableReference))!; ··· 41 41 42 42 public static readonly MethodInfo CastConstMethod = 43 43 typeof (Runtime).GetMethod(nameof(CastConst), 44 - new[] {typeof (PValue), typeof (PType), typeof (StackContext)})!; 44 + [typeof (PValue), typeof (PType), typeof (StackContext)])!; 45 45 46 46 public static MethodInfo LoadGlobalVariableReferenceAsPValueMethod { get; } = 47 47 typeof(Runtime).GetMethod(nameof(LoadGlobalVariableReferenceAsPValue))!; ··· 60 60 public static MethodInfo NewTypeMethod { get; } = typeof (Runtime).GetMethod(nameof(NewType))!; 61 61 62 62 public static MethodInfo NewClosureMethodLateBound { get; } = typeof(Runtime).GetMethod(nameof(NewClosureInternal), 63 - new[] { typeof(StackContext), typeof(PVariable[]), typeof(string) })!; 63 + [typeof(StackContext), typeof(PVariable[]), typeof(string)])!; 64 64 65 65 public static MethodInfo NewClosureMethodStaticallyBound { get; } = typeof(Runtime).GetMethod(nameof(NewClosure), 66 - new[] {typeof (StackContext), typeof (PVariable[]), typeof (PFunction)})!; 66 + [typeof (StackContext), typeof (PVariable[]), typeof (PFunction)])!; 67 67 68 68 public static MethodInfo RaiseToPowerMethod { get; } = typeof (Runtime).GetMethod(nameof(RaiseToPower))!; 69 69 ··· 72 72 public static MethodInfo CastMethod { get; } = typeof (Runtime).GetMethod(nameof(Cast))!; 73 73 74 74 public static MethodInfo StaticCallMethod { get; } = typeof(PType).GetMethod(nameof(PType.StaticCall), 75 - new[] {typeof (StackContext), typeof (PValue[]), typeof (PCall), typeof (string)})!; 75 + [typeof (StackContext), typeof (PValue[]), typeof (PCall), typeof (string)])!; 76 76 77 77 public static MethodInfo CallInternalFunctionMethod { get; } = typeof (Runtime).GetMethod(nameof(CallInternalFunction))!; 78 78 ··· 93 93 public static MethodInfo LoadGlobalReferenceAsPValueInternalMethod { get; } = typeof(Runtime).GetMethod(nameof(LoadGlobalVariableReferenceAsPValueInternal))!; 94 94 95 95 public static MethodInfo NewClosureMethodCrossModule { get; } = typeof (Runtime).GetMethod(nameof(NewClosure), 96 - new[] 97 - { 98 - typeof (StackContext), typeof (PVariable[]), typeof (string), 96 + [ 97 + typeof (StackContext), typeof (PVariable[]), typeof (string), 99 98 typeof (ModuleName), 100 - })!; 99 + ])!; 101 100 102 101 public static MethodInfo LoadFunctionReferenceMethod { get; } = typeof (Runtime).GetMethod(nameof(LoadFunctionReference))!; 103 102 ··· 225 224 public static PValue NewClosure(StackContext sctx, PVariable[]? sharedVariables, 226 225 PFunction function) 227 226 { 228 - PVariable[] emptyPVariableArray = Array.Empty<PVariable>(); 227 + PVariable[] emptyPVariableArray = []; 229 228 if (function.HasCilImplementation) 230 229 { 231 230 return
+6 -6
Prexonite/Compiler/Internal/EntityRefMExprSerializer.cs
··· 53 53 string id, ModuleName moduleName) 54 54 { 55 55 return new MExpr.MList(position, head, 56 - new[] 57 - { 58 - new MExpr.MAtom(position, id), 56 + [ 57 + new MExpr.MAtom(position, id), 59 58 new MExpr.MAtom(position, moduleName.Id), 60 59 new MExpr.MAtom(position, moduleName.Version), 61 - }); 60 + ]); 62 61 } 63 62 64 63 MExpr _serializeRef(ISourcePosition position, string head, string id) 65 64 { 66 - return new MExpr.MList(position, head,new []{new MExpr.MAtom(position,id) }); 65 + return new MExpr.MList(position, head, [new MExpr.MAtom(position,id)]); 67 66 } 68 67 69 68 public override MExpr OnFunction(EntityRef.Function function, ISourcePosition position) ··· 83 82 84 83 protected override MExpr OnLocalVariable(EntityRef.Variable.Local variable, ISourcePosition position) 85 84 { 86 - return new MExpr.MList(position,LocalVariableHead,new []{new MExpr.MAtom(position, variable.Id), new MExpr.MAtom(position,variable.Index)}); 85 + return new MExpr.MList(position,LocalVariableHead, [new MExpr.MAtom(position, variable.Id), new MExpr.MAtom(position,variable.Index), 86 + ]); 87 87 } 88 88 89 89 protected override MExpr OnGlobalVariable(EntityRef.Variable.Global variable, ISourcePosition position)
+3 -3
Prexonite/Compiler/Internal/MExpr.cs
··· 282 282 { 283 283 if (arg == null) throw new ArgumentNullException(nameof(arg)); 284 284 _head = head ?? throw new ArgumentNullException(nameof(head)); 285 - _args = new(1) {arg}; 285 + _args = [arg]; 286 286 } 287 287 288 288 public MList(ISourcePosition position, string head) 289 289 : base(position) 290 290 { 291 291 _head = head ?? throw new ArgumentNullException(nameof(head)); 292 - _args = new(); 292 + _args = []; 293 293 } 294 294 295 295 public MList(ISourcePosition position, string head, object arg) : base(position) 296 296 { 297 297 if (arg == null) throw new ArgumentNullException(nameof(arg)); 298 298 _head = head ?? throw new ArgumentNullException(nameof(head)); 299 - _args = new(1) { new MAtom(position, arg) }; 299 + _args = [new MAtom(position, arg)]; 300 300 } 301 301 302 302 public override void ToString(TextWriter builder)
+6 -7
Prexonite/Compiler/Internal/SymbolMExprSerializer.cs
··· 46 46 47 47 public static MExpr SerializePosition(ISourcePosition exprPosition, ISourcePosition sourcePosition) 48 48 { 49 - return new MExpr.MList(exprPosition, SourcePositionHead, new MExpr[] 50 - { 49 + return new MExpr.MList(exprPosition, SourcePositionHead, 50 + [ 51 51 new MExpr.MAtom(exprPosition, sourcePosition.File), 52 52 new MExpr.MAtom(exprPosition, sourcePosition.Line), 53 53 new MExpr.MAtom(exprPosition, sourcePosition.Column), 54 - }); 54 + ]); 55 55 } 56 56 57 57 MExpr? _lookForExistingSymbol(ISourcePosition position, IDictionary<Symbol, QualifiedId> existingSymbols, Symbol symbol) ··· 108 108 }; 109 109 110 110 return new MExpr.MList(self.Position, head, 111 - new[] 112 - { 113 - SerializePosition(self.Position, self.Message.Position), 111 + [ 112 + SerializePosition(self.Position, self.Message.Position), 114 113 new MExpr.MAtom(self.Position, self.Message.MessageClass), 115 114 new MExpr.MAtom(self.Position, self.Message.Text), 116 115 self.InnerSymbol.HandleWith(this,existingSymbols), 117 - }); 116 + ]); 118 117 } 119 118 120 119 }
+18 -13
Prexonite/Compiler/Lexer.cs
··· 106 106 /** 107 107 * Translates characters to character classes 108 108 */ 109 - private static readonly ushort[] ZZ_CMAP_PACKED = new ushort[] { 109 + private static readonly ushort[] ZZ_CMAP_PACKED = [ 110 110 9, 9, 1, 12, 1, 10, 3, 10, 14, 9, 4, 0, 1, 12, 1, 20, 1, 13, 1, 19, 111 111 1, 14, 1, 0, 1, 41, 1, 3, 1, 24, 1, 25, 1, 16, 1, 5, 1, 50, 1, 6, 112 112 1, 27, 1, 15, 1, 28, 9, 1, 1, 36, 1, 49, 1, 44, 1, 26, 1, 43, 1, 48, ··· 186 186 24, 0, 3, 7, 25, 0, 1, 7, 6, 0, 3, 7, 1, 0, 1, 7, 1, 0, 135, 7, 187 187 2, 0, 1, 9, 4, 0, 1, 7, 11, 0, 10, 9, 7, 0, 26, 7, 4, 0, 1, 7, 188 188 1, 0, 26, 7, 11, 0, 89, 7, 3, 0, 6, 7, 2, 0, 6, 7, 2, 0, 6, 7, 189 - 2, 0, 3, 7, 3, 0, 2, 7, 3, 0, 2, 7, 25, 0, 0 }; 189 + 2, 0, 3, 7, 3, 0, 2, 7, 3, 0, 2, 7, 25, 0, 0, 190 + ]; 190 191 191 192 /** 192 193 * Translates characters to character classes ··· 198 199 */ 199 200 private static readonly int [] ZZ_ACTION; 200 201 201 - private static readonly ushort[] ZZ_ACTION_PACKED_0 = new ushort[] { 202 + private static readonly ushort[] ZZ_ACTION_PACKED_0 = [ 202 203 10, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 203 204 1, 3, 1, 8, 1, 9, 1, 3, 1, 1, 1, 10, 1, 3, 1, 11, 204 205 1, 12, 1, 13, 1, 14, 1, 15, 1, 2, 3, 3, 1, 16, 1, 17, ··· 223 224 1, 122, 1, 123, 1, 0, 1, 3, 1, 109, 1, 0, 1, 110, 1, 0, 224 225 1, 124, 1, 0, 1, 125, 1, 126, 1, 127, 1, 128, 1, 129, 1, 130, 225 226 1, 131, 1, 132, 1, 109, 1, 0, 1, 110, 2, 0, 2, 109, 2, 110, 226 - 1, 125, 6, 0, 0 }; 227 + 1, 125, 6, 0, 0, 228 + ]; 227 229 228 230 private static int [] zzUnpackAction() { 229 231 int [] result = new int[243]; ··· 250 252 */ 251 253 private static readonly int [] ZZ_ROWMAP; 252 254 253 - private static readonly ushort[] ZZ_ROWMAP_PACKED_0 = new ushort[] { 255 + private static readonly ushort[] ZZ_ROWMAP_PACKED_0 = [ 254 256 0, 0, 0, 53, 0, 106, 0, 159, 0, 212, 0, 0x0109, 0, 0x013e, 0, 0x0173, 255 257 0, 0x01a8, 0, 0x01dd, 0, 0x0212, 0, 0x0247, 0, 0x027c, 0, 0x02b1, 0, 0x02e6, 0, 0x031b, 256 258 0, 0x0212, 0, 0x0350, 0, 0x0385, 0, 0x0212, 0, 0x03ba, 0, 0x03ef, 0, 0x0424, 0, 0x0459, ··· 281 283 0, 0x1839, 0, 0x186e, 0, 0x18a3, 0, 0x18d8, 0, 0x0212, 0, 0x0212, 0, 0x0212, 0, 0x0212, 282 284 0, 0x0212, 0, 0x0212, 0, 0x027c, 0, 0x190d, 0, 0x1942, 0, 0x1977, 0, 0x19ac, 0, 0x19e1, 283 285 0, 0x0212, 0, 0x1a16, 0, 0x0212, 0, 0x1a4b, 0, 0x1a80, 0, 0x1ab5, 0, 0x1aea, 0, 0x1b1f, 284 - 0, 0x1b54, 0, 0x190d, 0, 0x1977, 0 }; 286 + 0, 0x1b54, 0, 0x190d, 0, 0x1977, 0, 287 + ]; 285 288 286 289 private static int [] zzUnpackRowMap() { 287 290 int [] result = new int[243]; ··· 306 309 */ 307 310 private static readonly int [] ZZ_TRANS; 308 311 309 - private static readonly ushort[] ZZ_TRANS_PACKED_0 = new ushort[] { 312 + private static readonly ushort[] ZZ_TRANS_PACKED_0 = [ 310 313 1, 11, 1, 12, 1, 13, 1, 11, 1, 13, 1, 14, 1, 15, 2, 13, 311 314 1, 11, 3, 16, 1, 17, 1, 18, 1, 19, 1, 20, 1, 21, 1, 13, 312 315 1, 22, 1, 23, 1, 24, 1, 13, 1, 25, 1, 26, 1, 27, 1, 28, ··· 478 481 6, 0, 1, 241, 3, 0, 2, 241, 17, 0, 1, 241, 2, 0, 2, 242, 479 482 1, 0, 1, 242, 16, 0, 1, 242, 6, 0, 1, 242, 3, 0, 2, 242, 480 483 17, 0, 1, 242, 2, 0, 2, 243, 1, 0, 1, 243, 16, 0, 1, 243, 481 - 6, 0, 1, 243, 3, 0, 2, 243, 17, 0, 1, 243, 1, 0, 0 }; 484 + 6, 0, 1, 243, 3, 0, 2, 243, 17, 0, 1, 243, 1, 0, 0, 485 + ]; 482 486 483 487 private static int [] zzUnpackTrans() { 484 488 int [] result = new int[7049]; ··· 507 511 private const int ZZ_PUSHBACK_2BIG = 2; 508 512 509 513 /* error messages for the codes above */ 510 - private static readonly String[] ZZ_ERROR_MSG = new string[] { 514 + private static readonly String[] ZZ_ERROR_MSG = [ 511 515 "Unkown internal scanner error", 512 516 "Error: could not match input", 513 - "Error: pushback value was too large" 514 - }; 517 + "Error: pushback value was too large", 518 + ]; 515 519 516 520 /** 517 521 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> 518 522 */ 519 523 private static readonly int [] ZZ_ATTRIBUTE; 520 524 521 - private static readonly ushort[] ZZ_ATTRIBUTE_PACKED_0 = new ushort[] { 525 + private static readonly ushort[] ZZ_ATTRIBUTE_PACKED_0 = [ 522 526 10, 0, 1, 9, 5, 1, 1, 9, 2, 1, 1, 9, 6, 1, 1, 9, 523 527 1, 1, 1, 9, 5, 1, 3, 9, 4, 1, 3, 9, 1, 1, 2, 9, 524 528 2, 1, 3, 9, 2, 1, 2, 9, 1, 1, 1, 9, 1, 1, 2, 9, ··· 531 535 2, 0, 5, 1, 1, 0, 1, 1, 1, 0, 4, 9, 2, 0, 2, 9, 532 536 2, 1, 5, 9, 4, 0, 1, 9, 1, 0, 3, 9, 1, 0, 2, 1, 533 537 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 6, 9, 2, 1, 534 - 1, 0, 1, 1, 2, 0, 1, 9, 1, 1, 1, 9, 2, 1, 6, 0, 0 }; 538 + 1, 0, 1, 1, 2, 0, 1, 9, 1, 1, 1, 9, 2, 1, 6, 0, 0, 539 + ]; 535 540 536 541 private static int [] zzUnpackAttribute() { 537 542 int [] result = new int[243];
+4 -4
Prexonite/Compiler/Macro/Commands/CallMacro.cs
··· 345 345 if (getArgs.Any(a => !_ensureExplicitPlaceholder(context, a))) 346 346 347 347 { 348 - args = Array.Empty<AstExpr>(); 348 + args = []; 349 349 return false; 350 350 } 351 351 ··· 360 360 // ReSharper restore PossibleMultipleEnumeration 361 361 else 362 362 { 363 - getArgsLit = Enumerable.Empty<AstExpr>(); 363 + getArgsLit = []; 364 364 } 365 365 366 366 IEnumerable<AstExpr> setArgsLit; ··· 368 368 { 369 369 if (!_ensureExplicitPlaceholder(context, setArgs)) 370 370 { 371 - args = Array.Empty<AstExpr>(); 371 + args = []; 372 372 return false; 373 373 } 374 374 var lit = new AstListLiteral(setArgs.File, setArgs.Line, setArgs.Column); ··· 377 377 } 378 378 else 379 379 { 380 - setArgsLit = Enumerable.Empty<AstExpr>(); 380 + setArgsLit = []; 381 381 } 382 382 383 383 args = getArgsLit
+6 -6
Prexonite/Compiler/Macro/MacroSession.cs
··· 42 42 { 43 43 LoaderOptions? _options; 44 44 45 - readonly SymbolCollection _releaseList = new(); 46 - readonly SymbolCollection _allocationList = new(); 45 + readonly SymbolCollection _releaseList = []; 46 + readonly SymbolCollection _allocationList = []; 47 47 48 - readonly HashSet<AstGetSet> _invocations = new(); 48 + readonly HashSet<AstGetSet> _invocations = []; 49 49 50 50 readonly object _buildCommandToken; 51 51 52 - readonly List<PValue> _transportStore = new(); 52 + readonly List<PValue> _transportStore = []; 53 53 54 54 /// <summary> 55 55 /// Creates a new macro expansion session for the specified compiler target. ··· 61 61 Factory = Target.Factory; 62 62 63 63 GlobalSymbols = SymbolStore.Create(Target.Loader.Symbols); 64 - OuterVariables = Target.OuterVariables.ToImmutableArray(); 64 + OuterVariables = [..Target.OuterVariables]; 65 65 66 66 _buildCommandToken = target.Loader.RequestBuildCommands(); 67 67 } ··· 289 289 if (macroBlock != null) 290 290 fs = macroBlock.Count > 0 ? macroBlock.Statements : null; 291 291 else if (ast != null) 292 - fs = new[] {ast}; 292 + fs = [ast]; 293 293 else 294 294 fs = null; 295 295
+3 -3
Prexonite/Compiler/Parser.Code.cs
··· 514 514 buildBlockTarget.FinishTarget(); 515 515 //Run the build block 516 516 var fctx = buildBlockTarget.Function.CreateFunctionContext(ParentEngine, 517 - Array.Empty<PValue>(), 518 - Array.Empty<PVariable>(), true); 517 + [], 518 + [], true); 519 519 object? token = null; 520 520 try 521 521 { ··· 958 958 { 959 959 f.Meta[PFunction.LetKey] = (MetaEntry) 960 960 f.Meta[PFunction.LetKey].List 961 - .Union(new[] { (MetaEntry)local }) 961 + .Union([(MetaEntry)local]) 962 962 .ToArray(); 963 963 } 964 964
+1 -3
Prexonite/Continuation.cs
··· 61 61 var metaTable = fctx.Implementation.Meta; 62 62 if (!(metaTable.TryGetValue(PFunction.SharedNamesKey, out var entry) && entry.IsList)) 63 63 { 64 - return Array.Empty<PVariable>(); 64 + return []; 65 65 } 66 66 var sharedNames = entry.List; 67 67 var sharedVariables = new PVariable[sharedNames.Length]; ··· 77 77 { 78 78 if (sctx == null) 79 79 throw new ArgumentNullException(nameof(sctx)); 80 - if (args == null) 81 - throw new ArgumentNullException(nameof(args)); 82 80 83 81 var fctx = CreateFunctionContext(sctx, args.ToArray()); 84 82
+1 -1
Prexonite/Coroutine.cs
··· 226 226 /// <returns>Do not use with infinite lists!</returns> 227 227 public List<PValue> All() 228 228 { 229 - return new(this); 229 + return [..this]; 230 230 } 231 231 }
+2 -2
Prexonite/Engine.cs
··· 405 405 return PType.Structure; 406 406 407 407 var result = 408 - ptypeClrType.Construct(sctx, new[] {PType.Object.CreatePValue(args)}); 408 + ptypeClrType.Construct(sctx, [PType.Object.CreatePValue(args)]); 409 409 if (result == null || result.IsNull) 410 410 throw new PrexoniteException( 411 411 "Could not construct PType (resulted in null reference)"); ··· 535 535 /// <summary> 536 536 /// Provides access to the search paths used by this particular engine. 537 537 /// </summary> 538 - public List<string> Paths { get; } = new(); 538 + public List<string> Paths { get; } = []; 539 539 540 540 #endregion 541 541
+3 -3
Prexonite/FunctionContext.cs
··· 63 63 throw new ArgumentNullException(nameof(parentEngine)); 64 64 if (implementation == null) 65 65 throw new ArgumentNullException(nameof(implementation)); 66 - sharedVariables ??= Array.Empty<PVariable>(); 67 - args ??= Array.Empty<PValue>(); 66 + sharedVariables ??= []; 67 + args ??= []; 68 68 69 69 if ( 70 70 !(suppressInitialization || implementation.ParentApplication._SuppressInitialization)) ··· 550 550 { 551 551 var entries = func.Meta.TryGetValue(PFunction.SharedNamesKey, out var sharedNamesEntry) 552 552 ? sharedNamesEntry.List 553 - : Array.Empty<MetaEntry>(); 553 + : []; 554 554 vars = new string[entries.Length]; 555 555 for (var i = 0; i < entries.Length; i++) 556 556 vars[i] = entries[i].Text;
+6 -6
Prexonite/Helper/MetaEntry.cs
··· 36 36 /// </summary> 37 37 readonly string? _text; 38 38 39 - static readonly MetaEntry[] EmptyList = Array.Empty<MetaEntry>(); 39 + static readonly MetaEntry[] EmptyList = []; 40 40 41 41 #endregion 42 42 ··· 80 80 return EntryType switch 81 81 { 82 82 Type.List => _list ?? EmptyList, 83 - Type.Switch => new MetaEntry[] {_switch}, 84 - Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : new MetaEntry[] {_text ?? ""}, 83 + Type.Switch => [_switch], 84 + Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : [_text ?? ""], 85 85 _ => throw new PrexoniteException("Unknown type in meta entry"), 86 86 }; 87 87 } ··· 225 225 } 226 226 else 227 227 { 228 - lst = new(0); 228 + lst = []; 229 229 } 230 230 return PType.List.CreatePValue(lst); 231 231 default: ··· 318 318 //Change type to list 319 319 return EntryType switch 320 320 { 321 - Type.Switch => new MetaEntry[] {_switch}, 322 - Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : new MetaEntry[] {_text}, 321 + Type.Switch => [_switch], 322 + Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : [_text], 323 323 Type.List => _list ?? EmptyList, 324 324 _ => throw new PrexoniteException("Invalid meta entry."), 325 325 };
+1 -1
Prexonite/IIndirectCall.cs
··· 34 34 35 35 public static class IndirectCallExt 36 36 { 37 - public static PValue IndirectCall(this IIndirectCall t, StackContext sctx, PValue[] args) => t.IndirectCall(sctx, new ReadOnlySpan<PValue>(args)); 37 + public static PValue IndirectCall(this IIndirectCall t, StackContext sctx, PValue[] args) => t.IndirectCall(sctx); 38 38 }
+1 -1
Prexonite/Modular/ModuleName.cs
··· 235 235 236 236 public MetaEntry ToMetaEntry() 237 237 { 238 - return new(new MetaEntry[] {Id, Version.ToString()}); 238 + return new([Id, Version.ToString()]); 239 239 } 240 240 241 241 public static implicit operator MetaEntry(ModuleName name)
+3
Prexonite/PValue.cs
··· 26 26 27 27 using System.Diagnostics; 28 28 using System.Dynamic; 29 + using System.Runtime.CompilerServices; 29 30 using System.Text; 30 31 31 32 namespace Prexonite; ··· 131 132 /// <returns>The value returned by the dynamic (instance) call. In case the call does not have a return value, a PValue containing null is returned.</returns> 132 133 /// <exception cref = "InvalidCallException">Thrown if the call is not successful.</exception> 133 134 [DebuggerStepThrough] 135 + [OverloadResolutionPriority(1)] 134 136 public PValue DynamicCall(StackContext sctx, ReadOnlySpan<PValue> args, PCall call, string id) 135 137 { 136 138 return Type.DynamicCall(sctx, this, args, call, id); ··· 420 422 /// <returns>Contains the value returned by the indirect call. In case the call does not have a return value, a PValue containing null is returned.</returns> 421 423 /// <exception cref = "InvalidCallException">Thrown if the call is not successful.</exception> 422 424 [DebuggerStepThrough] 425 + [OverloadResolutionPriority(1)] 423 426 public PValue IndirectCall(StackContext sctx, params ReadOnlySpan<PValue> args) 424 427 { 425 428 return Type.IndirectCall(sctx, this, args);
+1 -1
Prexonite/Prexonite.csproj
··· 1 1 <Project Sdk="Microsoft.NET.Sdk"> 2 2 3 3 <PropertyGroup> 4 - <TargetFramework>net9.0</TargetFramework> 4 + <TargetFramework>net10.0</TargetFramework> 5 5 <LangVersion>preview</LangVersion> 6 6 <Nullable>enable</Nullable> 7 7 <ImplicitUsings>enable</ImplicitUsings>
+1 -3
Prexonite/Types/CharPType.cs
··· 76 76 77 77 if (sctx == null) 78 78 throw new ArgumentNullException(nameof(sctx)); 79 - if (args == null) 80 - throw new ArgumentNullException(nameof(args)); 81 - 79 + 82 80 if (args.Length < 1 || args[0].IsNull) 83 81 { 84 82 c = '\0';
+4 -3
Prexonite/Types/ExtendableObject.cs
··· 47 47 if (_et != null) 48 48 throw new InvalidOperationException( 49 49 "The extension table for this object has already been created."); 50 - _et = new(); 50 + _et = []; 51 51 } 52 52 53 53 /// <summary> ··· 187 187 id ??= ""; 188 188 call ??= PCall.Get; 189 189 190 - _et ??= new(); 190 + _et ??= []; 191 191 192 192 if (TryDynamicClrCall(sctx, subject, args, call.Value, id, out result) || 193 193 //Try conventional call ··· 196 196 return true; 197 197 else if (call == PCall.Set && args.Length > 0) //Add field if it does not exist 198 198 result = _dynamicCall( 199 - sctx, new[] {id, args[0]}, PCall.Set, StructurePType.SetId); 199 + sctx, 200 + [id, args[0]], PCall.Set, StructurePType.SetId); 200 201 else 201 202 result = null; //Make sure result is really null. 202 203
+2 -10
Prexonite/Types/HashPType.cs
··· 67 67 throw new ArgumentNullException(nameof(sctx)); 68 68 if (subject == null) 69 69 throw new ArgumentNullException(nameof(subject)); 70 - if(args == null) 71 - throw new ArgumentNullException(nameof(args)); 72 - 70 + 73 71 result = null; 74 72 75 73 var argc = args.Length; ··· 108 106 throw new ArgumentNullException(nameof(sctx)); 109 107 if (subject == null) 110 108 throw new ArgumentNullException(nameof(subject)); 111 - if (args == null) 112 - throw new ArgumentNullException(nameof(args)); 113 109 if (id == null) 114 110 throw new ArgumentNullException(nameof(id)); 115 111 ··· 292 288 { 293 289 if (sctx == null) 294 290 throw new ArgumentNullException(nameof(sctx)); 295 - if (args == null) 296 - throw new ArgumentNullException(nameof(args)); 297 291 if (id == null) 298 292 throw new ArgumentNullException(nameof(id)); 299 293 ··· 333 327 { 334 328 if (sctx == null) 335 329 throw new ArgumentNullException(nameof(sctx)); 336 - if(args == null) 337 - throw new ArgumentNullException(nameof(args)); 338 - 330 + 339 331 result = null; 340 332 341 333 var argc = args.Length;
+3 -3
Prexonite/Types/ListPType.cs
··· 452 452 var elementT = clrType.GetGenericArguments()[0]; 453 453 var listT = typeof (List<>).MakeGenericType(elementT); 454 454 // ReSharper disable once PossibleNullReferenceException 455 - var list = (IList) listT.GetConstructor(Array.Empty<Type>())!.Invoke(Array.Empty<object>()); 455 + var list = (IList) listT.GetConstructor([])!.Invoke([]); 456 456 var success = true; 457 457 foreach (var pv in (List<PValue>)subject.Value!) 458 458 { ··· 475 475 var readonlyListT = typeof (ReadOnlyCollection<>).MakeGenericType(elementT); 476 476 var readonlyList = 477 477 // ReSharper disable once PossibleNullReferenceException 478 - readonlyListT.GetConstructor(new[] {typeof (IList<>).MakeGenericType(elementT)})! 479 - .Invoke(new object[]{list}); 478 + readonlyListT.GetConstructor([typeof (IList<>).MakeGenericType(elementT)])! 479 + .Invoke([list]); 480 480 result = sctx.CreateNativePValue(readonlyList); 481 481 } 482 482 else
+4 -4
Prexonite/Types/ObjectPType.cs
··· 1390 1390 ( 1391 1391 sctx, new[] {operand}, PCall.Get, "op_UnaryNegation", out result) || 1392 1392 TryDynamicCall 1393 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, 1393 + (sctx, operand, [], PCall.Get, 1394 1394 OperatorNames.Prexonite.UnaryNegation, out result); 1395 1395 } 1396 1396 ··· 1406 1406 TryStaticCall( 1407 1407 sctx, new[] {operand}, PCall.Get, "op_OnesComplement", out result) || 1408 1408 TryDynamicCall 1409 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, 1409 + (sctx, operand, [], PCall.Get, 1410 1410 OperatorNames.Prexonite.OnesComplement, out result); 1411 1411 } 1412 1412 ··· 1415 1415 return 1416 1416 TryStaticCall(sctx, new[] {operand}, PCall.Get, "op_Increment", out result) || 1417 1417 TryDynamicCall 1418 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, 1418 + (sctx, operand, [], PCall.Get, 1419 1419 OperatorNames.Prexonite.Increment, out result); 1420 1420 } 1421 1421 ··· 1424 1424 return 1425 1425 TryStaticCall(sctx, new[] {operand}, PCall.Get, "op_Decrement", out result) || 1426 1426 TryDynamicCall 1427 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, 1427 + (sctx, operand, [], PCall.Get, 1428 1428 OperatorNames.Prexonite.Decrement, out result); 1429 1429 } 1430 1430
+1 -1
Prexonite/Types/PType.cs
··· 283 283 typeof (PValueKeyValuePair).GetProperty(nameof(PValueHashtable.ObjectType))!.GetGetMethod()!; 284 284 285 285 static readonly MethodInfo _getAnyObjectType = 286 - typeof (PrexoniteObjectTypeProxy).GetProperty("Item", new[] {typeof (Type)})!. 286 + typeof (PrexoniteObjectTypeProxy).GetProperty("Item", [typeof (Type)])!. 287 287 GetGetMethod()!; 288 288 289 289 public ObjectPType this[Type clrType]
-2
Prexonite/Types/PValueEnumerator.cs
··· 92 92 ) 93 93 { 94 94 result = null; 95 - if (args == null) 96 - throw new ArgumentNullException(nameof(args)); 97 95 if (args.Length != 0) 98 96 return false; 99 97
+1 -1
Prexonite/Types/StringPType.cs
··· 577 577 } 578 578 else if (arg.TryConvertTo(sctx, String, useExplicit, out v)) 579 579 { 580 - sst = new() {(string) v.Value!}; 580 + sst = [(string)v.Value!]; 581 581 } 582 582 else 583 583 {
+5 -5
Prexonite/Types/StructurePType.cs
··· 328 328 public override bool UnaryNegation(StackContext sctx, PValue operand, [NotNullWhen(true)] out PValue? result) 329 329 { 330 330 return TryDynamicCall 331 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, OperatorNames.Prexonite.UnaryNegation, 331 + (sctx, operand, [], PCall.Get, OperatorNames.Prexonite.UnaryNegation, 332 332 out result); 333 333 } 334 334 335 335 public override bool OnesComplement(StackContext sctx, PValue operand, [NotNullWhen(true)] out PValue? result) 336 336 { 337 337 return TryDynamicCall 338 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, OperatorNames.Prexonite.OnesComplement, 338 + (sctx, operand, [], PCall.Get, OperatorNames.Prexonite.OnesComplement, 339 339 out result); 340 340 } 341 341 342 342 public override bool Increment(StackContext sctx, PValue operand, [NotNullWhen(true)] out PValue? result) 343 343 { 344 344 return TryDynamicCall 345 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, OperatorNames.Prexonite.Increment, 345 + (sctx, operand, [], PCall.Get, OperatorNames.Prexonite.Increment, 346 346 out result); 347 347 } 348 348 349 349 public override bool Decrement(StackContext sctx, PValue operand, [NotNullWhen(true)] out PValue? result) 350 350 { 351 351 return TryDynamicCall 352 - (sctx, operand, Array.Empty<PValue>(), PCall.Get, OperatorNames.Prexonite.Decrement, 352 + (sctx, operand, [], PCall.Get, OperatorNames.Prexonite.Decrement, 353 353 out result); 354 354 } 355 355 ··· 384 384 case BuiltIn.String: 385 385 normalString: 386 386 if ( 387 - !TryDynamicCall(sctx, subject, Array.Empty<PValue>(), PCall.Get, nameof(ToString), 387 + !TryDynamicCall(sctx, subject, [], PCall.Get, nameof(ToString), 388 388 out result)) 389 389 result = null; 390 390 break;
+1 -1
PrexoniteTests/PrexoniteTests.csproj
··· 3 3 <PropertyGroup> 4 4 <OutputType>Exe</OutputType> 5 5 <IsTestProject>true</IsTestProject> 6 - <TargetFramework>net9.0</TargetFramework> 6 + <TargetFramework>net10.0</TargetFramework> 7 7 <LangVersion>preview</LangVersion> 8 8 <Nullable>enable</Nullable> 9 9 </PropertyGroup>
+2 -2
PrexoniteTests/Tests/ApplicationLinking.cs
··· 251 251 var cmd = CreateModuleName.Instance; 252 252 var eng = new Engine(); 253 253 var app = new Application("cmnc"); 254 - var sctx = new NullContext(eng, app, Enumerable.Empty<string>()); 255 - var rawMn = cmd.Run(sctx, new[] {sctx.CreateNativePValue(new MetaEntry(new MetaEntry[]{"sys","1.0"}))}); 254 + var sctx = new NullContext(eng, app, []); 255 + var rawMn = cmd.Run(sctx, sctx.CreateNativePValue(new MetaEntry(["sys","1.0"]))); 256 256 Assert.That(rawMn.Value,Is.InstanceOf<ModuleName>()); 257 257 var mn = (ModuleName) rawMn.Value!; 258 258 Assert.That(mn.Id,Is.EqualTo("sys"));
+1 -1
PrexoniteTests/Tests/AstTests.cs
··· 83 83 [Test] 84 84 public void DeterminePlaceholderIndicesEmptyTets() 85 85 { 86 - AstPlaceholder.DeterminePlaceholderIndices(Enumerable.Empty<AstPlaceholder>()); 86 + AstPlaceholder.DeterminePlaceholderIndices([]); 87 87 } 88 88 89 89 [Test]
+1 -1
PrexoniteTests/Tests/CilRuntime.cs
··· 55 55 if(m is PropertyInfo) 56 56 { 57 57 var p = (PropertyInfo) m; 58 - return p.GetValue(null, new object[0]); 58 + return p.GetValue(null, []); 59 59 } 60 60 else if(m is FieldInfo) 61 61 {
+4 -4
PrexoniteTests/Tests/Configurations/ScriptedUnitTestContainer.cs
··· 66 66 Engine = new(); 67 67 Loader = new(Engine, Application); 68 68 69 - Root = new NullContext(Engine, Application, Array.Empty<string>()); 69 + Root = new NullContext(Engine, Application, []); 70 70 71 71 var slnPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 72 72 while (slnPath != null && Directory.Exists(slnPath) && !File.Exists(Path.Combine(slnPath, "prx.sln"))) ··· 117 117 if (rt == null) throw new InvalidOperationException("rt is null"); 118 118 119 119 var resP = rt.Run(Engine, [PType.Null, Root.CreateNativePValue(tc)]); 120 - var success = (bool) resP.DynamicCall(Root, Array.Empty<PValue>(), PCall.Get, "Key").Value!; 120 + var success = (bool) resP.DynamicCall(Root, [], PCall.Get, "Key").Value!; 121 121 if (success) 122 122 return; 123 123 124 124 var eObj = resP 125 - .DynamicCall(Root, Array.Empty<PValue>(), PCall.Get, "Value") 126 - .DynamicCall(Root, Array.Empty<PValue>(), PCall.Get, "e") 125 + .DynamicCall(Root, [], PCall.Get, "Value") 126 + .DynamicCall(Root, [], PCall.Get, "e") 127 127 .Value; 128 128 if (eObj is Exception e) 129 129 {
+3 -1
PrexoniteTests/Tests/Configurations/V2UnitTestContainer.cs
··· 1 1 using System; 2 2 using System.Diagnostics; 3 + using System.Diagnostics.CodeAnalysis; 3 4 using System.IO; 4 5 using System.Linq; 5 6 using JetBrains.Annotations; ··· 96 97 ReadOnlySpan<PValue> args, 97 98 PCall call, 98 99 string id, 100 + [NotNullWhen(true)] 99 101 out PValue? result 100 102 ) 101 103 { ··· 143 145 } 144 146 } 145 147 146 - static readonly PValue[] Empty = Array.Empty<PValue>(); 148 + static readonly PValue[] Empty = []; 147 149 148 150 static (string Id, Application ParentApplication) extract(StackContext sctx, PValue funcValue) 149 151 {
+3 -2
PrexoniteTests/Tests/MExprTests.cs
··· 141 141 public void DirectAlias() 142 142 { 143 143 const string alias = "x"; 144 - var me = new MExpr.MList(_position,SymbolMExprSerializer.CrossReferenceHead, new[] {new MExpr.MAtom(_position, alias)}); 144 + var me = new MExpr.MList(_position,SymbolMExprSerializer.CrossReferenceHead, [new MExpr.MAtom(_position, alias), 145 + ]); 145 146 var s0 = Symbol.CreateNil(_position); 146 147 _symbols.Declare(alias,s0); 147 148 ··· 265 266 MExpr.MList _createCrossReference(string alias) 266 267 { 267 268 return new(_position, SymbolMExprSerializer.CrossReferenceHead, 268 - new[] {new MExpr.MAtom(_position, alias)}); 269 + [new MExpr.MAtom(_position, alias)]); 269 270 } 270 271 }
+2
PrexoniteTests/Tests/MemberCallable.cs
··· 26 26 27 27 using System; 28 28 using System.Diagnostics; 29 + using System.Diagnostics.CodeAnalysis; 29 30 using NUnit.Framework; 30 31 using Prexonite; 31 32 using Prexonite.Types; ··· 53 54 ReadOnlySpan<PValue> args, 54 55 PCall call, 55 56 string id, 57 + [NotNullWhen(true)] 56 58 out PValue? result 57 59 ) 58 60 {
+15 -21
PrexoniteTests/Tests/NamespaceInfrastructureTests.cs
··· 303 303 var nsa = mlv.CreateLocalNamespace(new EmptySymbolView<Symbol>()); 304 304 var b = Symbol.CreateReference(EntityRef.Command.Create("c"),NoSourcePosition.Instance); 305 305 var d = Symbol.CreateReference(EntityRef.Command.Create("e"),NoSourcePosition.Instance); 306 - nsa.DeclareExports(new[] 307 - { 306 + nsa.DeclareExports([ 308 307 new KeyValuePair<string, Symbol>(nameof(b),b), 309 308 new KeyValuePair<string, Symbol>(nameof(d),d), 310 - }); 309 + ]); 311 310 var a = Symbol.CreateNamespace(nsa, NoSourcePosition.Instance); 312 311 globalScope.Declare(nameof(a), a); 313 312 ··· 320 319 321 320 var ssb = SymbolStoreBuilder.Create(mlv); 322 321 ssb.Forward(new SymbolOrigin.NamespaceImport(new(nameof(a)),NoSourcePosition.Instance),nssyma!.Namespace, 323 - new [] 324 - { 325 - SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 322 + [ 323 + SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 326 324 SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"g"), 327 - }); 325 + ]); 328 326 var scope = ssb.ToSymbolStore(); 329 327 330 328 _assertNotExists(scope, nameof(d)); ··· 343 341 var nsa = mlv.CreateLocalNamespace(new EmptySymbolView<Symbol>()); 344 342 var b = Symbol.CreateReference(EntityRef.Command.Create("c"), NoSourcePosition.Instance); 345 343 var d = Symbol.CreateReference(EntityRef.Command.Create("e"), NoSourcePosition.Instance); 346 - nsa.DeclareExports(new[] 347 - { 344 + nsa.DeclareExports([ 348 345 new KeyValuePair<string, Symbol>(nameof(b),b), 349 346 new KeyValuePair<string, Symbol>(nameof(d),d), 350 - }); 347 + ]); 351 348 var a = Symbol.CreateNamespace(nsa, NoSourcePosition.Instance); 352 349 globalScope.Declare(nameof(a), a); 353 350 ··· 360 357 361 358 var ssb = SymbolStoreBuilder.Create(mlv); 362 359 ssb.Forward(new SymbolOrigin.NamespaceImport(new(nameof(a)), NoSourcePosition.Instance), nssyma!.Namespace, 363 - new SymbolTransferDirective[] 364 - { 365 - SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 360 + [ 361 + SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 366 362 SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"g"), 367 363 SymbolTransferDirective.CreateWildcard(NoSourcePosition.Instance), 368 - }); 364 + ]); 369 365 var scope = ssb.ToSymbolStore(); 370 366 371 367 _assertNotExists(scope, nameof(b),"import scope"); ··· 385 381 var nsa = mlv.CreateLocalNamespace(new EmptySymbolView<Symbol>()); 386 382 var b = Symbol.CreateReference(EntityRef.Command.Create("c"), NoSourcePosition.Instance); 387 383 var d = Symbol.CreateReference(EntityRef.Command.Create("e"), NoSourcePosition.Instance); 388 - nsa.DeclareExports(new[] 389 - { 384 + nsa.DeclareExports([ 390 385 new KeyValuePair<string, Symbol>(nameof(b),b), 391 386 new KeyValuePair<string, Symbol>(nameof(d),d), 392 - }); 387 + ]); 393 388 var a = Symbol.CreateNamespace(nsa, NoSourcePosition.Instance); 394 389 globalScope.Declare(nameof(a), a); 395 390 ··· 402 397 403 398 var ssb = SymbolStoreBuilder.Create(mlv); 404 399 ssb.Forward(new SymbolOrigin.NamespaceImport(new(nameof(a)), NoSourcePosition.Instance), nssyma!.Namespace, 405 - new SymbolTransferDirective[] 406 - { 407 - SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 400 + [ 401 + SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"f"), 408 402 SymbolTransferDirective.CreateRename(NoSourcePosition.Instance, nameof(b),"g"), 409 403 SymbolTransferDirective.CreateWildcard(NoSourcePosition.Instance), 410 404 SymbolTransferDirective.CreateDrop(NoSourcePosition.Instance, nameof(d)), 411 - }); 405 + ]); 412 406 var scope = ssb.ToSymbolStore(); 413 407 414 408 _assertNotExists(scope,nameof(d),"import scope");
+7 -7
PrexoniteTests/Tests/PartialApplication.cs
··· 515 515 "); 516 516 517 517 var x = new MemberCallable {Name = "x"}; 518 - x.Expect("m", new PValue[] {3, 2}, call: PCall.Get, returns: 11); 518 + x.Expect("m", [3, 2], call: PCall.Get, returns: 11); 519 519 520 520 Expect(11, sctx.CreateNativePValue(x), 2, 3); 521 521 x.AssertCalledAll(); ··· 533 533 "); 534 534 535 535 var x = new MemberCallable {Name = "x"}; 536 - x.Expect("", new PValue[] {2, 3}, call: PCall.Get, returns: 11); 536 + x.Expect("", [2, 3], call: PCall.Get, returns: 11); 537 537 538 538 Expect(11, sctx.CreateNativePValue(x), 2, 3); 539 539 x.AssertCalledAll(); ··· 551 551 "); 552 552 553 553 var x = new MemberCallable {Name = "x"}; 554 - x.Expect("m", new PValue[] {3, 2}, call: PCall.Get, returns: 11); 554 + x.Expect("m", [3, 2], call: PCall.Get, returns: 11); 555 555 556 556 Expect(11, sctx.CreateNativePValue(x), 2, 3); 557 557 x.AssertCalledAll(); ··· 569 569 "); 570 570 571 571 var x = new MemberCallable {Name = "x"}; 572 - x.Expect("m", new PValue[] {3, 2}, call: PCall.Get, returns: 11); 572 + x.Expect("m", [3, 2], call: PCall.Get, returns: 11); 573 573 574 574 Expect(11, sctx.CreateNativePValue(x), 2, 3); 575 575 x.AssertCalledAll(); ··· 587 587 "); 588 588 589 589 var x = new MemberCallable {Name = "x"}; 590 - x.Expect("m", new PValue[] {3, 2}, call: PCall.Set, returns: 11); 590 + x.Expect("m", [3, 2], call: PCall.Set, returns: 11); 591 591 592 592 Expect(2, sctx.CreateNativePValue(x), 2, 3); 593 593 x.AssertCalledAll(); ··· 606 606 "); 607 607 608 608 var x = new MemberCallable {Name = "x"}; 609 - x.Expect("m", new PValue[] {3, 2}, call: PCall.Set, returns: 11); 609 + x.Expect("m", [3, 2], call: PCall.Set, returns: 11); 610 610 611 611 Expect(2, sctx.CreateNativePValue(x), 2, 3); 612 612 x.AssertCalledAll(); ··· 624 624 "); 625 625 626 626 var x = new MemberCallable {Name = "x"}; 627 - x.Expect("", new PValue[] {3, 2}, call: PCall.Set, returns: 11); 627 + x.Expect("", [3, 2], call: PCall.Set, returns: 11); 628 628 629 629 Expect(2, sctx.CreateNativePValue(x), 2, 3); 630 630 x.AssertCalledAll();
+1 -1
PrexoniteTests/Tests/SelfAssemblingPlanTests.cs
··· 477 477 // Provide the module lost to the SAM ahead of time, fully resolved 478 478 var lostModuleName = new ModuleName("lost", new(0, 0)); 479 479 Sam.TargetDescriptions.Add(new ManualTargetDescription(lostModuleName, Source.FromString("name: lost;"), 480 - pathLost, Enumerable.Empty<ModuleName>())); 480 + pathLost, [])); 481 481 482 482 // Have module found short-circuit when resolving lost 483 483 using (MockFile(pathFound, "name found;references{lost}"))
+3 -3
PrexoniteTests/Tests/Translation.cs
··· 97 97 98 98 "); 99 99 100 - var entry = new MetaEntry(new MetaEntry[] {"1", "2", "3"}); 100 + var entry = new MetaEntry(["1", "2", "3"]); 101 101 102 102 Assert.That(target, Meta.Contains("glob", entry)); 103 103 var main = target.Functions["main"]; ··· 1365 1365 Assert.That(meta, Does.ContainKey("name")); 1366 1366 Assert.That(meta, Does.ContainKey("references")); 1367 1367 Assert.That(meta["name"], Is.EqualTo(new MetaEntry("some.module.test"))); 1368 - Assert.That(meta["references"], Is.EqualTo(new MetaEntry(new[]{new MetaEntry("some.module")}))); 1368 + Assert.That(meta["references"], Is.EqualTo(new MetaEntry([new MetaEntry("some.module")]))); 1369 1369 1370 1370 var f = target.Functions["main"]; 1371 1371 Assert.That(f!.Meta, Does.ContainKey("key1")); ··· 1373 1373 Assert.That(f.Meta, Does.ContainKey("key3")); 1374 1374 Assert.That(f.Meta["key1"], Is.EqualTo(new MetaEntry("dot.separated.value"))); 1375 1375 Assert.That(f.Meta["key2"], Is.EqualTo(new MetaEntry("value2"))); 1376 - Assert.That(f.Meta["key3"], Is.EqualTo(new MetaEntry(new[]{new MetaEntry("a.b"), new MetaEntry("c")}))); 1376 + Assert.That(f.Meta["key3"], Is.EqualTo(new MetaEntry([new MetaEntry("a.b"), new MetaEntry("c")]))); 1377 1377 } 1378 1378 1379 1379 [Test]
+9 -7
PrexoniteTests/Tests/TypeSystem.cs
··· 67 67 //Set obj.Subject = 55 68 68 obj.DynamicCall( 69 69 sctx, 70 - new PValue[] {55}, 70 + [55], 71 71 PCall.Set, 72 72 "Subject"); 73 73 Assert.AreSame(test, obj.Value); ··· 76 76 //Get res = obj.Subject 77 77 var res = obj.DynamicCall( 78 78 sctx, 79 - Array.Empty<PValue>(), 79 + [], 80 80 PCall.Get, 81 81 "Subject"); 82 82 Assert.AreEqual(test.Subject, res.Value); ··· 84 84 //Set obj.Count = res 85 85 obj.DynamicCall( 86 86 sctx, 87 - new[] {res}, 87 + [res], 88 88 PCall.Set, 89 89 "Count"); 90 90 Assert.AreEqual(55, test.Count); ··· 92 92 //Get res = obj.Count 93 93 res = obj.DynamicCall( 94 94 sctx, 95 - Array.Empty<PValue>(), 95 + [], 96 96 PCall.Get, 97 97 "Count"); 98 98 Assert.AreEqual(55, test.Count); ··· 122 122 { 123 123 var res = 124 124 sctx.ConstructPType( 125 - nameof(Object), new[] {PType.Object.CreatePValue(typeof (int))}); 125 + nameof(Object), 126 + [PType.Object.CreatePValue(typeof (int))]); 126 127 Assert.AreEqual(PType.Object[typeof (int)], res); 127 128 } 128 129 ··· 131 132 { 132 133 var res = 133 134 sctx.ConstructPType( 134 - typeof (ObjectPType), new[] {PType.Object.CreatePValue(typeof (DateTime))}); 135 + typeof (ObjectPType), 136 + [PType.Object.CreatePValue(typeof (DateTime))]); 135 137 Assert.AreEqual(PType.Object[typeof (DateTime)], res); 136 138 } 137 139 ··· 141 143 var res = 142 144 sctx.ConstructPType( 143 145 PType.Object[typeof (ObjectPType)], 144 - new[] {PType.Object.CreatePValue(typeof (Thread))}); 146 + [PType.Object.CreatePValue(typeof (Thread))]); 145 147 Assert.AreEqual(PType.Object[typeof (Thread)], res); 146 148 } 147 149
+16 -19
PrexoniteTests/Tests/VMTests.Basic.cs
··· 104 104 var expected = x--; 105 105 106 106 var fctx = 107 - target.Functions["test1"]!.CreateFunctionContext(engine, new PValue[] {x0}); 107 + target.Functions["test1"]!.CreateFunctionContext(engine, [x0]); 108 108 engine.Stack.AddLast(fctx); 109 109 var rv = engine.Process(); 110 110 ··· 230 230 var expected = (x0 + 2 + j)/j; 231 231 232 232 var fctx = 233 - target.Functions["test1"]!.CreateFunctionContext(engine, new PValue[] {x0}); 233 + target.Functions["test1"]!.CreateFunctionContext(engine, [x0]); 234 234 engine.Stack.AddLast(fctx); 235 235 var rv = engine.Process(); 236 236 Assert.AreEqual(PType.BuiltIn.Int, rv.Type.ToBuiltIn()); ··· 266 266 const int expected = (2 + x1 + j1)/j1; 267 267 268 268 var fctx = 269 - target.Functions["test1"]!.CreateFunctionContext(engine, new PValue[] {x0}); 269 + target.Functions["test1"]!.CreateFunctionContext(engine, [x0]); 270 270 engine.Stack.AddLast(fctx); 271 271 var rv = engine.Process(); 272 272 Assert.AreEqual(PType.BuiltIn.Int, rv.Type.ToBuiltIn()); ··· 298 298 TestContext.WriteLine("\nFib(" + n + ") do "); 299 299 var expected = _fibonacci(n); 300 300 var fctx = 301 - target.Functions["fib"]!.CreateFunctionContext(engine, new PValue[] {n}); 301 + target.Functions["fib"]!.CreateFunctionContext(engine, [n]); 302 302 engine.Stack.AddLast(fctx); 303 303 var rv = engine.Process(); 304 304 Assert.AreEqual( ··· 352 352 TestContext.WriteLine("\nFib(" + n + ") do "); 353 353 var expected = _fibonacci(n); 354 354 var fctx = 355 - target.Functions["fib"]!.CreateFunctionContext(engine, new PValue[] {n}); 355 + target.Functions["fib"]!.CreateFunctionContext(engine, [n]); 356 356 engine.Stack.AddLast(fctx); 357 357 var rv = engine.Process(); 358 358 Assert.AreEqual( ··· 443 443 var buffer = new StringBuilder(); 444 444 const int max = 20; 445 445 var aList = new List<string>( 446 - new[] 447 - { 448 - GenerateRandomString(5), 446 + [ 447 + GenerateRandomString(5), 449 448 GenerateRandomString(10), 450 449 GenerateRandomString(15), 451 450 GenerateRandomString(3), 452 451 GenerateRandomString(5), 453 - }); 452 + ]); 454 453 455 454 foreach (var elem in aList) 456 455 if (buffer.Length + elem.Length < max) ··· 1019 1018 Expect(rs + rs, rs); 1020 1019 1021 1020 var lst = new List<PValue>( 1022 - new PValue[] 1023 - { 1024 - GenerateRandomString(2), GenerateRandomString(3), 1021 + [ 1022 + GenerateRandomString(2), GenerateRandomString(3), 1025 1023 GenerateRandomString(4), 1026 - }); 1024 + ]); 1027 1025 var ls = lst.Aggregate("", (current, e) => current + (e.Value as string)); 1028 1026 Expect(ls, (PValue) lst); 1029 1027 ··· 1365 1363 "); 1366 1364 var rnd = new Random(); 1367 1365 var sum = 0.0; 1368 - List<PValue> xlst = new(), 1369 - ylst = new(); 1366 + List<PValue> xlst = [], 1367 + ylst = []; 1370 1368 for (var i = 0; i < 10; i++) 1371 1369 { 1372 1370 var x = rnd.Next(3, 50); ··· 1446 1444 } 1447 1445 "); 1448 1446 var xs = new List<PValue>( 1449 - new PValue[] 1450 - { 1451 - 12, //=> 12 1447 + [ 1448 + 12, //=> 12 1452 1449 4, //=> 8 1453 1450 5, //=> 3 1454 1451 13, //=> 15 1455 - }); 1452 + ]); 1456 1453 1457 1454 Expect(12 + 8 + 3 + 15, PType.List.CreatePValue(xs)); 1458 1455 }
+3 -3
PrexoniteTests/Tests/VMTests.Commands.cs
··· 264 264 public void CallMemberCommandImplementation() 265 265 { 266 266 var obj = new MemberCallable {Name = "obj"}; 267 - obj.Expect("m", new PValue[] {1, 2, 3}, PCall.Get, 6); 268 - obj.Expect("", new PValue[] {4, "a"}, PCall.Set); 267 + obj.Expect("m", [1, 2, 3], PCall.Get, 6); 268 + obj.Expect("", [4, "a"], PCall.Set); 269 269 270 270 Compile( 271 271 @" ··· 453 453 { 454 454 Compile(@"function main = [1,2,3,4,5] >> reverse >> foldl((a,b) => a + b,"""");"); 455 455 456 - Expect("54321", Array.Empty<PValue>()); 456 + Expect("54321"); 457 457 } 458 458 459 459 [Test]
+1 -1
PrexoniteTests/Tests/VMTests.Exception.cs
··· 599 599 Assert.IsTrue(func!.HasCilImplementation, "main must have CIL implementation."); 600 600 } 601 601 602 - ExpectNull(Array.Empty<PValue>()); 602 + ExpectNull(); 603 603 } 604 604 605 605 [Test]
+1 -1
PrexoniteTests/Tests/VMTests.Macro.cs
··· 231 231 Assert.AreEqual(clo.Meta[PFunction.SharedNamesKey].List[0].Text, 232 232 MacroAliases.ContextAlias); 233 233 234 - Expect(15, Array.Empty<PValue>()); 234 + Expect(15); 235 235 } 236 236 237 237 [Test]
+3 -3
PrexoniteTests/Tests/VMTests.cs
··· 834 834 function compiled [is volatile;] = System::Object.ReferenceEquals(""ab"", ""a"" + ""b""); 835 835 "); 836 836 837 - ExpectNamed("interpreted", true, Array.Empty<PValue>()); 838 - ExpectNamed("compiled", true, Array.Empty<PValue>()); 837 + ExpectNamed("interpreted", true); 838 + ExpectNamed("compiled", true); 839 839 } 840 840 841 841 [Test] ··· 848 848 } 849 849 "); 850 850 851 - Expect(2, Array.Empty<PValue>()); 851 + Expect(2); 852 852 } 853 853 854 854 [Test]
+3 -2
Prx/Benchmarking/BenchmarkEntry.cs
··· 42 42 public readonly string? Overhead; 43 43 public readonly Benchmark Parent; 44 44 45 - public List<Measurement> Measurements { get; } = new(); 45 + public List<Measurement> Measurements { get; } = []; 46 46 47 47 public long GetAverageRawMilliseconds() 48 48 { ··· 168 168 { 169 169 var fctx = 170 170 Function.CreateFunctionContext( 171 - Parent.Machine, new PValue[] {Benchmark.DefaultWarmUpIterations}); 171 + Parent.Machine, 172 + [Benchmark.DefaultWarmUpIterations]); 172 173 Parent.Machine.Process(fctx); 173 174 } 174 175 }
+2 -2
Prx/Program.cs
··· 162 162 @"__replace_call", 163 163 delegate(StackContext sctx, PValue[] cargs) 164 164 { 165 - cargs = (PValue[]?)cargs ?? Array.Empty<PValue>(); 165 + cargs = (PValue[]?)cargs ?? []; 166 166 if ((StackContext?)sctx == null) 167 167 throw new ArgumentNullException(nameof(sctx)); 168 168 ··· 249 249 if ((StackContext?)sctx == null) 250 250 throw new ArgumentNullException(nameof(sctx)); 251 251 if ((PValue[]?)cargs == null) 252 - cargs = Array.Empty<PValue>(); 252 + cargs = []; 253 253 254 254 Engine teng; 255 255 int tit;
+1 -1
Prx/Prx.csproj
··· 6 6 7 7 <PropertyGroup> 8 8 <OutputType>exe</OutputType> 9 - <TargetFramework>net9.0</TargetFramework> 9 + <TargetFramework>net10.0</TargetFramework> 10 10 <AppConfig>config/app.$(Configuration).config</AppConfig> 11 11 <LangVersion>preview</LangVersion> 12 12 <Version>1.99</Version>
+3 -2
global.json
··· 1 1 { 2 2 "sdk": { 3 - "version": "9.0.100", 4 - "rollForward": "latestFeature" 3 + "version": "10.0.0", 4 + "rollForward": "latestFeature", 5 + "allowPrerelease": true 5 6 } 6 7 }