Пример #1
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);
        }
Пример #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);
        }