Exemplo n.º 1
0
        public static InstructionBase NewLogicalInstruction(Type type, List <Value> parameters,
                                                            out InstructionBase?pairedInstruction)
        {
            var instruction = NewInstruction(type, parameters);

            pairedInstruction = null;
            switch (true)
            {
            case var _ when type == typeof(BranchAlways):
            case var _ when type == typeof(BranchIfTrue):
                var logicalBranch = new LogicalBranch(instruction, _getName);
                pairedInstruction = logicalBranch.Destination;
                return(logicalBranch);

            case var _ when type == typeof(DefineFunction):
            case var _ when type == typeof(DefineFunction2):
                var logicalDefineFunction = new LogicalDefineFunction(instruction);
                pairedInstruction = logicalDefineFunction.CreateEndOfFunction();
                return(logicalDefineFunction);
            }

            return(instruction);
        }
Exemplo n.º 2
0
 public LogicalDestination(LogicalBranch logicalBranch, string labelName)
 {
     Parameters    = new List <Value>();
     LogicalBranch = logicalBranch;
     Name          = labelName;
 }