//public bool NameEqual(string name) //{ // int index = name.LastIndexOf('.'); // if (index == -1) // return this.Equal(new Declaration(name)); // else // return this.Equal(new Declaration(name.Substring(0, index), new Declaration(name.Substring(index + 1)))); //} //public void AddField(Declaration field) //{ // Fields.Add(field); //} public void AddSibling(Declaration sibling) { Siblings.Add(sibling); }
private void AddDeclarationsForTableField(LuaBlockNode block, LuaModel model, Declaration namespaces, LuaNode expr) { if (expr is LuaTableNode) { foreach (var field in ((LuaTableNode)expr).FieldList) { AddDeclarationsForTableField(block, model, namespaces, field); } } if (expr is LuaField && ((LuaField)expr).Name != null) { LuaNode variable = ((LuaField)expr).Name; Declaration declaration = new Declaration(variable.AsString, String.Empty, model.FilePath, new ScopeSpan(variable.Span.EndPosition, variable.EndLine, block.Span.EndPosition, block.EndLine), namespaces); block.Locals.Add(declaration); AddDeclarationsForTableField(block, model, declaration, ((LuaField)expr).Expression); } }
public Declaration(string name, string description, string filepath, ScopeSpan scope, LuaDeclarationType type, Declaration nameSpace) { Name = name; Description = description; FilePath = filepath; Scope = scope; Type = type; NameSpace = nameSpace; }