Exemplo n.º 1
0
        void FixArrayInParam(int pos, int endRange, CleanupAstNodeStates states)
        {
            var openParen = states.GeNextTokenKind(TokenKind.OpenSquared, pos);
            if (openParen == 0 || openParen > endRange)
                return;
            var closeParen = states.GeNextTokenKind(TokenKind.CloseSquared, openParen);
            var openNode = states[openParen];
            var closeNode = states[closeParen];
            states.RemoveAt(closeParen);
            states.RemoveAt(openParen);
            states.Insert(pos + 1, closeNode);
            states.Insert(pos + 1, openNode);

            states.Remap();
        }
        static void FixAmpersandAsRef(CleanupAstNodeStates states, int declarationStart)
        {
            var refToken = TokenKind.Ref.BuildTokenFromId();
            var spaceToken = TokenKind.Space.BuildTokenFromId(" ");
            states.RemoveAt(declarationStart + 1);

            states.Insert(declarationStart, spaceToken);
            states.Insert(declarationStart, refToken);
            states.Remap();
        }
Exemplo n.º 3
0
        void FixArrayInParam(int pos, int endRange, CleanupAstNodeStates states)
        {
            var openParen = 0;
            for (var index = pos; index < endRange; index++)
            {
                var searchNode = states[index];
                if (searchNode.GetTokenKind() == TokenKind.Operator
                    && searchNode.GetTokenData().Content == "&")
                    openParen = index;
            }
            if (openParen == 0)
                return;

            states.RemoveAt(openParen);
            states.Insert(pos, TokenKind.Space.BuildTokenFromId(" "));
            states.Insert(pos, TokenKind.Ref.BuildTokenFromId());

            states.Remap();
        }