本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Binder类的典型用法代码示例。如果您正苦于以下问题:C# Binder类的具体用法?C# Binder怎么用?C# Binder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Binder类属于Microsoft.CodeAnalysis.CSharp命名空间,在下文中一共展示了Binder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecutableCodeBinder
internal ExecutableCodeBinder(CSharpSyntaxNode root, Symbol memberSymbol, Binder next, BinderFlags additionalFlags)
: base(next, (next.Flags | additionalFlags) & ~BinderFlags.AllClearedAtExecutableCodeBoundary)
{
this.memberSymbol = memberSymbol;
this.root = root;
this.owner = memberSymbol as MethodSymbol;
}
示例2: BinderWithConditionalReceiver
internal BinderWithConditionalReceiver(Binder next, BoundExpression receiverExpression)
: base(next)
{
Debug.Assert(receiverExpression != null);
_receiverExpression = receiverExpression;
}
示例3: LookupSymbolsInSingleBinder
protected override void LookupSymbolsInSingleBinder(
LookupResult result, string name, int arity, ConsList<Symbol> basesBeingResolved, LookupOptions options, Binder originalBinder, bool diagnose, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
if ((options & (LookupOptions.NamespaceAliasesOnly | LookupOptions.MustBeInvocableIfMember)) != 0)
{
return;
}
Debug.Assert(result.IsClear);
var count = parameterMap.GetCountForKey(name);
if (count == 1)
{
ParameterSymbol p;
parameterMap.TryGetSingleValue(name, out p);
result.MergeEqual(originalBinder.CheckViability(p, arity, options, null, diagnose, ref useSiteDiagnostics));
}
else if (count > 1)
{
var parameters = parameterMap[name];
foreach (var sym in parameters)
{
result.MergeEqual(originalBinder.CheckViability(sym, arity, options, null, diagnose, ref useSiteDiagnostics));
}
}
}
示例4: QueryUnboundLambdaState
public QueryUnboundLambdaState(UnboundLambda unbound, Binder binder, RangeVariableMap rangeVariableMap, ImmutableArray<RangeVariableSymbol> parameters, ExpressionSyntax body)
: this(unbound, binder, rangeVariableMap, parameters, (LambdaSymbol lambdaSymbol, ref Binder lambdaBodyBinder, DiagnosticBag diagnostics) =>
{
lambdaBodyBinder = new ScopedExpressionBinder(lambdaBodyBinder, body);
return lambdaBodyBinder.BindLambdaExpressionAsBlock(body, diagnostics);
})
{ }
示例5: QueryUnboundLambdaState
public QueryUnboundLambdaState(UnboundLambda unbound, Binder binder, RangeVariableMap rangeVariableMap, ImmutableArray<RangeVariableSymbol> parameters, ExpressionSyntax body)
: this(unbound, binder, rangeVariableMap, parameters, (LambdaSymbol lambdaSymbol, ExecutableCodeBinder lambdaBodyBinder, DiagnosticBag diagnostics) =>
{
BoundExpression expression = lambdaBodyBinder.BindValue(body, diagnostics, BindValueKind.RValue);
return lambdaBodyBinder.WrapExpressionLambdaBody(expression, body, diagnostics);
})
{ }
示例6: BinderWithContainingMemberOrLambda
internal BinderWithContainingMemberOrLambda(Binder next, BinderFlags flags, Symbol containingMemberOrLambda)
: base(next, flags)
{
Debug.Assert(containingMemberOrLambda != null);
_containingMemberOrLambda = containingMemberOrLambda;
}
示例7: Binder
internal Binder(Binder next)
{
Debug.Assert(next != null);
_next = next;
this.Flags = next.Flags;
this.Compilation = next.Compilation;
}
示例8: WithConstructorInitializerLocalsBinder
public WithConstructorInitializerLocalsBinder(Binder enclosing, ConstructorDeclarationSyntax declaration)
: base(enclosing, enclosing.Flags)
{
Debug.Assert(declaration.Initializer != null);
this.scope = declaration;
this.initializerArgumentList = declaration.Initializer.ArgumentList;
}
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:7,代码来源:WithConstructorInitializerLocalsBinder.cs
示例9: CollectLocalsFromDeconstruction
internal void CollectLocalsFromDeconstruction(
ExpressionSyntax declaration,
LocalDeclarationKind kind,
ArrayBuilder<LocalSymbol> locals,
SyntaxNode deconstructionStatement,
Binder enclosingBinderOpt = null)
{
switch (declaration.Kind())
{
case SyntaxKind.TupleExpression:
{
var tuple = (TupleExpressionSyntax)declaration;
foreach (var arg in tuple.Arguments)
{
CollectLocalsFromDeconstruction(arg.Expression, kind, locals, deconstructionStatement, enclosingBinderOpt);
}
break;
}
case SyntaxKind.DeclarationExpression:
{
var declarationExpression = (DeclarationExpressionSyntax)declaration;
CollectLocalsFromDeconstruction(
declarationExpression.Designation, declarationExpression.Type,
kind, locals, deconstructionStatement, enclosingBinderOpt);
break;
}
case SyntaxKind.IdentifierName:
break;
default:
throw ExceptionUtilities.UnexpectedValue(declaration.Kind());
}
}
示例10: BoundLambda
public BoundLambda(CSharpSyntaxNode syntax, BoundBlock body, ImmutableArray<Diagnostic> diagnostics, Binder binder, TypeSymbol delegateType, bool inferReturnType)
: this(syntax, (LambdaSymbol)binder.ContainingMemberOrLambda, body, diagnostics, binder, delegateType)
{
if (inferReturnType)
{
this._inferredReturnType = InferReturnType(
this.Body,
this.Binder,
delegateType,
this.Symbol.IsAsync,
ref this._inferredReturnTypeUseSiteDiagnostics,
out this._refKind,
out this._inferredFromSingleType);
#if DEBUG
_hasInferredReturnType = true;
#endif
}
Debug.Assert(
syntax.IsAnonymousFunction() || // lambda expressions
syntax is ExpressionSyntax && LambdaUtilities.IsLambdaBody(syntax, allowReducedLambdas: true) || // query lambdas
LambdaUtilities.IsQueryPairLambda(syntax) // "pair" lambdas in queries
);
}
示例11: BuildMap
public static SmallDictionary<CSharpSyntaxNode, Binder> BuildMap(MethodSymbol method, CSharpSyntaxNode syntax, Binder enclosing, out bool sawYield)
{
var builder = new LocalBinderFactory(method, enclosing);
builder.Visit(syntax);
sawYield = builder._sawYield;
return builder._map;
}
示例12: QueryUnboundLambdaState
public QueryUnboundLambdaState(Binder binder, RangeVariableMap rangeVariableMap, ImmutableArray<RangeVariableSymbol> parameters, LambdaBodyFactory bodyFactory)
: base(binder, unboundLambdaOpt: null)
{
_parameters = parameters;
_rangeVariableMap = rangeVariableMap;
_bodyFactory = bodyFactory;
}
示例13: WithPrimaryConstructorParametersBinder
internal WithPrimaryConstructorParametersBinder(MethodSymbol primaryCtor, Binder next)
: base(next)
{
Debug.Assert((object)primaryCtor != null);
this.primaryCtor = primaryCtor;
var parameters = primaryCtor.Parameters;
var definitionMap = new SmallDictionary<string, ParameterSymbol>();
for (int i = parameters.Length - 1; i >= 0; i--)
{
var parameter = parameters[i];
definitionMap[parameter.Name] = parameter;
}
this.definitionMap = definitionMap;
var parameterMap = new MultiDictionary<string, ParameterSymbol>(parameters.Length, EqualityComparer<string>.Default);
foreach (var parameter in parameters)
{
parameterMap.Add(parameter.Name, parameter);
}
this.parameterMap = parameterMap;
}
示例14: BindLockStatementParts
internal override BoundStatement BindLockStatementParts(DiagnosticBag diagnostics, Binder originalBinder)
{
// Allow method groups during binding and then rule them out when we check that the expression has
// a reference type.
ExpressionSyntax exprSyntax = TargetExpressionSyntax;
BoundExpression expr = BindTargetExpression(diagnostics);
TypeSymbol exprType = expr.Type;
bool hasErrors = false;
if ((object)exprType == null)
{
if (expr.ConstantValue != ConstantValue.Null || Compilation.FeatureStrictEnabled) // Dev10 allows the null literal.
{
Error(diagnostics, ErrorCode.ERR_LockNeedsReference, exprSyntax, expr.Display);
hasErrors = true;
}
}
else if (!exprType.IsReferenceType && (exprType.IsValueType || Compilation.FeatureStrictEnabled))
{
Error(diagnostics, ErrorCode.ERR_LockNeedsReference, exprSyntax, exprType);
hasErrors = true;
}
BoundStatement stmt = originalBinder.BindPossibleEmbeddedStatement(_syntax.Statement, diagnostics);
Debug.Assert(this.Locals.IsDefaultOrEmpty);
return new BoundLockStatement(_syntax, expr, stmt, hasErrors);
}
示例15: CollectLocalsFromDeconstruction
internal void CollectLocalsFromDeconstruction(
ExpressionSyntax declaration,
LocalDeclarationKind kind,
ArrayBuilder<LocalSymbol> locals,
SyntaxNode deconstructionStatement,
Binder enclosingBinderOpt = null)
{
switch (declaration.Kind())
{
case SyntaxKind.TupleExpression:
{
var tuple = (TupleExpressionSyntax)declaration;
foreach (var arg in tuple.Arguments)
{
CollectLocalsFromDeconstruction(arg.Expression, kind, locals, deconstructionStatement, enclosingBinderOpt);
}
break;
}
case SyntaxKind.DeclarationExpression:
{
var declarationExpression = (DeclarationExpressionSyntax)declaration;
CollectLocalsFromDeconstruction(
declarationExpression.Designation, declarationExpression.Type,
kind, locals, deconstructionStatement, enclosingBinderOpt);
break;
}
case SyntaxKind.IdentifierName:
break;
default:
// In broken code, we can have an arbitrary expression here. Collect its expression variables.
ExpressionVariableFinder.FindExpressionVariables(this, locals, declaration);
break;
}
}