本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbol类的典型用法代码示例。如果您正苦于以下问题:C# Symbol类的具体用法?C# Symbol怎么用?C# Symbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Symbol类属于Microsoft.CodeAnalysis.CSharp命名空间,在下文中一共展示了Symbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BinderWithContainingMemberOrLambda
internal BinderWithContainingMemberOrLambda(Binder next, BinderFlags flags, Symbol containingMemberOrLambda)
: base(next, flags)
{
Debug.Assert(containingMemberOrLambda != null);
_containingMemberOrLambda = containingMemberOrLambda;
}
示例2: Analyze
internal static void Analyze(
CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion, HashSet<PrefixUnaryExpressionSyntax> unassignedVariableAddressOfSyntaxes,
out IEnumerable<Symbol> readInside,
out IEnumerable<Symbol> writtenInside,
out IEnumerable<Symbol> readOutside,
out IEnumerable<Symbol> writtenOutside,
out IEnumerable<Symbol> captured,
out IEnumerable<Symbol> unsafeAddressTaken)
{
var walker = new ReadWriteWalker(compilation, member, node, firstInRegion, lastInRegion, unassignedVariableAddressOfSyntaxes);
try
{
bool badRegion = false;
walker.Analyze(ref badRegion);
if (badRegion)
{
readInside = writtenInside = readOutside = writtenOutside = captured = unsafeAddressTaken = Enumerable.Empty<Symbol>();
}
else
{
readInside = walker._readInside;
writtenInside = walker._writtenInside;
readOutside = walker._readOutside;
writtenOutside = walker._writtenOutside;
captured = walker.GetCaptured();
unsafeAddressTaken = walker.GetUnsafeAddressTaken();
}
}
finally
{
walker.Free();
}
}
示例3: BindCref
internal ImmutableArray<Symbol> BindCref(CrefSyntax syntax, out Symbol ambiguityWinner, DiagnosticBag diagnostics)
{
ImmutableArray<Symbol> symbols = BindCrefInternal(syntax, out ambiguityWinner, diagnostics);
Debug.Assert(!symbols.IsDefault, "Prefer empty to null.");
Debug.Assert((symbols.Length > 1) == ((object)ambiguityWinner != null), "ambiguityWinner should be set iff more than one symbol is returned.");
return symbols;
}
示例4: ReportUnassigned
protected override void ReportUnassigned(Symbol symbol, SyntaxNode node)
{
if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
{
_result.Add((PrefixUnaryExpressionSyntax)node.Parent);
}
}
示例5: MethodGroupResolution
public MethodGroupResolution(
MethodGroup methodGroup,
Symbol otherSymbol,
OverloadResolutionResult<MethodSymbol> overloadResolutionResult,
AnalyzedArguments analyzedArguments,
LookupResultKind resultKind,
ImmutableArray<Diagnostic> diagnostics,
bool extensionMethodsOfSameViabilityAreAvailable)
{
Debug.Assert((methodGroup == null) || (methodGroup.Methods.Count > 0));
Debug.Assert((methodGroup == null) || ((object)otherSymbol == null));
// Methods should be represented in the method group.
Debug.Assert(((object)otherSymbol == null) || (otherSymbol.Kind != SymbolKind.Method));
Debug.Assert(resultKind != LookupResultKind.Ambiguous); // HasAnyApplicableMethod is expecting Viable methods.
Debug.Assert(!diagnostics.IsDefault);
Debug.Assert(!extensionMethodsOfSameViabilityAreAvailable || methodGroup == null || !methodGroup.IsExtensionMethodGroup);
this.MethodGroup = methodGroup;
this.OtherSymbol = otherSymbol;
this.OverloadResolutionResult = overloadResolutionResult;
this.AnalyzedArguments = analyzedArguments;
this.ResultKind = resultKind;
this.Diagnostics = diagnostics;
this.ExtensionMethodsOfSameViabilityAreAvailable = extensionMethodsOfSameViabilityAreAvailable;
}
示例6: BindQualifiedCref
private ImmutableArray<Symbol> BindQualifiedCref(QualifiedCrefSyntax syntax, out Symbol ambiguityWinner, DiagnosticBag diagnostics)
{
// NOTE: we won't check whether container is an error type - we'll just let BindMemberCref fail
// and report a blanket diagnostic.
NamespaceOrTypeSymbol container = BindNamespaceOrTypeSymbolInCref(syntax.Container);
return BindMemberCref(syntax.Member, container, out ambiguityWinner, diagnostics);
}
示例7: CheckArguments
private void CheckArguments(ImmutableArray<RefKind> argumentRefKindsOpt, ImmutableArray<BoundExpression> arguments, Symbol method)
{
if (!argumentRefKindsOpt.IsDefault)
{
Debug.Assert(arguments.Length == argumentRefKindsOpt.Length);
for (int i = 0; i < arguments.Length; i++)
{
if (argumentRefKindsOpt[i] != RefKind.None)
{
var argument = arguments[i];
switch (argument.Kind)
{
case BoundKind.FieldAccess:
CheckFieldAddress((BoundFieldAccess)argument, method);
break;
case BoundKind.Local:
var local = (BoundLocal)argument;
if (local.Syntax.Kind() == SyntaxKind.DeclarationExpression)
{
CheckOutDeclaration(local, method);
}
break;
}
}
}
}
}
示例8: DecisionTreeBuilder
protected DecisionTreeBuilder(
Symbol enclosingSymbol,
Conversions conversions)
{
this._enclosingSymbol = enclosingSymbol;
this._conversions = conversions;
}
示例9: 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;
}
示例10: SubsumptionDiagnosticBuilder
internal SubsumptionDiagnosticBuilder(Symbol enclosingSymbol,
Conversions conversions,
BoundExpression expression)
: base(enclosingSymbol, conversions)
{
_subsumptionTree = DecisionTree.Create(expression, expression.Type, enclosingSymbol);
}
示例11: RegionAnalysisContext
/// <summary>
/// Construct context
/// </summary>
public RegionAnalysisContext(CSharpCompilation compilation, Symbol member, BoundNode boundNode, BoundNode firstInRegion, BoundNode lastInRegion)
{
this.Compilation = compilation;
this.Member = member;
this.BoundNode = boundNode;
this.FirstInRegion = firstInRegion;
this.LastInRegion = lastInRegion;
this.Failed =
boundNode == null ||
firstInRegion == null ||
lastInRegion == null ||
firstInRegion.Syntax.SpanStart > lastInRegion.Syntax.Span.End;
if (!this.Failed && ReferenceEquals(firstInRegion, lastInRegion))
{
switch (firstInRegion.Kind)
{
case BoundKind.NamespaceExpression:
case BoundKind.TypeExpression:
// Some bound nodes are still considered to be invalid for flow analysis
this.Failed = true;
break;
}
}
}
示例12: GetCapturedVariableFieldName
private static string GetCapturedVariableFieldName(Symbol variable, ref int uniqueId)
{
if (IsThis(variable))
{
return GeneratedNames.ThisProxyFieldName();
}
var local = variable as LocalSymbol;
if ((object)local != null)
{
if (local.SynthesizedKind == SynthesizedLocalKind.LambdaDisplayClass)
{
return GeneratedNames.MakeLambdaDisplayLocalName(uniqueId++);
}
if (local.SynthesizedKind == SynthesizedLocalKind.ExceptionFilterAwaitHoistedExceptionLocal)
{
return GeneratedNames.MakeHoistedLocalFieldName(local.SynthesizedKind, uniqueId++);
}
if (local.SynthesizedKind == SynthesizedLocalKind.InstrumentationPayload)
{
return GeneratedNames.MakeSynthesizedInstrumentationPayloadLocalFieldName(uniqueId++);
}
}
Debug.Assert(variable.Name != null);
return variable.Name;
}
示例13: Visit
public virtual void Visit(Symbol symbol)
{
if ((object)symbol != null)
{
symbol.Accept(this);
}
}
示例14: CheckSymbolKind
private static void CheckSymbolKind(Symbol symbol)
{
switch (symbol.Kind)
{
case SymbolKind.ErrorType:
case SymbolKind.NamedType:
case SymbolKind.Event:
case SymbolKind.Field:
case SymbolKind.Method:
case SymbolKind.Property:
case SymbolKind.TypeParameter:
break; // Can sensibly append location.
case SymbolKind.ArrayType:
case SymbolKind.PointerType:
case SymbolKind.Parameter:
break; // Can sensibly append location, after unwrapping.
case SymbolKind.DynamicType:
break; // Can't sensibly append location, but it should never be ambiguous.
case SymbolKind.Namespace:
case SymbolKind.Alias:
case SymbolKind.Assembly:
case SymbolKind.NetModule:
case SymbolKind.Label:
case SymbolKind.Local:
case SymbolKind.RangeVariable:
case SymbolKind.Preprocessing:
default:
throw ExceptionUtilities.UnexpectedValue(symbol.Kind);
}
}
示例15: Create
public static DecisionTree Create(BoundExpression expression, TypeSymbol type, Symbol enclosingSymbol)
{
Debug.Assert(expression.Type == type);
LocalSymbol temp = null;
if (expression.ConstantValue == null)
{
// Unless it is a constant, the decision tree acts on a copy of the input expression.
// We create a temp to represent that copy. Lowering will assign into this temp.
temp = new SynthesizedLocal(enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, expression.Syntax, false, RefKind.None);
expression = new BoundLocal(expression.Syntax, temp, null, type);
}
if (expression.Type.CanBeAssignedNull())
{
// We need the ByType decision tree to separate null from non-null values.
// Note that, for the purpose of the decision tree (and subsumption), we
// ignore the fact that the input may be a constant, and therefore always
// or never null.
return new ByType(expression, type, temp);
}
else
{
// If it is a (e.g. builtin) value type, we can switch on its (constant) values.
// If it isn't a builtin, in practice we will only use the Default part of the
// ByValue.
return new ByValue(expression, type, temp);
}
}