Example #1
0
 internal static GreenNode TryGetNode(
     int kind,
     GreenNode child1,
     SyntaxFactoryContext context,
     out int hash
     )
 {
     return(SyntaxNodeCache.TryGetNode(kind, child1, GetNodeFlags(context), out hash));
 }
Example #2
0
        // NOTE: If you add new state, you should probably add it to ResetPoint as well.

        internal LanguageParser(
            Lexer lexer,
            CSharp.CSharpSyntaxNode oldTree,
            IEnumerable <TextChangeRange> changes,
            CancellationToken cancellationToken = default(CancellationToken))
            : base(lexer, LexerMode.Syntax, oldTree, changes, allowModeReset: false,
                   preLexIfNotIncremental: true, cancellationToken: cancellationToken)
        {
            this._syntaxFactoryContext = new SyntaxFactoryContext();
            this._syntaxFactory        = new ContextAwareSyntax(_syntaxFactoryContext);
        }
        protected void SetFactoryContext(SyntaxFactoryContext context)
        {
            if (context.IsInAsync)
            {
                this.flags |= NodeFlags.FactoryContextIsInAsync;
            }

            if (context.IsInQuery)
            {
                this.flags |= NodeFlags.FactoryContextIsInQuery;
            }
        }
        internal static NodeFlags SetFactoryContext(NodeFlags flags, SyntaxFactoryContext context)
        {
            if (context.IsInAsync)
            {
                flags |= NodeFlags.FactoryContextIsInAsync;
            }

            if (context.IsInQuery)
            {
                flags |= NodeFlags.FactoryContextIsInQuery;
            }

            return(flags);
        }
Example #5
0
        private static GreenNode.NodeFlags GetNodeFlags(SyntaxFactoryContext context)
        {
            var flags = SyntaxNodeCache.GetDefaultNodeFlags();

            if (context.IsInAsync)
            {
                flags |= GreenNode.NodeFlags.FactoryContextIsInAsync;
            }

            if (context.IsInQuery)
            {
                flags |= GreenNode.NodeFlags.FactoryContextIsInQuery;
            }

            return(flags);
        }
        private static GreenNode.NodeFlags GetNodeFlags(SyntaxFactoryContext context)
        {
            var flags = SyntaxNodeCache.GetDefaultNodeFlags();

            if (context.IsInAsync)
            {
                flags |= GreenNode.NodeFlags.FactoryContextIsInAsync;
            }

            if (context.IsInQuery)
            {
                flags |= GreenNode.NodeFlags.FactoryContextIsInQuery;
            }

            return flags;
        }
Example #7
0
        //#endif

        internal XSharpLanguageParser(
            String FileName,
            SourceText Text,
            CSharpParseOptions options,
            CSharp.CSharpSyntaxNode oldTree,
            IEnumerable <TextChangeRange> changes,
            LexerMode lexerMode = LexerMode.Syntax,
            CancellationToken cancellationToken = default(CancellationToken))
            : base(/*lexer*/ null, lexerMode, oldTree, changes, allowModeReset: false,
                   preLexIfNotIncremental: true, cancellationToken: cancellationToken)
        {
            _syntaxFactoryContext = new SyntaxFactoryContext();
            _syntaxFactory        = new ContextAwareSyntax(_syntaxFactoryContext);
            _text          = Text;
            _fileName      = FileName;
            _options       = options;
            _isScript      = options.Kind == SourceCodeKind.Script;
            _isMacroScript = _isScript && options.MacroScript;
        }
Example #8
0
 internal static NodeFlags SetFactoryContext(NodeFlags flags, SyntaxFactoryContext context)
 {
     return(flags);
 }
Example #9
0
 /// <summary>
 /// Should only be called during construction.
 /// </summary>
 /// <remarks>
 /// This should probably be an extra constructor parameter, but we don't need more constructor overloads.
 /// </remarks>
 protected void SetFactoryContext(SyntaxFactoryContext context)
 {
 }
Example #10
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return flags;
 }
Example #11
0
 internal static GreenNode TryGetNode(int kind, GreenNode child1, GreenNode child2, GreenNode child3, SyntaxFactoryContext context, out int hash)
 {
     return TryGetNode(kind, child1, child2, child3, GetFlags(context), out hash);
 }
Example #12
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return(flags);
 }
Example #13
0
 internal static GreenNode TryGetNode(int kind, GreenNode child1, GreenNode child2, GreenNode child3, SyntaxFactoryContext context, out int hash)
 {
     return(TryGetNode(kind, child1, child2, child3, GetFlags(context), out hash));
 }
 internal static GreenNode TryGetNode(int kind, GreenNode child1, SyntaxFactoryContext context, out int hash)
 {
     return SyntaxNodeCache.TryGetNode(kind, child1, GetNodeFlags(context), out hash);
 }