Ejemplo 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));
 }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        protected void SetFactoryContext(SyntaxFactoryContext context)
        {
            if (context.IsInAsync)
            {
                this.flags |= NodeFlags.FactoryContextIsInAsync;
            }

            if (context.IsInQuery)
            {
                this.flags |= NodeFlags.FactoryContextIsInQuery;
            }
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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;
        }
Ejemplo 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;
        }
Ejemplo n.º 8
0
 internal static NodeFlags SetFactoryContext(NodeFlags flags, SyntaxFactoryContext context)
 {
     return(flags);
 }
Ejemplo 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)
 {
 }
Ejemplo n.º 10
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return flags;
 }
Ejemplo 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);
 }
Ejemplo n.º 12
0
 private static GreenNode.NodeFlags GetFlags(SyntaxFactoryContext context)
 {
     GreenNode.NodeFlags flags = GetFlags();
     flags = CSharpSyntaxNode.SetFactoryContext(flags, context);
     return(flags);
 }
Ejemplo 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));
 }
Ejemplo 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);
 }