示例#1
0
        /// <summary>
        /// Create a dependant variable : it's a stored variable in a specific use template (implemented for a specific language)
        /// the variable has a data type fixed. If it's not the same, the variable value is converted into the good data type
        /// if needed, this variable makes a mutable parameter
        /// </summary>
        /// <param name="comp">compiler object</param>
        /// <param name="converter">language converter</param>
        /// <param name="proc">process</param>
        /// <param name="ut">UseTemplate object</param>
        /// <param name="valueName">name of the variable</param>
        /// <param name="desiredDataType">fixed data type</param>
        /// <returns>the name of the variable (it comes to non computable)</returns>
        public static string CreateDependantVariable(ICompilateur comp, ICodeConverter converter, IProcessInstance proc, UseTemplate ut, string valueName, EnumDataType desiredDataType)
        {
            string var = valueName;

            if (ut.Parameters.ContainsKey(valueName))
            {
                var = Helper.ReplaceStringParameter(ut, valueName);
            }
            // important : la variable n'est plus calculable
            IData newVar = Helper.ConvertNonComputableVariableType(proc, converter, var, desiredDataType);

            comp.UpdateParameters(converter, proc, newVar.Name, true);
            return(converter.ReturnVarName(newVar));
        }