Cosmos/source/Cosmos.IL2CPU/IL/Constrained.cs
José Pedro fc9a412652 Compiler fixes.
Moved XSharp implementation to XSharp.Common.
2017-01-08 20:55:52 +00:00

37 lines
1,010 B
C#

using System;
using System.Reflection;
using Cosmos.IL2CPU.ILOpCodes;
using XSharp.Compiler;
namespace Cosmos.IL2CPU.X86.IL
{
[OpCode(ILOpCode.Code.Constrained)]
public class Constrained : ILOp
{
public Constrained(Assembler.Assembler aAsmblr) : base(aAsmblr)
{
}
public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
{
var xOpType = aOpCode as OpType;
DoExecute(Assembler, aMethod, aOpCode, xOpType, DebugEnabled);
}
private void DoExecute(Assembler.Assembler assembler, MethodInfo aMethod, ILOpCode aOpCode, OpType aTargetType, bool debugEnabled)
{
var xType = aTargetType.Value;
XS.Comment($"Type = {aTargetType.Value}");
if (xType.GetTypeInfo().BaseType == typeof(ValueType))
{
}
else if (xType.GetTypeInfo().BaseType == typeof(object))
{
throw new NotImplementedException($"Constrained not implemented for {aTargetType.Value}");
}
}
}
}