Esempio n. 1
0
 internal static GreenNode TryGetNode(
     int kind,
     GreenNode child1,
     SyntaxFactoryContext context,
     out int hash
     )
 {
     return(SyntaxNodeCache.TryGetNode(kind, child1, GetNodeFlags(context), out hash));
 }
Esempio n. 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);
        }
Esempio n. 3
0
        protected void SetFactoryContext(SyntaxFactoryContext context)
        {
            if (context.IsInAsync)
            {
                this.flags |= NodeFlags.FactoryContextIsInAsync;
            }

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

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

            return(flags);
        }
Esempio n. 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);
        }
Esempio n. 6
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;
        }
Esempio n. 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;
        }
Esempio n. 8
0
 internal static NodeFlags SetFactoryContext(NodeFlags flags, SyntaxFactoryContext context)
 {
     return(flags);
 }
Esempio n. 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)
 {
 }
Esempio n. 10
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return flags;
 }
Esempio n. 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);
 }
Esempio n. 12
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return(flags);
 }
Esempio n. 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));
 }
Esempio n. 14
0
 internal static GreenNode TryGetNode(int kind, GreenNode child1, SyntaxFactoryContext context, out int hash)
 {
     return SyntaxNodeCache.TryGetNode(kind, child1, GetNodeFlags(context), out hash);
 }