public static InitialValue GetDefaultValue(this IVariable variable) { var metaData = variable.GetMetadata(); if (metaData != null) { return(metaData.DefaultValue); } return(null); }
private void SetMetadata(IVariable variable) { if (variable.StructType != -1 && variable.DataType.IsFunction()) { var metaData = variable.GetMetadata(); if (metaData == null) { metaData = ainFile.MetadataFile.Metadata.GetOrAddNew(variable); metaData.FuncTypeIndex = variable.StructType; } variable.StructType = -1; } }
/// <summary> /// Returns the alternative name for this variable from metadata, or from the AlternativeNames dictionary. If none is found, returns the original variable name. /// </summary> /// <param name="variable">The variable to find the metadata object for</param> /// <returns>The alternative name from metadata, the AlternativeNames dictionary, or the original name</returns> public static string GetAlternativeName(this IVariable variable) { var ainFile = variable.Root; string variableName = variable.Name; var metaData = variable.GetMetadata(); if (metaData != null && metaData.ReplacementName != null) { return(metaData.ReplacementName); } else if (ainFile != null && ainFile.AlternativeNames.ContainsKey(variableName)) { return(ainFile.AlternativeNames[variableName]); } return(variableName); }