Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuaCodeVariableTable"/> class.
 /// </summary>
 /// <param name="dte"></param>
 /// <param name="parentElement"></param>
 /// <param name="name"></param>
 /// <param name="access"></param>
 /// <param name="variable"></param>
 public LuaCodeVariableTable(DTE dte, CodeElement parentElement, string name, vsCMAccess access,
     TableConstructor variable)
     : base(dte, parentElement, name, new LuaCodeTypeRef(
                                          dte, LuaDeclaredType.Table), access,
            new Variable(variable.Location) {Identifier = new Identifier(variable.Location)})
 {
     childObjects = new LuaCodeElements(dte, this);
     astNode = variable;
     parent = parentElement;
 }
Beispiel #2
0
        /// <summary>
        /// Creates LuaCodeVariableTable from TableConstructor node.
        /// </summary>
        /// <param name="constructor">TableConstructor node instance.</param>
        /// <param name="parentElement">Parent of LuaCodeVariable element.</param>
        /// <param name="identifier">TableConstructor identifier.</param>
        /// <param name="isLocal">Indicates that element is declared locally.</param>
        /// <returns></returns>
        private LuaCodeVariable CreateTable(TableConstructor constructor, CodeElement parentElement,
            Identifier identifier, bool isLocal)
        {
            var variable = (LuaCodeVariableTable) LuaCodeElementFactory.CreateLuaCodeVariableTable
                                                  	(dte, parentElement, identifier.Name,
                                                  	 LuaType.Table, isLocal, constructor);
            variable.IdentifierLocation = PrepareLocation(identifier.Location, constructor.Location);
            variable.IdentifierLocation.eCol = variable.IdentifierLocation.sCol + identifier.Name.Length;

            //var location = variable.IdentifierLocation;
            //Trace.WriteLine(String.Format("LuaCodeVariableTable Location: StartCol-{0} StartLine-{1} EndCol-{2} EndLine-{3}", location.sCol, location.sLin, location.eCol, location.eLin));
            if (constructor.FieldList != null)
            {
                foreach (Field field in constructor.FieldList)
                {
                    RecurseFieldInTable(variable, field);
                }
            }
            return variable;
        }
Beispiel #3
0
 /// <summary>
 /// Creates LuaCodeVariableTable from TableConstructor node.
 /// </summary>
 /// <param name="constructor">TableConstructor node instance.</param>
 /// <param name="parentElement">Parent of LuaCodeVariable element.</param>
 /// <param name="name">Name of table.</param>
 /// <param name="isLocal">Indicates that element is declared locally.</param>
 /// <returns></returns>
 private LuaCodeVariable CreateTable(TableConstructor constructor, CodeElement parentElement,
     string name, bool isLocal)
 {
     var variable = LuaCodeElementFactory.CreateLuaCodeVariableTable
         (dte, parentElement, name, LuaType.Table, isLocal, constructor);
     if (constructor.FieldList != null)
     {
         foreach (Field field in constructor.FieldList)
         {
             RecurseFieldInTable(variable as LuaCodeVariableTable, field);
         }
     }
     return variable;
 }