FillArgumentList() private method

private FillArgumentList ( ParsedMethod parsedMethod, List currentBlock, int lineIndex, bool requireTypes ) : void
parsedMethod ParsedMethod
currentBlock List
lineIndex int
requireTypes bool
return void
Esempio n. 1
0
        private void CreateParsedMethod(int startIndex, int endIndex, bool trimContents)
        {
            // For now we'll assume that all properties are on
            // the same line.  Eventually we may want to combine
            // all lines before the opening bracket


            // todo: add attributes:
            CurrentAttributes.Clear();


            #region Get header information

            int lineIndexForHeader = 0;

            string headerLine = mCurrentBlock[lineIndexForHeader].Trim();

            int numberOfParens = mCurrentBlock[lineIndexForHeader].CountOf('(') - mCurrentBlock[lineIndexForHeader].CountOf(')');


            while (numberOfParens > 0)
            {
                lineIndexForHeader++;
                headerLine += " " + mCurrentBlock[lineIndexForHeader].Trim();

                numberOfParens += mCurrentBlock[lineIndexForHeader].CountOf('(') - mCurrentBlock[lineIndexForHeader].CountOf(')');
            }

            ParsedMethod parsedMethod = new ParsedMethod();

            parsedMethod.FillHeaderInformation(headerLine);

            #endregion

            parsedMethod.StartIndex = startIndex;
            parsedMethod.EndIndex   = endIndex;

            parsedMethod.FillArgumentList(parsedMethod, mCurrentBlock, 0, true);

            // Fill generic restrictions after getting all arguments
            parsedMethod.FillGenericRestrictions(headerLine);

            parsedMethod.FillBaseCall(mCurrentBlock);

            StringBuilder methodContents = new StringBuilder();

            bool hasGetter;
            bool hasSetter;

            bool hasAutomaticGetter;
            bool hasAutomaticSetter;

            FillGettersAndSetters(methodContents, methodContents, false, trimContents, out hasGetter, out hasSetter, out hasAutomaticGetter, out hasAutomaticSetter);

            parsedMethod.MethodContents = methodContents.ToString();
            parsedMethod.StoreOffOldName();

            mParsedMethods.Add(parsedMethod);
        }
Esempio n. 2
0
        internal void FillBaseCall(List <string> currentBlock)
        {
            int lineOn = 1;

            string baseCall = "";

            if (currentBlock.Count == 1)
            {
                return;
            }

            while (true)
            {
                // We need to trim here because we may not have
                // trimmed the content already
                if (lineOn >= currentBlock.Count)
                {
                    break;
                }
                string line = currentBlock[lineOn].Trim();

                if (line.StartsWith("{"))
                {
                    break;
                }
                else if ((line.Contains("base") || line.Contains("this")) && !line.EndsWith(";"))
                {
                    baseCall += line;
                }
                lineOn++;
            }

            if (baseCall != "")
            {
                BaseCall = new ParsedMethod();

                if (baseCall.StartsWith(":"))
                {
                    baseCall = baseCall.Substring(1).Trim();
                }

                BaseCall.FillHeaderInformation(baseCall);

                BaseCall.FillArgumentList(BaseCall, currentBlock, lineOn - 1, false);
            }
        }
Esempio n. 3
0
        private void CreateParsedMethod(int startIndex, int endIndex, bool trimContents)
        {
            // For now we'll assume that all properties are on 
            // the same line.  Eventually we may want to combine
            // all lines before the opening bracket


            // todo: add attributes:
            CurrentAttributes.Clear();


            #region Get header information

            int lineIndexForHeader = 0;

            string headerLine = mCurrentBlock[lineIndexForHeader].Trim() ;

            int numberOfParens = mCurrentBlock[lineIndexForHeader].CountOf('(') - mCurrentBlock[lineIndexForHeader].CountOf(')');
            

            while (numberOfParens > 0)
            {
                lineIndexForHeader++;
                headerLine += " " + mCurrentBlock[lineIndexForHeader].Trim();

                numberOfParens += mCurrentBlock[lineIndexForHeader].CountOf('(') - mCurrentBlock[lineIndexForHeader].CountOf(')');
            }
            
            ParsedMethod parsedMethod = new ParsedMethod();

            parsedMethod.FillHeaderInformation(headerLine);

            #endregion

            parsedMethod.StartIndex = startIndex;
            parsedMethod.EndIndex = endIndex;

            parsedMethod.FillArgumentList(parsedMethod, mCurrentBlock, 0, true);

            // Fill generic restrictions after getting all arguments
            parsedMethod.FillGenericRestrictions(headerLine);

            parsedMethod.FillBaseCall(mCurrentBlock);

            StringBuilder methodContents = new StringBuilder();

            bool hasGetter;
            bool hasSetter;

            bool hasAutomaticGetter;
            bool hasAutomaticSetter;

            FillGettersAndSetters(methodContents, methodContents, false, trimContents, out hasGetter, out hasSetter, out hasAutomaticGetter, out hasAutomaticSetter);

            parsedMethod.MethodContents = methodContents.ToString();
            parsedMethod.StoreOffOldName();

            mParsedMethods.Add(parsedMethod);
        }
Esempio n. 4
0
        internal void FillBaseCall(List<string> currentBlock)
        {
            int lineOn = 1;

            string baseCall = "";

            if (currentBlock.Count == 1)
            {
                return;
            }

            while (true)
            {
                // We need to trim here because we may not have
                // trimmed the content already
                if (lineOn >= currentBlock.Count)
                {
                    break;
                }
                string line = currentBlock[lineOn].Trim();
                
                if (line.StartsWith("{"))
                {
                    break;
                }
                else if( (line.Contains("base") || line.Contains("this")) && !line.EndsWith(";") )
                {
                    baseCall += line;
                }
                lineOn++;

            }

            if (baseCall != "")
            {
                BaseCall = new ParsedMethod();

                if (baseCall.StartsWith(":"))
                {
                    baseCall = baseCall.Substring(1).Trim();
                }

                BaseCall.FillHeaderInformation(baseCall);

                BaseCall.FillArgumentList(BaseCall, currentBlock, lineOn - 1, false);
            }
        }