예제 #1
0
        /// <summary>
        /// Creates a new variable code construct and inserts the element in the CodeDom tree.
        /// </summary>
        /// <param name="variableName">Required. The name of the new variable.</param>
        /// <param name="variableType">Required. A vsCMTypeRef constant indicating the data type that the function returns. This can be a CodeTypeRef object, a vsCMTypeRef constant, or a fully qualified type name.</param>
        /// <param name="position">Optional. Default = 0. The code element after which to add the new element. If the value is a CodeElement, then the new element is added immediately after it.
        /// If the value is a Long, then AddVariable indicates the element after which to add the new element.
        /// Because collections begin their count at 1, passing 0 indicates that the new element should be placed at the beginning of the collection. A value of -1 means the element should be placed at the end.
        /// </param>
        /// <param name="variableAccess">A vsCMAccess constant.</param>
        /// <param name="variablNode">The Node AST object of Variable.</param>
        /// <returns></returns>
        public CodeVariable AddVariable(string variableName, object variableType, object position, vsCMAccess variableAccess, object variablNode)
        {
            var codeVar = new LuaCodeVariable(DTE, this, variableName, ObjectToTypeRef(variableType), variableAccess, variablNode as Variable);

            AddVariable(codeVar);
            return(codeVar);
        }
예제 #2
0
        /// <summary>
        ///  Adds fields to the table object.
        /// </summary>
        /// <param name="variableName">Field variable name.</param>
        /// <param name="type">Field variable type.</param>
        /// <param name="variable">Optional. Field variable Node object.</param>
        /// <returns></returns>
        public CodeVariable AddInitVariable(string variableName, LuaType type, Variable variable)
        {
            var result = new LuaCodeVariable(DTE, parent, variableName,
                                             new LuaCodeTypeRef(DTE, LuaDeclaredType.Find(type.ToString())),
                                             vsCMAccess.vsCMAccessPublic, variable);

            AddInitVariable(result);
            return(result);
        }
예제 #3
0
        /// <summary>
        /// Creates the variable.
        /// </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 CreateVariable(
            DTE dte, CodeElement parent, string name,
            LuaType type, vsCMAccess access, Variable variable)
        {
            var result = new LuaCodeVariable(dte, parent, name,
                                             new LuaCodeTypeRef(dte, LuaDeclaredType.Find(type.ToString())),
                                             access, variable);

            return(result);
        }
예제 #4
0
 /// <summary>
 /// Adds a member variable to the Lua class.
 /// </summary>
 /// <param name="variable"></param>
 public void AddVariable(LuaCodeVariable variable)
 {
     childObjects.AddElement(variable);
     CommitChanges();
 }
예제 #5
0
 /// <summary>
 /// Adds fields to the table object.
 /// </summary>
 /// <param name="variable">Field variable.</param>
 public void AddInitVariable(LuaCodeVariable variable)
 {
     childObjects.AddElement(variable);
 }