/// <summary> /// Creates the lua code variable table. /// </summary> /// <param name="dte">The DTE.</param> /// <param name="parent">The parent.</param> /// <param name="name">The name.</param> /// <param name="type">The type.</param> /// <param name="access">The access.</param> /// <param name="variable">The variable.</param> /// <returns></returns> public static LuaCodeVariable CreateLuaCodeVariableTable( DTE dte, CodeElement parent, string name, LuaType type, vsCMAccess access, TableConstructor variable) { var result = new LuaCodeVariableTable(dte, parent, name, access, variable); return(result); }
/// <summary> /// Creates variables for fileds in a specified LuaCodeVariableTable. /// </summary> /// <param name="field">Field enumeration.</param> /// <param name="parentElement">LuaCodeVariableTable as parent element.</param> private void RecurseFieldInTable(LuaCodeVariableTable parentElement, Field field) { LuaCodeVariable element = LuaCodeElementFactory.CreateVariable (dte, parentElement, String.Empty, LuaType.Unknown, vsCMAccess.vsCMAccessPrivate, new Variable(field.Location) {Identifier = field.Identifier}); if (field.Identifier != null) { element.Name = field.Identifier.Name; } if (field.LeftExpression is Literal) { var literal = field.LeftExpression as Literal; if (String.IsNullOrEmpty(element.Name)) element.Name = literal.Value; //element.Type = new LuaCodeTypeRef(dte, LuaDeclaredType.Find(literal.Type.ToString())); } if (field.Expression is Literal) { var literal = field.Expression as Literal; element.InitExpression = ((Literal) field.Expression).Value; element.Type = new LuaCodeTypeRef(dte, LuaDeclaredType.Find(literal.Type.ToString())); } else { RecurseStatement(element, field.Expression); } parentElement.AddInitVariable(element); }