diff --git a/src/Executor/CodeExecutor.cs b/src/Executor/CodeExecutor.cs
index a148035..d9fe8ec 100644
--- a/src/Executor/CodeExecutor.cs
+++ b/src/Executor/CodeExecutor.cs
@@ -1,6 +1,6 @@
using EzrSquared.Runtime;
-using EzrSquared.Runtime.Types.CSharpWrappers.Builtins;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
+using EzrSquared.Runtime.Types.Builtins;
+using EzrSquared.Runtime.Types.Wrappers;
using EzrSquared.Syntax;
using EzrSquared.Syntax.Errors;
using System;
@@ -86,8 +86,8 @@ public static void AddToContext(Reference reference, string name)
///
/// The wrapped object to add.
/// The accessibility modifiers for the reference. Defaults to .
- /// See .
- public static void AddToContext(EzrSharpCompatibilityWrapper wrapper, AccessMod accessibilityModifiers = AccessMod.Constant)
+ /// See .
+ public static void AddToContext(EzrWrapper wrapper, AccessMod accessibilityModifiers = AccessMod.Constant)
where TMemberInfo : MemberInfo
{
if (RuntimeContext is null)
diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs
index 9f9fee6..63184be 100644
--- a/src/GlobalSuppressions.cs
+++ b/src/GlobalSuppressions.cs
@@ -10,6 +10,6 @@
[assembly: SuppressMessage("Style", "IDE0078:Use pattern matching", Justification = "Recommended fix breaks code.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Core.Text.EzrCharacterList.Multiplication(EzrSquared.Runtime.Types.IEzrObject,EzrSquared.Runtime.RuntimeResult)")]
[assembly: SuppressMessage("Style", "IDE0078:Use pattern matching", Justification = "Recommended fix breaks code.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Collections.EzrList.Multiplication(EzrSquared.Runtime.Types.IEzrObject,EzrSquared.Runtime.RuntimeResult)")]
[assembly: SuppressMessage("Style", "IDE0078:Use pattern matching", Justification = "Recommended fix breaks code.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Core.Text.EzrString.Multiplication(EzrSquared.Runtime.Types.IEzrObject,EzrSquared.Runtime.RuntimeResult)")]
-[assembly: SuppressMessage("Style", "IDE0078:Use pattern matching", Justification = "Recommended fix breaks code.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.EzrSharpCompatibilityWrapper`1.EzrObjectToCSharp(EzrSquared.Runtime.Types.IEzrObject,System.Type,EzrSquared.Runtime.RuntimeResult)~System.Object")]
-[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Too many ternary operators.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes.WrappedMemberAttribute.ValidateMethod(System.Reflection.MethodBase,System.Boolean)~System.Boolean")]
-[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Too many ternary operators.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes.WrappedMemberAttribute.ValidateType(System.Type,System.Boolean)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0078:Use pattern matching", Justification = "Recommended fix breaks code.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Wrappers.EzrWrapper`1.EzrObjectToCSharp(EzrSquared.Runtime.Types.IEzrObject,System.Type,EzrSquared.Runtime.RuntimeResult)~System.Object")]
+[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Too many ternary operators.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Wrappers.WrapMemberAttribute.ValidateMethod(System.Reflection.MethodBase,System.Boolean)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Too many ternary operators.", Scope = "member", Target = "~M:EzrSquared.Runtime.Types.Wrappers.WrapMemberAttribute.ValidateType(System.Type,System.Boolean)~System.Boolean")]
diff --git a/src/Runtime/Collections/RuntimeEzrObjectDictionary.cs b/src/Runtime/Collections/RuntimeEzrObjectDictionary.cs
index 7058a77..a636264 100644
--- a/src/Runtime/Collections/RuntimeEzrObjectDictionary.cs
+++ b/src/Runtime/Collections/RuntimeEzrObjectDictionary.cs
@@ -1,8 +1,8 @@
using EzrSquared.Runtime.Types;
using EzrSquared.Runtime.Types.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using System.Collections;
using System.Collections.Generic;
@@ -21,7 +21,7 @@ public class RuntimeEzrObjectDictionary : IMutable,
///
/// The number of s in the .
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count => _items.Count;
///
@@ -117,7 +117,7 @@ public bool Remove(IEzrObject key, RuntimeResult result)
///
/// The key (hash) to be removed.
/// if the operation was successful, if not.
- [WrappedMember("remove_by_hash")]
+ [WrapMember("remove_by_hash")]
public bool RemoveHash(int key)
{
if (_items.TryGetValue(key, out KeyValuePair pair))
@@ -192,8 +192,8 @@ public Reference Get(IEzrObject key, RuntimeResult result)
/// The key to be checked.
/// The object for returning errors.
/// if the key was found, if any error occured or the key was not found.
- [WrappedMember]
- public bool HasKey(IEzrObject key, [Runtime(Feature.ResultRef)] RuntimeResult result)
+ [WrapMember]
+ public bool HasKey(IEzrObject key, [FeatureParameter(Feature.ResultRef)] RuntimeResult result)
{
int hash = key.ComputeHashCode(result);
return !result.ShouldReturn && _items.ContainsKey(hash);
diff --git a/src/Runtime/Interpreter.cs b/src/Runtime/Interpreter.cs
index 02ebcd0..c964506 100644
--- a/src/Runtime/Interpreter.cs
+++ b/src/Runtime/Interpreter.cs
@@ -6,8 +6,8 @@
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
using EzrSquared.Runtime.Types.Core.Text;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
using EzrSquared.Runtime.Types.Executables;
+using EzrSquared.Runtime.Types.Wrappers;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -1174,7 +1174,7 @@ private void VisitTryNode(TryNode node, Context executionContext, Context callin
return;
IEzrObject targetObject = RuntimeResult.Reference.Object;
- if (targetObject is not EzrSharpCompatibilityType target || !typeof(IEzrRuntimeError).IsAssignableFrom(target.SharpMember))
+ if (targetObject is not EzrTypeWrapper target || !typeof(IEzrRuntimeError).IsAssignableFrom(target.SharpMember))
{
RuntimeResult.Failure(new EzrUnexpectedTypeError($"Expected error type, but got object of type \"{targetObject.TypeName}\"!", executionContext, errorType.StartPosition, errorType.EndPosition));
return;
diff --git a/src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinFunctions.cs b/src/Runtime/Types/Builtins/EzrBuiltinFunctions.cs
similarity index 78%
rename from src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinFunctions.cs
rename to src/Runtime/Types/Builtins/EzrBuiltinFunctions.cs
index c08786c..12ddd6a 100644
--- a/src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinFunctions.cs
+++ b/src/Runtime/Types/Builtins/EzrBuiltinFunctions.cs
@@ -4,14 +4,13 @@
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
using EzrSquared.Runtime.Types.Core.Text;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using System;
using System.Collections.Generic;
using System.Text;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.Builtins;
+namespace EzrSquared.Runtime.Types.Builtins;
///
/// All built-in functions in ezr².
@@ -53,15 +52,14 @@ public static class EzrBuiltinFunctions
///
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static void Show(
- [Expose(true)] string lineEnd,
- [Expose(true)] string separator,
- [Runtime(Feature.PositionalArguments)] ExtraPositionalArguments messages,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ResultRef)] RuntimeResult result,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [Parameter(true)] string lineEnd,
+ [Parameter(true)] string separator,
+ [FeatureParameter(Feature.PositionalArguments)] ExtraPositionalArguments messages,
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ResultRef)] RuntimeResult result,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
{
if (messages.Count == 0)
{
@@ -112,9 +110,8 @@ public static void Show(
///
///
///
- /// The method arguments.
- [WrappedMember]
- public static void ThrowError(IEzrRuntimeError error, [Runtime(Feature.ResultRef)] RuntimeResult result)
+ [WrapMember]
+ public static void ThrowError(IEzrRuntimeError error, [FeatureParameter(Feature.ResultRef)] RuntimeResult result)
{
result.Failure(error);
}
@@ -134,9 +131,8 @@ public static void ThrowError(IEzrRuntimeError error, [Runtime(Feature.ResultRef
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
- public static string Get([Expose(true)] IEzrObject? message, [Runtime(Feature.ResultRef)] RuntimeResult result)
+ [WrapMember]
+ public static string Get([Parameter(true)] IEzrObject? message, [FeatureParameter(Feature.ResultRef)] RuntimeResult result)
{
if (message is not null)
{
@@ -157,8 +153,7 @@ public static string Get([Expose(true)] IEzrObject? message, [Runtime(Feature.Re
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static void Clear()
{
Console.Clear();
@@ -182,12 +177,11 @@ public static void Clear()
/// ezr² errors:
/// if the condition is not met.
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static void Assert(IEzrObject condition,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ResultRef)] RuntimeResult result,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ResultRef)] RuntimeResult result,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
{
bool conditionResult = condition.EvaluateBoolean(result);
if (!result.ShouldReturn && !conditionResult)
@@ -209,9 +203,8 @@ public static void Assert(IEzrObject condition,
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
- public static int Hash(IEzrObject toHash, [Runtime(Feature.ResultRef)] RuntimeResult result)
+ [WrapMember]
+ public static int Hash(IEzrObject toHash, [FeatureParameter(Feature.ResultRef)] RuntimeResult result)
{
return toHash.ComputeHashCode(result);
}
@@ -231,8 +224,7 @@ public static int Hash(IEzrObject toHash, [Runtime(Feature.ResultRef)] RuntimeRe
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static string TypeOf(IEzrObject toCheck)
{
return toCheck.Tag;
@@ -253,8 +245,7 @@ public static string TypeOf(IEzrObject toCheck)
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static string TypeNameOf(IEzrObject toCheck)
{
return toCheck.TypeName;
@@ -275,8 +266,7 @@ public static string TypeNameOf(IEzrObject toCheck)
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static int TypeHashOf(IEzrObject toCheck)
{
return toCheck.HashTag;
@@ -300,9 +290,8 @@ public static int TypeHashOf(IEzrObject toCheck)
/// ezr² errors:
/// if "to_copy" is not of the expected type.
///
- /// The method arguments.
- [WrappedMember]
- public static IEzrObject Copy(IEzrMutableObject toCopy, [Runtime(Feature.ResultRef)] RuntimeResult result)
+ [WrapMember]
+ public static IEzrObject Copy(IEzrMutableObject toCopy, [FeatureParameter(Feature.ResultRef)] RuntimeResult result)
{
return (IEzrObject?)toCopy.DeepCopy(result) ?? EzrConstants.Nothing;
}
@@ -322,13 +311,12 @@ public static IEzrObject Copy(IEzrMutableObject toCopy, [Runtime(Feature.ResultR
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
- public static EzrSharpCompatibilityObjectInstance GetRaw(IEzrObject toGet,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [WrapMember]
+ public static EzrObjectWrapper GetRaw(IEzrObject toGet,
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
{
- return new EzrSharpCompatibilityObjectInstance(toGet, toGet.GetType(), executionContext, wrapper.StartPosition, wrapper.EndPosition);
+ return new EzrObjectWrapper(toGet, toGet.GetType(), executionContext, wrapper.StartPosition, wrapper.EndPosition);
}
///
@@ -346,12 +334,11 @@ public static EzrSharpCompatibilityObjectInstance GetRaw(IEzrObject toGet,
/// ezr² return type:
///
///
- /// The method arguments.
- [WrappedMember]
+ [WrapMember]
public static IEzrObject GetContext(IEzrObject toGet,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ResultRef)] RuntimeResult result,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ResultRef)] RuntimeResult result,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
{
RuntimeEzrObjectDictionary context = new();
foreach (KeyValuePair pair in toGet.Context)
diff --git a/src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinsUtility.cs b/src/Runtime/Types/Builtins/EzrBuiltinsUtility.cs
similarity index 55%
rename from src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinsUtility.cs
rename to src/Runtime/Types/Builtins/EzrBuiltinsUtility.cs
index b438a59..d5b95f1 100644
--- a/src/Runtime/Types/CSharpWrappers/Builtins/EzrBuiltinsUtility.cs
+++ b/src/Runtime/Types/Builtins/EzrBuiltinsUtility.cs
@@ -1,9 +1,9 @@
using EzrSquared.Runtime.Types.Core;
using EzrSquared.Runtime.Types.Core.Errors;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.Builtins;
+namespace EzrSquared.Runtime.Types.Builtins;
///
/// Utility to add built-ins to contexts.
@@ -16,15 +16,15 @@ public static class EzrBuiltinsUtility
/// The context to add to.
public static void AddBuiltinFunctions(Context context)
{
- EzrSharpCompatibilityFunction throwError = new(EzrBuiltinFunctions.ThrowError, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction assert = new(EzrBuiltinFunctions.Assert, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction hash = new(EzrBuiltinFunctions.Hash, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction typeOf = new(EzrBuiltinFunctions.TypeOf, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction typeNameOf = new(EzrBuiltinFunctions.TypeNameOf, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction typeHashOf = new(EzrBuiltinFunctions.TypeHashOf, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction copy = new(EzrBuiltinFunctions.Copy, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction getRaw = new(EzrBuiltinFunctions.GetRaw, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction getContext = new(EzrBuiltinFunctions.GetContext, context, Position.None, Position.None);
+ EzrMethodWrapper throwError = new(EzrBuiltinFunctions.ThrowError, context, Position.None, Position.None);
+ EzrMethodWrapper assert = new(EzrBuiltinFunctions.Assert, context, Position.None, Position.None);
+ EzrMethodWrapper hash = new(EzrBuiltinFunctions.Hash, context, Position.None, Position.None);
+ EzrMethodWrapper typeOf = new(EzrBuiltinFunctions.TypeOf, context, Position.None, Position.None);
+ EzrMethodWrapper typeNameOf = new(EzrBuiltinFunctions.TypeNameOf, context, Position.None, Position.None);
+ EzrMethodWrapper typeHashOf = new(EzrBuiltinFunctions.TypeHashOf, context, Position.None, Position.None);
+ EzrMethodWrapper copy = new(EzrBuiltinFunctions.Copy, context, Position.None, Position.None);
+ EzrMethodWrapper getRaw = new(EzrBuiltinFunctions.GetRaw, context, Position.None, Position.None);
+ EzrMethodWrapper getContext = new(EzrBuiltinFunctions.GetContext, context, Position.None, Position.None);
context.Set(null, throwError.SharpMemberName, ReferencePool.Get(throwError, AccessMod.Constant));
context.Set(null, assert.SharpMemberName, ReferencePool.Get(assert, AccessMod.Constant));
@@ -43,9 +43,9 @@ public static void AddBuiltinFunctions(Context context)
/// The context to add to.
public static void AddBuiltinIOFunctions(Context context)
{
- EzrSharpCompatibilityFunction show = new(EzrBuiltinFunctions.Show, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction get = new(EzrBuiltinFunctions.Get, context, Position.None, Position.None);
- EzrSharpCompatibilityFunction clear = new(EzrBuiltinFunctions.Clear, context, Position.None, Position.None);
+ EzrMethodWrapper show = new(EzrBuiltinFunctions.Show, context, Position.None, Position.None);
+ EzrMethodWrapper get = new(EzrBuiltinFunctions.Get, context, Position.None, Position.None);
+ EzrMethodWrapper clear = new(EzrBuiltinFunctions.Clear, context, Position.None, Position.None);
context.Set(null, show.SharpMemberName, ReferencePool.Get(show, AccessMod.Constant));
context.Set(null, get.SharpMemberName, ReferencePool.Get(get, AccessMod.Constant));
@@ -56,23 +56,23 @@ public static void AddBuiltinIOFunctions(Context context)
/// Adds all built-in types to the given context.
///
/// The context to add to.
- public static void AddBuiltinTypes(Context context )
+ public static void AddBuiltinTypes(Context context)
{
- EzrSharpCompatibilityType runtimeError = new(typeof(EzrRuntimeError), context, Position.None, Position.None);
+ EzrTypeWrapper runtimeError = new(typeof(EzrRuntimeError), context, Position.None, Position.None);
context.Set(null, runtimeError.SharpMemberName, ReferencePool.Get(runtimeError, AccessMod.Constant));
- EzrSharpCompatibilityType assertionError = new(typeof(EzrAssertionError), context, Position.None, Position.None);
- EzrSharpCompatibilityType illegalOperationError = new(typeof(EzrIllegalOperationError), context, Position.None, Position.None);
- EzrSharpCompatibilityType keyNotFoundError = new(typeof(EzrKeyNotFoundError), context, Position.None, Position.None);
- EzrSharpCompatibilityType mathError = new(typeof(EzrMathError), context, Position.None, Position.None);
- EzrSharpCompatibilityType missingRequiredArgumentError = new(typeof(EzrMissingRequiredArgumentError), context, Position.None, Position.None);
- EzrSharpCompatibilityType privateMemberOperationError = new(typeof(EzrPrivateMemberOperationError), context, Position.None, Position.None);
- EzrSharpCompatibilityType undefinedValueError = new(typeof(EzrUndefinedValueError), context, Position.None, Position.None);
- EzrSharpCompatibilityType unexpectedArgumentError = new(typeof(EzrUnexpectedArgumentError), context, Position.None, Position.None);
- EzrSharpCompatibilityType unexpectedTypeError = new(typeof(EzrUnexpectedTypeError), context, Position.None, Position.None);
- EzrSharpCompatibilityType unsupportedWrappingError = new(typeof(EzrUnsupportedWrappingError), context, Position.None, Position.None);
- EzrSharpCompatibilityType valueOutOfRangeError = new(typeof(EzrValueOutOfRangeError), context, Position.None, Position.None);
- EzrSharpCompatibilityType wrapperExecutionError = new(typeof(EzrWrapperExecutionError), context, Position.None, Position.None);
+ EzrTypeWrapper assertionError = new(typeof(EzrAssertionError), context, Position.None, Position.None);
+ EzrTypeWrapper illegalOperationError = new(typeof(EzrIllegalOperationError), context, Position.None, Position.None);
+ EzrTypeWrapper keyNotFoundError = new(typeof(EzrKeyNotFoundError), context, Position.None, Position.None);
+ EzrTypeWrapper mathError = new(typeof(EzrMathError), context, Position.None, Position.None);
+ EzrTypeWrapper missingRequiredArgumentError = new(typeof(EzrMissingRequiredArgumentError), context, Position.None, Position.None);
+ EzrTypeWrapper privateMemberOperationError = new(typeof(EzrPrivateMemberOperationError), context, Position.None, Position.None);
+ EzrTypeWrapper undefinedValueError = new(typeof(EzrUndefinedValueError), context, Position.None, Position.None);
+ EzrTypeWrapper unexpectedArgumentError = new(typeof(EzrUnexpectedArgumentError), context, Position.None, Position.None);
+ EzrTypeWrapper unexpectedTypeError = new(typeof(EzrUnexpectedTypeError), context, Position.None, Position.None);
+ EzrTypeWrapper unsupportedWrappingError = new(typeof(EzrUnsupportedWrappingError), context, Position.None, Position.None);
+ EzrTypeWrapper valueOutOfRangeError = new(typeof(EzrValueOutOfRangeError), context, Position.None, Position.None);
+ EzrTypeWrapper wrapperExecutionError = new(typeof(EzrWrapperExecutionError), context, Position.None, Position.None);
context.Set(null, assertionError.SharpMemberName, ReferencePool.Get(assertionError, AccessMod.Constant));
context.Set(null, illegalOperationError.SharpMemberName, ReferencePool.Get(illegalOperationError, AccessMod.Constant));
diff --git a/src/Runtime/Types/Collections/EzrArray.cs b/src/Runtime/Types/Collections/EzrArray.cs
index e282b70..9726339 100644
--- a/src/Runtime/Types/Collections/EzrArray.cs
+++ b/src/Runtime/Types/Collections/EzrArray.cs
@@ -1,7 +1,7 @@
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -27,7 +27,7 @@ public class EzrArray : EzrObject, IEzrIndexedCollection
public readonly IEzrObject[] Value;
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count { get; }
///
@@ -42,7 +42,7 @@ public EzrArray(IEzrObject[] elements, Context parentContext, Position startPosi
Value = elements;
Count = elements.Length;
- Context.Set(null, "length", ReferencePool.Get(new EzrSharpCompatibilityProperty(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "length", ReferencePool.Get(new EzrPropertyWrapper(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
}
///
diff --git a/src/Runtime/Types/Collections/EzrDictionary.cs b/src/Runtime/Types/Collections/EzrDictionary.cs
index 099ba6b..c87ffa9 100644
--- a/src/Runtime/Types/Collections/EzrDictionary.cs
+++ b/src/Runtime/Types/Collections/EzrDictionary.cs
@@ -1,9 +1,9 @@
using EzrSquared.Runtime.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -28,7 +28,7 @@ public class EzrDictionary : EzrObject, IEzrMutableObject, IEzrDictionary
public readonly RuntimeEzrObjectDictionary Value;
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count => Value.Count;
///
@@ -42,9 +42,9 @@ public EzrDictionary(RuntimeEzrObjectDictionary value, Context parentContext, Po
{
Value = value;
- Context.Set(null, "length", ReferencePool.Get(new EzrSharpCompatibilityProperty(GetMemberInfo(nameof(Value.Count))!, Value, Context, StartPosition, EndPosition), AccessMod.Constant));
- Context.Set(null, "remove_by_hash", ReferencePool.Get(new EzrSharpCompatibilityFunction(Value.RemoveHash, Context, StartPosition, EndPosition), AccessMod.Constant));
- Context.Set(null, "has_key", ReferencePool.Get(new EzrSharpCompatibilityFunction(Value.HasKey, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "length", ReferencePool.Get(new EzrPropertyWrapper(GetMemberInfo(nameof(Value.Count))!, Value, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "remove_by_hash", ReferencePool.Get(new EzrMethodWrapper(Value.RemoveHash, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "has_key", ReferencePool.Get(new EzrMethodWrapper(Value.HasKey, Context, StartPosition, EndPosition), AccessMod.Constant));
}
///
diff --git a/src/Runtime/Types/Collections/EzrList.cs b/src/Runtime/Types/Collections/EzrList.cs
index 990e4aa..e46a5cf 100644
--- a/src/Runtime/Types/Collections/EzrList.cs
+++ b/src/Runtime/Types/Collections/EzrList.cs
@@ -1,8 +1,8 @@
using EzrSquared.Runtime.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -28,7 +28,7 @@ public class EzrList : EzrObject, IEzrMutableObject, IEzrIndexedCollection
public readonly RuntimeEzrObjectList Value;
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count => Value.Count;
/// The base value.
@@ -39,7 +39,7 @@ public EzrList(RuntimeEzrObjectList elements, Context parentContext, Position st
{
Value = elements;
- Context.Set(null, "length", ReferencePool.Get(new EzrSharpCompatibilityProperty(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "length", ReferencePool.Get(new EzrPropertyWrapper(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
}
///
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrAssertionError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrAssertionError.cs
index c346211..f46bb9f 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrAssertionError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrAssertionError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -9,7 +9,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("assertion_error")]
+[WrapMember("assertion_error")]
public class EzrAssertionError(Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Assertion failed", "The assertion conditions were not met!", context, startPosition, endPosition)
{
///
@@ -23,9 +23,9 @@ public class EzrAssertionError(Context context, Position startPosition, Position
///
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrAssertionError(
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(executionContext, wrapper.StartPosition, wrapper.EndPosition) { }
}
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrIllegalOperationError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrIllegalOperationError.cs
index d4a18a6..b05031c 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrIllegalOperationError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrIllegalOperationError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("illegal_operation_error")]
+[WrapMember("illegal_operation_error")]
public class EzrIllegalOperationError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Illegal operation", details, context, startPosition, endPosition)
{
///
@@ -25,13 +25,14 @@ public class EzrIllegalOperationError(string details, Context context, Position
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrIllegalOperationError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
wrapper.StartPosition,
- wrapper.EndPosition) { }
+ wrapper.EndPosition)
+ { }
}
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrKeyNotFoundError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrKeyNotFoundError.cs
index 9564326..c3645bd 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrKeyNotFoundError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrKeyNotFoundError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("key_not_found_error")]
+[WrapMember("key_not_found_error")]
public class EzrKeyNotFoundError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Key not found", details, context, startPosition, endPosition)
{
///
@@ -25,13 +25,14 @@ public class EzrKeyNotFoundError(string details, Context context, Position start
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrKeyNotFoundError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
wrapper.StartPosition,
- wrapper.EndPosition) { }
+ wrapper.EndPosition)
+ { }
}
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrMathError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrMathError.cs
index 664ecae..d11b91b 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrMathError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrMathError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -11,7 +11,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("math_error")]
+[WrapMember("math_error")]
public class EzrMathError(string title, string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError(title, details, context, startPosition, endPosition)
{
///
@@ -27,14 +27,15 @@ public class EzrMathError(string title, string details, Context context, Positio
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrMathError(string title, string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
title,
details,
executionContext,
wrapper.StartPosition,
- wrapper.EndPosition) { }
+ wrapper.EndPosition)
+ { }
}
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrMissingRequiredArgumentError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrMissingRequiredArgumentError.cs
index 5c4820f..5b75e56 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrMissingRequiredArgumentError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrMissingRequiredArgumentError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("missing_required_argument_error")]
+[WrapMember("missing_required_argument_error")]
public class EzrMissingRequiredArgumentError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Missing required argument", details, context, startPosition, endPosition)
{
///
@@ -25,13 +25,14 @@ public class EzrMissingRequiredArgumentError(string details, Context context, Po
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrMissingRequiredArgumentError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
wrapper.StartPosition,
- wrapper.EndPosition) { }
+ wrapper.EndPosition)
+ { }
}
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrPrivateMemberOperationError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrPrivateMemberOperationError.cs
index 98ea7c6..d0ec66e 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrPrivateMemberOperationError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrPrivateMemberOperationError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("private_member_operation_error")]
+[WrapMember("private_member_operation_error")]
public class EzrPrivateMemberOperationError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Private member operation", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrPrivateMemberOperationError(string details, Context context, Pos
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrPrivateMemberOperationError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrRuntimeError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrRuntimeError.cs
index 55f8c9f..e7085f1 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrRuntimeError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrRuntimeError.cs
@@ -1,6 +1,6 @@
using EzrSquared.Runtime.Types.Core.Text;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using System;
using System.Text;
@@ -9,7 +9,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
///
/// Implementation of with some utility methods.
///
-[WrappedMember("runtime_error")]
+[WrapMember("runtime_error")]
public class EzrRuntimeError : EzrObject, IEzrRuntimeError
{
///
@@ -60,16 +60,17 @@ public EzrRuntimeError(string title, string details, Context context, Position s
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrRuntimeError(string title, string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
title,
details,
executionContext,
wrapper.StartPosition,
- wrapper.EndPosition) { }
+ wrapper.EndPosition)
+ { }
///
/// Converts the given argument to a string.
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrUndefinedValueError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrUndefinedValueError.cs
index cee154a..09e1e15 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrUndefinedValueError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrUndefinedValueError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("undefined_value_error")]
+[WrapMember("undefined_value_error")]
public class EzrUndefinedValueError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Undefined value", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrUndefinedValueError(string details, Context context, Position st
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrUndefinedValueError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedArgumentError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedArgumentError.cs
index 667989f..b9c1de1 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedArgumentError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedArgumentError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("unexpected_argument_error")]
+[WrapMember("unexpected_argument_error")]
public class EzrUnexpectedArgumentError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Unexpected argument(s)", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrUnexpectedArgumentError(string details, Context context, Positio
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrUnexpectedArgumentError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedTypeError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedTypeError.cs
index 6ab622a..fb587b9 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedTypeError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrUnexpectedTypeError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("unexpected_type_error")]
+[WrapMember("unexpected_type_error")]
public class EzrUnexpectedTypeError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Unexpected type", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrUnexpectedTypeError(string details, Context context, Position st
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrUnexpectedTypeError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrUnsupportedWrappingError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrUnsupportedWrappingError.cs
index 96dc5fd..2e74349 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrUnsupportedWrappingError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrUnsupportedWrappingError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("unsupported_wrapping_error")]
+[WrapMember("unsupported_wrapping_error")]
public class EzrUnsupportedWrappingError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Unsupported wrapping", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrUnsupportedWrappingError(string details, Context context, Positi
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrUnsupportedWrappingError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrValueOutOfRangeError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrValueOutOfRangeError.cs
index 80c1c30..82c2f8d 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrValueOutOfRangeError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrValueOutOfRangeError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("value_out_of_range_error")]
+[WrapMember("value_out_of_range_error")]
public class EzrValueOutOfRangeError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Value out of range", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrValueOutOfRangeError(string details, Context context, Position s
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrValueOutOfRangeError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/RuntimeErrors/EzrWrapperExecutionError.cs b/src/Runtime/Types/Core/RuntimeErrors/EzrWrapperExecutionError.cs
index 87ff7b1..76bf818 100644
--- a/src/Runtime/Types/Core/RuntimeErrors/EzrWrapperExecutionError.cs
+++ b/src/Runtime/Types/Core/RuntimeErrors/EzrWrapperExecutionError.cs
@@ -1,5 +1,5 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
namespace EzrSquared.Runtime.Types.Core.Errors;
@@ -10,7 +10,7 @@ namespace EzrSquared.Runtime.Types.Core.Errors;
/// The context in which the error occurred.
/// The starting position of the error.
/// The ending position of the error.
-[WrappedMember("wrapper_execution_error")]
+[WrapMember("wrapper_execution_error")]
public class EzrWrapperExecutionError(string details, Context context, Position startPosition, Position endPosition) : EzrRuntimeError("Wrapper execution error", details, context, startPosition, endPosition)
{
///
@@ -25,10 +25,10 @@ public class EzrWrapperExecutionError(string details, Context context, Position
/// Details on why the error happened.
/// The caller.
/// The execution context.
- [WrappedMember, PrimaryConstructor]
+ [WrapMember, PrimaryConstructor]
public EzrWrapperExecutionError(string details,
- [Runtime(Feature.CallerRef)] IEzrObject wrapper,
- [Runtime(Feature.ExecutionRef)] Context executionContext)
+ [FeatureParameter(Feature.CallerRef)] IEzrObject wrapper,
+ [FeatureParameter(Feature.ExecutionRef)] Context executionContext)
: this(
details,
executionContext,
diff --git a/src/Runtime/Types/Core/Text/EzrCharacterList.cs b/src/Runtime/Types/Core/Text/EzrCharacterList.cs
index 16fb67f..9b64ba0 100644
--- a/src/Runtime/Types/Core/Text/EzrCharacterList.cs
+++ b/src/Runtime/Types/Core/Text/EzrCharacterList.cs
@@ -1,8 +1,8 @@
using EzrSquared.Runtime.Types.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -34,7 +34,7 @@ public class EzrCharacterList : EzrObject, IEzrMutableObject, IEzrString, IEzrIn
public string StringValue => Value.ToString();
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count => Value.Length;
///
@@ -48,7 +48,7 @@ public EzrCharacterList(string value, Context parentContext, Position startPosit
{
Value = new(value);
- Context.Set(null, "length", ReferencePool.Get(new EzrSharpCompatibilityProperty(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "length", ReferencePool.Get(new EzrPropertyWrapper(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
}
///
diff --git a/src/Runtime/Types/Core/Text/EzrString.cs b/src/Runtime/Types/Core/Text/EzrString.cs
index 931a3e8..72ada18 100644
--- a/src/Runtime/Types/Core/Text/EzrString.cs
+++ b/src/Runtime/Types/Core/Text/EzrString.cs
@@ -1,8 +1,8 @@
using EzrSquared.Runtime.Types.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+using EzrSquared.Runtime.Types.Wrappers;
+using EzrSquared.Runtime.Types.Wrappers.Members;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -32,7 +32,7 @@ public class EzrString : EzrObject, IEzrString, IEzrIndexedCollection
public string StringValue => Value;
///
- [WrappedMember("length")]
+ [WrapMember("length")]
public int Count { get; }
///
@@ -47,7 +47,7 @@ public EzrString(string value, Context parentContext, Position startPosition, Po
Value = value;
Count = value.Length;
- Context.Set(null, "length", ReferencePool.Get(new EzrSharpCompatibilityProperty(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
+ Context.Set(null, "length", ReferencePool.Get(new EzrPropertyWrapper(GetMemberInfo(nameof(Count))!, this, Context, StartPosition, EndPosition), AccessMod.Constant));
}
///
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/DontWrapMemberAttribute.cs b/src/Runtime/Types/Wrappers/DontWrapMemberAttribute.cs
similarity index 84%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/DontWrapMemberAttribute.cs
rename to src/Runtime/Types/Wrappers/DontWrapMemberAttribute.cs
index 84181b5..712afec 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/DontWrapMemberAttribute.cs
+++ b/src/Runtime/Types/Wrappers/DontWrapMemberAttribute.cs
@@ -1,6 +1,6 @@
using System;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers;
///
/// Attribute for C# types and members which should NOT be automatically wrapped from C# types into ezr² types by the interpreter.
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityObjectInstance.cs b/src/Runtime/Types/Wrappers/EzrObjectWrapper.cs
similarity index 73%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityObjectInstance.cs
rename to src/Runtime/Types/Wrappers/EzrObjectWrapper.cs
index 060d83b..06fa6ca 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityObjectInstance.cs
+++ b/src/Runtime/Types/Wrappers/EzrObjectWrapper.cs
@@ -1,17 +1,16 @@
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+using EzrSquared.Runtime.Types.Wrappers.Members;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
+namespace EzrSquared.Runtime.Types.Wrappers;
///
/// Class to automatically wrap instances of C# types so that they can be used in ezr².
///
-public class EzrSharpCompatibilityObjectInstance : EzrSharpCompatibilityWrapper
+public class EzrObjectWrapper : EzrWrapper
{
///
public override string TypeName { get; protected internal set; } = "csharp object instance";
@@ -20,14 +19,14 @@ public class EzrSharpCompatibilityObjectInstance : EzrSharpCompatibilityWrapper<
public override string Tag { get; protected internal set; } = "ezrSquared.CSharpObjectInstance";
///
- /// Creates a new .
+ /// Creates a new .
///
/// The object to wrap.
/// The C# object's type.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
- public EzrSharpCompatibilityObjectInstance(
+ public EzrObjectWrapper(
object instance,
[DynamicallyAccessedMembers(
@@ -48,11 +47,11 @@ public EzrSharpCompatibilityObjectInstance(
for (int i = 0; i < allMethods.Length; i++)
{
MethodInfo method = allMethods[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(method))
+ if (!WrapMemberAttribute.ShouldBeWrapped(method))
continue;
- EzrSharpCompatibilityFunction methodObject = new(method, Instance, Context, StartPosition, EndPosition, skipValidation: true);
- if (!WrappedMemberAttribute.ValidateMethod(method, methodObject.AutoWrapperAttribute is null))
+ EzrMethodWrapper methodObject = new(method, Instance, Context, StartPosition, EndPosition, skipValidation: true);
+ if (!WrapMemberAttribute.ValidateMethod(method, methodObject.AutoWrapperAttribute is null))
continue;
string methodObjectName = methodObject.SharpMemberName;
@@ -71,10 +70,10 @@ public EzrSharpCompatibilityObjectInstance(
for (int i = 0; i < allProperties.Length; i++)
{
PropertyInfo property = allProperties[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(property))
+ if (!WrapMemberAttribute.ShouldBeWrapped(property))
continue;
- EzrSharpCompatibilityProperty propertyObject = new(property, Instance, Context, StartPosition, EndPosition);
+ EzrPropertyWrapper propertyObject = new(property, Instance, Context, StartPosition, EndPosition);
Context.Set(null, propertyObject.SharpMemberName, ReferencePool.Get(propertyObject, AccessMod.Constant));
}
@@ -82,10 +81,10 @@ public EzrSharpCompatibilityObjectInstance(
for (int i = 0; i < allFields.Length; i++)
{
FieldInfo field = allFields[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(field))
+ if (!WrapMemberAttribute.ShouldBeWrapped(field))
continue;
- EzrSharpCompatibilityField fieldObject = new(field, Instance, Context, StartPosition, EndPosition);
+ EzrFieldWrapper fieldObject = new(field, Instance, Context, StartPosition, EndPosition);
Context.Set(null, fieldObject.SharpMemberName, ReferencePool.Get(fieldObject, AccessMod.Constant));
}
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityType.cs b/src/Runtime/Types/Wrappers/EzrTypeWrapper.cs
similarity index 74%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityType.cs
rename to src/Runtime/Types/Wrappers/EzrTypeWrapper.cs
index 523670e..181f011 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityType.cs
+++ b/src/Runtime/Types/Wrappers/EzrTypeWrapper.cs
@@ -1,20 +1,17 @@
-using EzrSquared.Runtime.Types.Core.Errors;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+using EzrSquared.Runtime.Types.Wrappers.Members;
+using EzrSquared.Runtime.Types.Wrappers.Members.Methods;
using EzrSquared.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
+namespace EzrSquared.Runtime.Types.Wrappers;
///
/// Class to automatically wrap C# types so that they can be used in ezr².
///
-public class EzrSharpCompatibilityType : EzrSharpCompatibilityWrapper, IEzrObject
+public class EzrTypeWrapper : EzrWrapper, IEzrObject
{
///
public override string TypeName { get; protected internal set; } = "csharp type";
@@ -25,16 +22,16 @@ public class EzrSharpCompatibilityType : EzrSharpCompatibilityWrapper, IEz
///
/// The primary wrapped constructor for the type. May be .
///
- public readonly EzrSharpCompatibilityConstructor? PrimaryConstructor;
+ public readonly EzrConstructorWrapper? PrimaryConstructor;
///
- /// Creates a new .
+ /// Creates a new .
///
/// The type to wrap.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
- public EzrSharpCompatibilityType(
+ public EzrTypeWrapper(
[DynamicallyAccessedMembers(
DynamicallyAccessedMemberTypes.PublicFields
| DynamicallyAccessedMemberTypes.NonPublicFields
@@ -49,18 +46,18 @@ public EzrSharpCompatibilityType(
Context parentContext, Position startPosition, Position endPosition) : base(sharpType, null, parentContext, startPosition, endPosition)
{
Tag = $"{Tag}.{SharpMemberName}.{UIDProvider.Get()}";
- WrappedMemberAttribute.ValidateType(SharpMember, AutoWrapperAttribute is null);
+ WrapMemberAttribute.ValidateType(SharpMember, AutoWrapperAttribute is null);
MethodInfo[] allStaticMethods = sharpType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
Dictionary duplicateNames = new(allStaticMethods.Length);
for (int i = 0; i < allStaticMethods.Length; i++)
{
MethodInfo method = allStaticMethods[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(method))
+ if (!WrapMemberAttribute.ShouldBeWrapped(method))
continue;
- EzrSharpCompatibilityFunction methodObject = new(method, null, Context, StartPosition, EndPosition, skipValidation: true);
- if (!WrappedMemberAttribute.ValidateMethod(method, methodObject.AutoWrapperAttribute is null))
+ EzrMethodWrapper methodObject = new(method, null, Context, StartPosition, EndPosition, skipValidation: true);
+ if (!WrapMemberAttribute.ValidateMethod(method, methodObject.AutoWrapperAttribute is null))
continue;
string methodObjectName = methodObject.SharpMemberName;
@@ -79,10 +76,10 @@ public EzrSharpCompatibilityType(
for (int i = 0; i < allStaticProperties.Length; i++)
{
PropertyInfo property = allStaticProperties[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(property))
+ if (!WrapMemberAttribute.ShouldBeWrapped(property))
continue;
- EzrSharpCompatibilityProperty propertyObject = new(property, null, Context, StartPosition, EndPosition);
+ EzrPropertyWrapper propertyObject = new(property, null, Context, StartPosition, EndPosition);
Context.Set(null, propertyObject.SharpMemberName, ReferencePool.Get(propertyObject, AccessMod.Constant));
}
@@ -90,10 +87,10 @@ public EzrSharpCompatibilityType(
for (int i = 0; i < allStaticFields.Length; i++)
{
FieldInfo field = allStaticFields[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(field))
+ if (!WrapMemberAttribute.ShouldBeWrapped(field))
continue;
- EzrSharpCompatibilityField fieldObject = new(field, null, Context, StartPosition, EndPosition);
+ EzrFieldWrapper fieldObject = new(field, null, Context, StartPosition, EndPosition);
Context.Set(null, fieldObject.SharpMemberName, ReferencePool.Get(fieldObject, AccessMod.Constant));
}
@@ -102,11 +99,11 @@ public EzrSharpCompatibilityType(
for (int i = 0; i < publicConstructors.Length; i++)
{
ConstructorInfo constructor = publicConstructors[i];
- if (!WrappedMemberAttribute.ShouldBeWrapped(constructor))
+ if (!WrapMemberAttribute.ShouldBeWrapped(constructor))
continue;
- EzrSharpCompatibilityConstructor constructorObject = new(sharpType, constructor, Context, StartPosition, EndPosition, skipValidation: true);
- if (!WrappedMemberAttribute.ValidateMethod(constructor, constructorObject.AutoWrapperAttribute is null))
+ EzrConstructorWrapper constructorObject = new(sharpType, constructor, Context, StartPosition, EndPosition, skipValidation: true);
+ if (!WrapMemberAttribute.ValidateMethod(constructor, constructorObject.AutoWrapperAttribute is null))
continue;
if (constructor.GetCustomAttribute() is not null)
@@ -119,7 +116,7 @@ public EzrSharpCompatibilityType(
}
string name = definedConstructors == 0 ? "make" : $"make_{definedConstructors}";
- if (constructorObject.AutoWrapperAttribute is not WrappedMemberAttribute attr || string.IsNullOrEmpty(attr.Name))
+ if (constructorObject.AutoWrapperAttribute is not WrapMemberAttribute attr || string.IsNullOrEmpty(attr.Name))
definedConstructors++;
else
{
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityWrapper.cs b/src/Runtime/Types/Wrappers/EzrWrapper.cs
similarity index 94%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityWrapper.cs
rename to src/Runtime/Types/Wrappers/EzrWrapper.cs
index 68c7882..431f709 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/EzrSharpCompatibilityWrapper.cs
+++ b/src/Runtime/Types/Wrappers/EzrWrapper.cs
@@ -3,7 +3,6 @@
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
using EzrSquared.Runtime.Types.Core.Text;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
using System;
using System.Collections.Generic;
using System.Numerics;
@@ -11,7 +10,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
+namespace EzrSquared.Runtime.Types.Wrappers;
///
/// Parent class for all automatic wrappers which wrap existing C# objects and members so that they can be used in ezr².
@@ -19,10 +18,10 @@ namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers;
/// The type for the C# member being wrapped.
#if NET7_0_OR_GREATER
-public abstract partial class EzrSharpCompatibilityWrapper : EzrObject
+public abstract partial class EzrWrapper : EzrObject
where TMemberInfo : MemberInfo
#else
-public abstract class EzrSharpCompatibilityWrapper : EzrObject
+public abstract class EzrWrapper : EzrObject
where TMemberInfo : MemberInfo
#endif
{
@@ -38,9 +37,9 @@ public abstract class EzrSharpCompatibilityWrapper : EzrObject
public override string Tag { get; protected internal set; } = "ezrSquared.CSharpWrapper";
///
- /// The of the wrapped object, if defined.
+ /// The of the wrapped object, if defined.
///
- public readonly WrappedMemberAttribute? AutoWrapperAttribute;
+ public readonly WrapMemberAttribute? AutoWrapperAttribute;
///
/// The name of the wrapped member in snake_case.
@@ -58,17 +57,17 @@ public abstract class EzrSharpCompatibilityWrapper : EzrObject
public readonly object? Instance;
///
- /// Creates a new .
+ /// Creates a new .
///
/// Reflection info on the wrapped C# member.
/// The object which contains the wrapped member, if static.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
- public EzrSharpCompatibilityWrapper(TMemberInfo wrappedMember, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(parentContext, startPosition, endPosition)
+ public EzrWrapper(TMemberInfo wrappedMember, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(parentContext, startPosition, endPosition)
{
SharpMember = wrappedMember;
- AutoWrapperAttribute = wrappedMember.GetCustomAttribute();
+ AutoWrapperAttribute = wrappedMember.GetCustomAttribute();
SharpMemberName = !string.IsNullOrEmpty(AutoWrapperAttribute?.Name) ? AutoWrapperAttribute.Name : PascalToSnakeCase(wrappedMember.Name)!;
Instance = instance;
}
@@ -260,7 +259,7 @@ public EzrSharpCompatibilityWrapper(TMemberInfo wrappedMember, object? instance,
return HandleEzrArrayLikeToCSharp(value, targetType, result);
case TypeCode.Object when targetType == typeof(Task):
- if (value is EzrSharpCompatibilityObjectInstance taskWrapper && targetType.IsAssignableFrom(taskWrapper.SharpMember))
+ if (value is EzrObjectWrapper taskWrapper && targetType.IsAssignableFrom(taskWrapper.SharpMember))
return (Task)taskWrapper.Instance!;
return s_taskFromResultMethod.MakeGenericMethod(value.GetType()).Invoke(null, [value]);
@@ -281,7 +280,7 @@ public EzrSharpCompatibilityWrapper(TMemberInfo wrappedMember, object? instance,
break;
default:
- if (value is EzrSharpCompatibilityObjectInstance wrapper && wrapper.SharpMember == targetType)
+ if (value is EzrObjectWrapper wrapper && wrapper.SharpMember == targetType)
return wrapper.Instance;
result.Failure(new EzrUnexpectedTypeError($"Expected wrapped object of C# type \"{targetType.Name}\", but got object of type \"{value.TypeName}\"!", Context, value.StartPosition, value.EndPosition));
@@ -396,7 +395,7 @@ protected internal void CSharpToEzrObject(object? value, Type valueType, Runtime
result.Success(NewNothingConstant());
break;
default:
- result.Success(ReferencePool.Get(new EzrSharpCompatibilityObjectInstance(value, valueType, _executionContext, StartPosition, EndPosition), AccessMod.PrivateConstant));
+ result.Success(ReferencePool.Get(new EzrObjectWrapper(value, valueType, _executionContext, StartPosition, EndPosition), AccessMod.PrivateConstant));
break;
}
}
@@ -453,7 +452,7 @@ public override bool EvaluateBoolean(RuntimeResult result)
///
public override bool StrictEquals(IEzrObject other, RuntimeResult result)
{
- return other is EzrSharpCompatibilityWrapper otherWrapper
+ return other is EzrWrapper otherWrapper
&& otherWrapper.SharpMember == SharpMember
&& otherWrapper.Instance?.GetHashCode() == Instance?.GetHashCode()
&& other.HashTag == HashTag;
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityField.cs b/src/Runtime/Types/Wrappers/Members/EzrFieldWrapper.cs
similarity index 88%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityField.cs
rename to src/Runtime/Types/Wrappers/Members/EzrFieldWrapper.cs
index 14c8154..2d32b6e 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityField.cs
+++ b/src/Runtime/Types/Wrappers/Members/EzrFieldWrapper.cs
@@ -3,12 +3,12 @@
using System;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+namespace EzrSquared.Runtime.Types.Wrappers.Members;
///
/// Class to automatically wrap C# fields so that they can be used in ezr².
///
-public class EzrSharpCompatibilityField : EzrSharpCompatibilityWrapper
+public class EzrFieldWrapper : EzrWrapper
{
///
public override string TypeName { get; protected internal set; } = "csharp field";
@@ -17,14 +17,14 @@ public class EzrSharpCompatibilityField : EzrSharpCompatibilityWrapper
- /// Creates a new .
+ /// Creates a new .
///
/// The field to wrap.
/// The object which contains the field, if static.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
- public EzrSharpCompatibilityField(FieldInfo sharpField, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(sharpField, instance, parentContext, startPosition, endPosition)
+ public EzrFieldWrapper(FieldInfo sharpField, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(sharpField, instance, parentContext, startPosition, endPosition)
{
Tag = $"{Tag}.{SharpMemberName}.{UIDProvider.Get()}";
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityProperty.cs b/src/Runtime/Types/Wrappers/Members/EzrPropertyWrapper.cs
similarity index 88%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityProperty.cs
rename to src/Runtime/Types/Wrappers/Members/EzrPropertyWrapper.cs
index 7b73173..bdce4a5 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/EzrSharpCompatibilityProperty.cs
+++ b/src/Runtime/Types/Wrappers/Members/EzrPropertyWrapper.cs
@@ -3,12 +3,12 @@
using System;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers;
+namespace EzrSquared.Runtime.Types.Wrappers.Members;
///
/// Class to automatically wrap C# properties so that they can be used in ezr².
///
-public class EzrSharpCompatibilityProperty : EzrSharpCompatibilityWrapper
+public class EzrPropertyWrapper : EzrWrapper
{
///
public override string TypeName { get; protected internal set; } = "csharp property";
@@ -17,14 +17,14 @@ public class EzrSharpCompatibilityProperty : EzrSharpCompatibilityWrapper
- /// Creates a new .
+ /// Creates a new .
///
/// The property to wrap.
/// The object which contains the property, if static.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
- public EzrSharpCompatibilityProperty(PropertyInfo sharpProperty, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(sharpProperty, instance, parentContext, startPosition, endPosition)
+ public EzrPropertyWrapper(PropertyInfo sharpProperty, object? instance, Context parentContext, Position startPosition, Position endPosition) : base(sharpProperty, instance, parentContext, startPosition, endPosition)
{
Tag = $"{Tag}.{SharpMemberName}.{UIDProvider.Get()}";
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityConstructor.cs b/src/Runtime/Types/Wrappers/Members/Methods/EzrConstructorWrapper.cs
similarity index 88%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityConstructor.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/EzrConstructorWrapper.cs
index ebbb40d..e583005 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityConstructor.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/EzrConstructorWrapper.cs
@@ -1,16 +1,15 @@
using EzrSquared.Runtime.Types.Core.Errors;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Text;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Class to automatically wrap C# constructors so that they can be used in ezr².
///
-public class EzrSharpCompatibilityConstructor : EzrSharpCompatibilityExecutable
+public class EzrConstructorWrapper : EzrMethodBaseWrapper
{
///
/// This C# constructor's class.
@@ -30,7 +29,7 @@ public class EzrSharpCompatibilityConstructor : EzrSharpCompatibilityExecutable<
public readonly string ConstructingTypeName;
///
- /// Creates a new .
+ /// Creates a new .
///
/// This C# constructor's class.
/// The constructor to wrap.
@@ -38,7 +37,7 @@ public class EzrSharpCompatibilityConstructor : EzrSharpCompatibilityExecutable<
/// The starting position of the object.
/// The ending position of the object.
/// Skip method signature validation?
- public EzrSharpCompatibilityConstructor(
+ public EzrConstructorWrapper(
[DynamicallyAccessedMembers(
DynamicallyAccessedMemberTypes.PublicMethods
| DynamicallyAccessedMemberTypes.NonPublicMethods
@@ -52,7 +51,7 @@ public EzrSharpCompatibilityConstructor(
{
ConstructingType = constructingType;
- WrappedMemberAttribute? autoWrapperAttribute = constructingType.GetCustomAttribute();
+ WrapMemberAttribute? autoWrapperAttribute = constructingType.GetCustomAttribute();
ConstructingTypeName = !string.IsNullOrEmpty(autoWrapperAttribute?.Name) ? autoWrapperAttribute.Name : PascalToSnakeCase(constructingType.Name)!;
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityExecutable.cs b/src/Runtime/Types/Wrappers/Members/Methods/EzrMethodBaseWrapper.cs
similarity index 86%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityExecutable.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/EzrMethodBaseWrapper.cs
index 1bc6041..437ae53 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityExecutable.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/EzrMethodBaseWrapper.cs
@@ -1,17 +1,15 @@
using EzrSquared.Runtime.Types.Core.Errors;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
-using EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
using EzrSquared.Util;
using System;
using System.Collections.Generic;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Base class for all automatic wrappers which wrap C# executables so that they can be used in ezr².
///
-public abstract class EzrSharpCompatibilityExecutable : EzrSharpCompatibilityWrapper
+public abstract class EzrMethodBaseWrapper : EzrWrapper
where TMethodBase : MethodBase
{
///
@@ -33,7 +31,7 @@ public abstract class EzrSharpCompatibilityExecutable : EzrSharpCom
///
/// The attributes of the executable's runtime-provided parameters.
///
- public readonly RuntimeAttribute[] RuntimeProvidedParameters;
+ public readonly FeatureParameterAttribute[] RuntimeProvidedParameters;
///
/// Does this executable accept extra keyword arguments?
@@ -46,7 +44,7 @@ public abstract class EzrSharpCompatibilityExecutable : EzrSharpCom
public readonly bool AcceptsExtraPositionalArguments;
///
- /// Creates a new .
+ /// Creates a new .
///
/// The executable to wrap.
/// The object which contains the executable, if static.
@@ -54,29 +52,29 @@ public abstract class EzrSharpCompatibilityExecutable : EzrSharpCom
/// The starting position of the object.
/// The ending position of the object.
/// Skip method signature validation?
- public EzrSharpCompatibilityExecutable(TMethodBase sharpMethodBase, object? instance, Context parentContext, Position startPosition, Position endPosition, bool skipValidation) : base(sharpMethodBase, instance, parentContext, startPosition, endPosition)
+ public EzrMethodBaseWrapper(TMethodBase sharpMethodBase, object? instance, Context parentContext, Position startPosition, Position endPosition, bool skipValidation) : base(sharpMethodBase, instance, parentContext, startPosition, endPosition)
{
Tag = $"{Tag}.{SharpMemberName}.{UIDProvider.Get()}";
if (!skipValidation)
- WrappedMemberAttribute.ValidateMethod(SharpMember, AutoWrapperAttribute is null);
+ WrapMemberAttribute.ValidateMethod(SharpMember, AutoWrapperAttribute is null);
ParameterInfo[] allParameters = SharpMember.GetParameters();
List<(ParameterInfo, bool)> exposedParameters = new(allParameters.Length);
List exposedParameterNames = new(allParameters.Length);
- Lazy> runtimeProvidedParameters = new();
+ Lazy> runtimeProvidedParameters = new();
for (int i = 0; i < allParameters.Length; i++)
{
ParameterInfo parameterInfo = allParameters[i];
- ExposeAttribute? autoWrapperAttribute = parameterInfo.GetCustomAttribute();
- RuntimeAttribute? runtimeParamAttribute = parameterInfo.GetCustomAttribute();
+ ParameterAttribute? autoWrapperAttribute = parameterInfo.GetCustomAttribute();
+ FeatureParameterAttribute? runtimeParamAttribute = parameterInfo.GetCustomAttribute();
if (autoWrapperAttribute is not null && runtimeParamAttribute is not null)
- throw new ArgumentException($"Method \"{SharpMember.Name}\" cannot have a parameter with both {nameof(ExposeAttribute)} and {nameof(RuntimeAttribute)} attributes ({parameterInfo.Name})!", nameof(sharpMethodBase));
+ throw new ArgumentException($"Method \"{SharpMember.Name}\" cannot have a parameter with both {nameof(ParameterAttribute)} and {nameof(FeatureParameterAttribute)} attributes ({parameterInfo.Name})!", nameof(sharpMethodBase));
else if (runtimeParamAttribute is null && runtimeProvidedParameters.IsValueCreated)
- throw new ArgumentException($"Method \"{SharpMember.Name}\" cannot have a normal parameter after {nameof(RuntimeAttribute)}-attributed parameters ({parameterInfo.Name})!", nameof(sharpMethodBase));
+ throw new ArgumentException($"Method \"{SharpMember.Name}\" cannot have a normal parameter after {nameof(FeatureParameterAttribute)}-attributed parameters ({parameterInfo.Name})!", nameof(sharpMethodBase));
if (runtimeParamAttribute is null)
{
@@ -175,7 +173,7 @@ public EzrSharpCompatibilityExecutable(TMethodBase sharpMethodBase, object? inst
ReferencePool.TryRelease(argumentReference);
continue;
}
-
+
if (allPositionalArgumentsFilled)
{
result.Failure(new EzrUnexpectedArgumentError("Did not expect any more unnamed arguments!", _executionContext, argumentObject.StartPosition, argumentObject.EndPosition));
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityFunction.cs b/src/Runtime/Types/Wrappers/Members/Methods/EzrMethodWrapper.cs
similarity index 82%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityFunction.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/EzrMethodWrapper.cs
index 7b8b20f..ec803e5 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/EzrSharpCompatibilityFunction.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/EzrMethodWrapper.cs
@@ -3,7 +3,7 @@
using System.Reflection;
using System.Text;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Class to automatically wrap C# methods so that they can be used in ezr².
@@ -14,7 +14,7 @@ namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.E
/// The starting position of the object.
/// The ending position of the object.
/// Skip method signature validation?
-public class EzrSharpCompatibilityFunction(MethodInfo sharpFunction, object? instance, Context parentContext, Position startPosition, Position endPosition, bool skipValidation = false) : EzrSharpCompatibilityExecutable(sharpFunction, instance, parentContext, startPosition, endPosition, skipValidation)
+public class EzrMethodWrapper(MethodInfo sharpFunction, object? instance, Context parentContext, Position startPosition, Position endPosition, bool skipValidation = false) : EzrMethodBaseWrapper(sharpFunction, instance, parentContext, startPosition, endPosition, skipValidation)
{
///
public override string TypeName { get; protected internal set; } = "csharp function";
@@ -23,14 +23,14 @@ public class EzrSharpCompatibilityFunction(MethodInfo sharpFunction, object? ins
public override string Tag { get; protected internal set; } = "ezrSquared.CSharpFunction";
///
- /// Creates a new from a delegate.
+ /// Creates a new from a delegate.
///
/// The method to wrap.
/// The context in which this object was created.
/// The starting position of the object.
/// The ending position of the object.
/// Skip method signature validation?
- public EzrSharpCompatibilityFunction(Delegate sharpFunction, Context parentContext, Position startPosition, Position endPosition, bool skipValidation = false)
+ public EzrMethodWrapper(Delegate sharpFunction, Context parentContext, Position startPosition, Position endPosition, bool skipValidation = false)
: this(sharpFunction.Method, sharpFunction.Target, parentContext, startPosition, endPosition, skipValidation)
{ }
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/Feature.cs b/src/Runtime/Types/Wrappers/Members/Methods/Feature.cs
similarity index 88%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/Feature.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/Feature.cs
index 450ae6b..557448b 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/Feature.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/Feature.cs
@@ -1,7 +1,7 @@
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
-/// The metadata for .
+/// The metadata for .
///
public enum Feature
{
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/RuntimeAttribute.cs b/src/Runtime/Types/Wrappers/Members/Methods/FeatureParameterAttribute.cs
similarity index 78%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/RuntimeAttribute.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/FeatureParameterAttribute.cs
index b0fd894..7ecd25d 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/RuntimeAttribute.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/FeatureParameterAttribute.cs
@@ -3,7 +3,7 @@
using System;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Attribute for wrapped C# methods that need to enable features or request data from the ezr² runtime.
@@ -15,7 +15,7 @@ namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.E
/// type.
///
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
-public class RuntimeAttribute(Feature type) : Attribute
+public class FeatureParameterAttribute(Feature type) : Attribute
{
///
/// The type of the parameter.
@@ -31,22 +31,22 @@ public void ValidateParameter(ParameterInfo parameter)
switch (Type)
{
case Feature.KeywordArguments when !parameter.ParameterType.IsAssignableFrom(typeof(ExtraKeywordArguments)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(ExtraKeywordArguments)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(ExtraKeywordArguments)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
case Feature.PositionalArguments when !parameter.ParameterType.IsAssignableFrom(typeof(ExtraPositionalArguments)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(ExtraPositionalArguments)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(ExtraPositionalArguments)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
case Feature.CallerRef when !parameter.ParameterType.IsAssignableFrom(typeof(IEzrObject)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(IEzrObject)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(IEzrObject)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
case Feature.ExecutionRef when !parameter.ParameterType.IsAssignableFrom(typeof(Context)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(Context)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(Context)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
case Feature.InterpreterRef when !parameter.ParameterType.IsAssignableFrom(typeof(Interpreter)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(Interpreter)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(Interpreter)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
case Feature.ResultRef when !parameter.ParameterType.IsAssignableFrom(typeof(RuntimeResult)):
- throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(RuntimeResult)} as it has the {nameof(RuntimeAttribute)} attribute, with type {Type}.", nameof(parameter));
+ throw new ArgumentException($"Parameter \"{parameter.Name}\" must be assignable from type {nameof(RuntimeResult)} as it has the {nameof(FeatureParameterAttribute)} attribute, with type {Type}.", nameof(parameter));
}
}
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/ExposeAttribute.cs b/src/Runtime/Types/Wrappers/Members/Methods/ParameterAttribute.cs
similarity index 70%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/ExposeAttribute.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/ParameterAttribute.cs
index cca7826..d0b290d 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/ExposeAttribute.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/ParameterAttribute.cs
@@ -1,6 +1,6 @@
using System;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Attribute to expose additonal data about the wrapped C# method parameter.
@@ -8,7 +8,7 @@ namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.E
/// The ezr² name for the parameter.
/// Is the parameter optional?
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
-public class ExposeAttribute(string name, bool optional) : Attribute
+public class ParameterAttribute(string name, bool optional) : Attribute
{
///
/// The ezr² name for the parameter.
@@ -21,8 +21,8 @@ public class ExposeAttribute(string name, bool optional) : Attribute
public readonly bool Optional = optional;
/// The ezr² name for the parameter.
- public ExposeAttribute(string name) : this(name, false) { }
+ public ParameterAttribute(string name) : this(name, false) { }
/// Is the parameter optional?
- public ExposeAttribute(bool optional) : this("", optional) { }
+ public ParameterAttribute(bool optional) : this("", optional) { }
}
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/PrimaryConstructorAttribute.cs b/src/Runtime/Types/Wrappers/Members/Methods/PrimaryConstructorAttribute.cs
similarity index 70%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/PrimaryConstructorAttribute.cs
rename to src/Runtime/Types/Wrappers/Members/Methods/PrimaryConstructorAttribute.cs
index 4ad4b0e..dc78629 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/ObjectMembers/Executables/Attributes/PrimaryConstructorAttribute.cs
+++ b/src/Runtime/Types/Wrappers/Members/Methods/PrimaryConstructorAttribute.cs
@@ -1,6 +1,6 @@
using System;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.ObjectMembers.Executables.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers.Members.Methods;
///
/// Attribute that declares a primary constructor.
diff --git a/src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/WrappedMemberAttribute.cs b/src/Runtime/Types/Wrappers/WrapMemberAttribute.cs
similarity index 85%
rename from src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/WrappedMemberAttribute.cs
rename to src/Runtime/Types/Wrappers/WrapMemberAttribute.cs
index 815d62d..6f0d89a 100644
--- a/src/Runtime/Types/CSharpWrappers/CompatWrappers/Attributes/WrappedMemberAttribute.cs
+++ b/src/Runtime/Types/Wrappers/WrapMemberAttribute.cs
@@ -1,13 +1,13 @@
using System;
using System.Reflection;
-namespace EzrSquared.Runtime.Types.CSharpWrappers.CompatWrappers.Attributes;
+namespace EzrSquared.Runtime.Types.Wrappers;
///
/// Attribute for C# types and members to be automatically wrapped from C# types into ezr² types.
///
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
-public class WrappedMemberAttribute : Attribute
+public class WrapMemberAttribute : Attribute
{
///
/// The ezr² name for the member.
@@ -25,12 +25,12 @@ public class WrappedMemberAttribute : Attribute
public readonly bool IsWriteOnly;
///
- /// Creates a new .
+ /// Creates a new .
///
/// Is the member read-only? Only for properties and fields.
/// Is the member write-only? Only for properties and fields.
/// Thrown if both and are set to .
- public WrappedMemberAttribute(bool isReadOnly = false, bool isWriteOnly = false)
+ public WrapMemberAttribute(bool isReadOnly = false, bool isWriteOnly = false)
{
IsReadOnly = isReadOnly;
IsWriteOnly = isWriteOnly;
@@ -40,12 +40,12 @@ public WrappedMemberAttribute(bool isReadOnly = false, bool isWriteOnly = false)
}
///
- /// Creates a new .
+ /// Creates a new .
///
/// The ezr² name for the member.
/// Is the member read-only? Only for properties and fields.
/// Is the member write-only? Only for properties and fields.
- public WrappedMemberAttribute(string name, bool isReadOnly = false, bool isWriteOnly = false) : this(isReadOnly, isWriteOnly)
+ public WrapMemberAttribute(string name, bool isReadOnly = false, bool isWriteOnly = false) : this(isReadOnly, isWriteOnly)
{
Name = name;
}
@@ -60,7 +60,7 @@ public WrappedMemberAttribute(string name, bool isReadOnly = false, bool isWrite
public static bool ValidateType(Type type, bool dontThrow = false)
{
if (type.IsAbstract || type.IsGenericTypeDefinition)
- return dontThrow ? false : throw new ArgumentException($"The \"{nameof(WrappedMemberAttribute)}\" attribute does not support abstract/generic type \"{type.Name}\".", nameof(type));
+ return dontThrow ? false : throw new ArgumentException($"The \"{nameof(WrapMemberAttribute)}\" attribute does not support abstract/generic type \"{type.Name}\".", nameof(type));
return true;
}
@@ -75,7 +75,7 @@ public static bool ValidateType(Type type, bool dontThrow = false)
public static bool ValidateMethod(MethodBase methodBase, bool dontThrow = false)
{
if (methodBase.IsGenericMethodDefinition || methodBase.ContainsGenericParameters)
- return dontThrow ? false : throw new ArgumentException($"The \"{nameof(WrappedMemberAttribute)}\" attribute does not support generic method/constructor \"{methodBase.Name}\".", nameof(methodBase));
+ return dontThrow ? false : throw new ArgumentException($"The \"{nameof(WrapMemberAttribute)}\" attribute does not support generic method/constructor \"{methodBase.Name}\".", nameof(methodBase));
return true;
}
@@ -87,7 +87,7 @@ public static bool ValidateMethod(MethodBase methodBase, bool dontThrow = false)
/// if yes, otherwise.
public static bool ShouldBeWrapped(MemberInfo member)
{
- return member.GetCustomAttribute() is null && (GetIsPublic(member) || member.GetCustomAttribute() is not null);
+ return member.GetCustomAttribute() is null && (GetIsPublic(member) || member.GetCustomAttribute() is not null);
}
///