protected override void VisitLoadTokenInstruction(LoadTokenInstruction instruction)
        {
            if (instruction.TypeSpec != null)
            {
                if (_program.IsExternalType(instruction.TypeSpec.ClassName))
                {
                    var type   = ReflectionHelper.GetExternalType(instruction.TypeSpec.ClassName);
                    var result = new CilValueExternal(type.TypeHandle);

                    ControlState.EvaluationStack.PushValue(result);
                    ControlState.MoveToNextInstruction();
                }
                else
                {
                    var @class        = _program.Classes.Single(c => c.Name.ToString() == instruction.TypeSpec.ClassName.ToString());
                    var runtimeType   = @class.BuildRuntimeType(_program, ManagedMemory);
                    var runtimeHandle = runtimeType.TypeHandle;
                    var result        = new CilValueExternal(runtimeHandle);

                    ControlState.EvaluationStack.PushValue(result);
                    ControlState.MoveToNextInstruction();
                }
            }
            else if (!string.IsNullOrEmpty(instruction.FieldId))
            {
                if (_program.IsExternalType(instruction.FieldTypeSpec.ClassName))
                {
                    throw new System.NotImplementedException();
                }
                else
                {
                    var @class      = _program.AllClasses.Single(c => c.Name.ToString() == instruction.FieldTypeSpec.ClassName.ToString());
                    var runtimeType = @class.BuildRuntimeType(_program, ManagedMemory);

                    throw new System.NotImplementedException();

                    var runtimeHandle = runtimeType.TypeHandle;
                    var result        = new CilValueExternal(runtimeHandle);

                    ControlState.EvaluationStack.PushValue(result);
                    ControlState.MoveToNextInstruction();
                }
            }
            else
            {
                throw new System.NotImplementedException();
            }
        }
        public override CILInstructionTok BuildNode(ParseTreeNode node)
        {
            var instrTokHeadParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.instr_tok_head);
            var instrTokParseTreeNode     = instrTokHeadParseTreeNode.GetFirstChildWithGrammarName(GrammarNames.INSTR_TOK);

            CILInstructionTok result = null;

            var ldtokenParseTreeNode = instrTokParseTreeNode.GetFirstChildWithGrammarName(GrammarNames.keyword_ldtoken);

            if (ldtokenParseTreeNode != null)
            {
                result = new LoadTokenInstruction();
            }

            if (result != null)
            {
                var ownerTypeParseTreeNode = node.GetFirstChildWithGrammarName(GrammarNames.ownerType);
                result.OwnerType = OwnerTypeParseTreeNodeHelper.GetValue(ownerTypeParseTreeNode);

                return(result);
            }

            throw new NotImplementedException();
        }
Esempio n. 3
0
 public override void Visit(LoadTokenInstruction instruction)
 {
     instruction.Result.Type = Types.Instance.TokenType(instruction.Token);
 }
Esempio n. 4
0
 public virtual void Visit(LoadTokenInstruction instruction)
 {
 }
Esempio n. 5
0
 public virtual void Visit(LoadTokenInstruction instruction)
 {
     Default(instruction);
 }
Esempio n. 6
0
 protected abstract void VisitLoadTokenInstruction(LoadTokenInstruction instruction);