Example #1
0
        public void IsInst(Type operand)
        {
            //TODO: Fix this, we need to actually compare type ids here ... at runtime we cannot tell what has been passed

            var valueToCast = _evaluator.Pop();
            var assigned    = SetNewVReg();

            assigned.FixedType = new TypeDescription(typeof(bool));
            var casting = new IsInstance
            {
                AssignedTo = assigned,
                Right      = valueToCast,
                CastTo     = operand
            };

            AddOperation(casting);
        }
Example #2
0
        public void GenerateInstructionCode(IsInstance isInstance, CodeOutput sb, ClosureEntities crRuntime)
        {
            AddToRuntime(crRuntime);
            //Needs improvement, how do i get the correct typeid at this point ? we cant just use zero :P
            //This is a stupid hack as usedtypes can probably change as closure is computed

            crRuntime.AddType(isInstance.CastTo);
            var usedTypes = crRuntime.MappedTypes.Values.ToList();
            var typeTable = new TypeDescriptionTable(usedTypes, crRuntime);

            TypesToCast.Add(isInstance.CastTo);
            sb
            .AppendFormat("{0} = IsInstanceOf({1}, {2});",
                          isInstance.AssignedTo.Name,
                          typeTable.GetTypeId(isInstance.CastTo),
                          isInstance.Right.Name + "->_typeId"
                          );
        }
Example #3
0
 public IsDelegateResponse(IsInstance @is, string value)
 {
     Is    = @is;
     Value = value;
 }
 public IsDelegateResponse(IsInstance @is, string value)
 {
     Is = @is;
     Value = value;
 }
Example #5
0
 static Is()
 {
     IsInstance = new IsInstance();
 }
Example #6
0
 static Is()
 {
     IsInstance = new IsInstance();
 }
 private static void HandleIsInstance(IsInstance operation, StringBuilder bodySb, ClosureEntities crRuntime)
 {
     LinkingData.Instance.IsInstTable.GenerateInstructionCode(operation, bodySb, crRuntime);
 }
 static void HandleIsInstance(IsInstance operation, CodeOutput bodySb, ClosureEntities crRuntime)
 {
     LinkingData.Instance.IsInstTable.GenerateInstructionCode(operation, bodySb, crRuntime);
 }