public FuncInfo CreateCopy(ScriptFile sf) { FuncInfo f = new FuncInfo(sf, Name, Access, Summary, Returns, Self, Example, null); f.HasOutParams = HasOutParams; f.OptParamStartIndex = OptParamStartIndex; f.Parameters = Parameters; return(f); }
/// <summary> /// Nájde funkciu v globálnych súboroch. /// </summary> /// <param name="name"></param> /// <returns></returns> public FuncInfo FindGlobalsFunc(string name) { FuncInfo func = null; foreach (ScriptFile globalFile in this.SF.Manager.GetGlobalSFs()) { func = globalFile.SI.FindLocalFunc(name); if (func != null) { break; } } return(func); }
/// <summary> /// Nájde funkciu v includovaných súboroch. /// </summary> /// <param name="name"></param> /// <returns></returns> public FuncInfo FindIncludesFunc(string name) { FuncInfo func = null; foreach (IncludeInfo includeInfo in this.Includes) { if (includeInfo.SF.SI == null) { continue; } func = includeInfo.SF.SI.FindLocalFunc(name); if (func != null) { break; } } return(func); }
/// <summary> /// Nájde funkciu na všetkých dostupných miestach. /// </summary> /// <param name="name"></param> /// <returns></returns> public FuncInfo FindFunc(string name) { FuncInfo func = null; // search in local file... func = FindLocalFunc(name); if (func != null) { return(func); } // search in includes... func = FindIncludesFunc(name); if (func != null) { return(func); } // search in global files... func = FindGlobalsFunc(name); return(func); }
public void AddFunction(FuncInfo funcInfo) { Functions.Add(funcInfo); localMembers = null; }
private static void ReadFunc(ScriptInfo SI, XmlElement funcElem) { string name = string.Empty; MemberAccess access = MemberAccess.Public; string returns = string.Empty; string summary = string.Empty; string self = string.Empty; string example = string.Empty; List <FuncParamInfo> parameters = new List <FuncParamInfo>(); name = funcElem.GetAttribute("name"); access = (MemberAccess)Enum.Parse(typeof(MemberAccess), funcElem.GetAttribute("access")); foreach (XmlNode curNode in funcElem) { if (!(curNode is XmlElement)) { continue; } XmlElement curElem = (XmlElement)curNode; if (curElem.Name == "summary") { summary = curElem.InnerText; } else if (curElem.Name == "returns") { returns = curElem.InnerText; } else if (curElem.Name == "self") { self = curElem.InnerText; } else if (curElem.Name == "example") { example = curElem.InnerText; } else if (curElem.Name == "param") { string isOut = curElem.GetAttribute("out"); string isOpt = curElem.GetAttribute("opt"); bool isOutBool = String.IsNullOrEmpty(isOut) ? false : Boolean.Parse(isOut); bool isOptBool = String.IsNullOrEmpty(isOpt) ? false : Boolean.Parse(isOpt); parameters.Add(new FuncParamInfo(curElem.GetAttribute("name"), curElem.InnerText, isOutBool, isOptBool)); } else { throw new XmlException("Unknown ScriptInfo func node '" + curElem.Name + "'"); } } FuncInfo funcInfo = new FuncInfo(SI.SF, name, access, summary, returns, self, example, null); foreach (FuncParamInfo param in parameters) { funcInfo.AddParam(param); } SI.AddFunction(funcInfo); }
/// <summary> /// Vytvorí referenciu priamo zo SC. /// </summary> /// <param name="funcInfo"></param> /// <param name="charIndex"></param> /// <param name="charLength"></param> /// <param name="isCall">Volá sa funkcia alebo sa len získava jej adresa?</param> public FuncRefInfo(ScriptFile sf, FuncInfo funcInfo, int charIndex, int charLength, string codePart, bool isCall) : this(sf, charIndex, charLength, codePart, isCall) { this._definition = funcInfo; }