public ConstantBlock(DTD.Entity.vCodes.Variable variable)
 {
     InitializeComponent();
     Constant = new Constant {
         VType = Enums.VType.Constant
     };
     variableType = variable.Type;
 }
Esempio n. 2
0
        private void ParseInstruction(TypedvCodes typedvCodes)
        {
            if (typedvCodes == null)
            {
                return;
            }
            if (typedvCodes.VType == Enums.VType.Function)
            {
                DTD.Entity.vCodes.Function function = (DTD.Entity.vCodes.Function)typedvCodes;
                AssignmentString += function.Name + "(";
                foreach (var var in function.Parameters)
                {
                    AssignmentString += var.Type + " " + var.Name + ",";
                }
                if (function.Parameters.Count > 0)
                {
                    AssignmentString = AssignmentString.Remove(AssignmentString.Length - 1);
                }

                AssignmentString += ")";
            }
            else if (typedvCodes.VType == Enums.VType.Variable)
            {
                DTD.Entity.vCodes.Variable variable = (DTD.Entity.vCodes.Variable)typedvCodes;

                AssignmentString += variable.Name;
                if (variable.IsArray)
                {
                    AssignmentString += "[" + variable.Row + "]";
                    if (variable.ArrayType == "2D")
                    {
                        AssignmentString += "[" + variable.Column + "]";
                    }
                }
            }
            else if (typedvCodes.VType == Enums.VType.Constant)
            {
                Constant constant = (Constant)typedvCodes;
                AssignmentString += constant.Value;
            }
        }