Ejemplo n.º 1
0
        private SymbolInfo LookupType(BinderContext underlying, TypeSyntax type, int arity = 0)
        {
            using (var context = new DiagnosticBufferBinderContext(underlying))
            {
                var result = context.BindType(type, arity);
                var err = result as ErrorTypeSymbol;
                if (err == null)
                {
                    return new SymbolInfo(result, ConsList.Singleton(result), context.Commit(false));
                }

                var info = err.ErrorInfo;
                var errors = context.Commit(false).ToList();
                if (info != null)
                {
                    errors.Add(new Diagnostic(info, context.Location(type)));
                }

                var syms = (info is CSDiagnosticInfo) ? (info as CSDiagnosticInfo).Symbols : Enumerable.Empty<Symbol>();
                return new SymbolInfo(result, syms, errors);
            }
        }
Ejemplo n.º 2
0
        private SymbolInfo LookupType(BinderContext underlying, TypeSyntax type, int arity = 0)
        {
            using (var context = new DiagnosticBufferBinderContext(underlying))
            {
                var result = context.BindType(type, arity);
                var err    = result as ErrorTypeSymbol;
                if (err == null)
                {
                    return(new SymbolInfo(result, ConsList.Singleton(result), context.Commit(false)));
                }

                var info   = err.ErrorInfo;
                var errors = context.Commit(false).ToList();
                if (info != null)
                {
                    errors.Add(new Diagnostic(info, context.Location(type)));
                }

                var syms = (info is CSDiagnosticInfo) ? (info as CSDiagnosticInfo).Symbols : Enumerable.Empty <Symbol>();
                return(new SymbolInfo(result, syms, errors));
            }
        }