Esempio n. 1
0
        public override void Init(AstContext context, ParseTreeNode parseNode)
        {
            // ___("ldc.r4")
            var ldcr4Children = AstChildren.Empty()
                                .Add("ldc.r4");

            if (ldcr4Children.PopulateWith(parseNode))
            {
                Instruction = new LoadConstR4Instruction();

                return;
            }

            // ___("ldc.r8")
            var ldcr8Children = AstChildren.Empty()
                                .Add("ldc.r8");

            if (ldcr8Children.PopulateWith(parseNode))
            {
                Instruction = new LoadConstR8Instruction();

                return;
            }

            throw new InitAstNodeException(nameof(INSTR_RAstNode));
        }
Esempio n. 2
0
 public void VisitInstructionR(CilInstructionR instruction)
 {
     if (instruction is LoadConstR4Instruction loadConstR4Instruction)
     {
         VisitLoadConstR4Instruction(loadConstR4Instruction);
     }
     else if (instruction is LoadConstR8Instruction loadConstR8Instruction)
     {
         VisitLoadConstR8Instruction(loadConstR8Instruction);
     }
     else
     {
         throw new ArgumentException($"CIL instruction i cannot be recognized: '{instruction.ToString()}'.");
     }
 }