本文整理汇总了C#中BoundNode类的典型用法代码示例。如果您正苦于以下问题:C# BoundNode类的具体用法?C# BoundNode怎么用?C# BoundNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundNode类属于命名空间,在下文中一共展示了BoundNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rewrite
internal static BoundNode Rewrite(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, BoundNode node)
{
var builder = ArrayBuilder<BoundStatement>.GetInstance();
bool hasChanged;
// Rewrite top-level declarations only.
switch (node.Kind)
{
case BoundKind.LocalDeclaration:
RewriteLocalDeclaration(compilation, container, declaredLocals, builder, (BoundLocalDeclaration)node);
hasChanged = true;
break;
case BoundKind.MultipleLocalDeclarations:
foreach (var declaration in ((BoundMultipleLocalDeclarations)node).LocalDeclarations)
{
RewriteLocalDeclaration(compilation, container, declaredLocals, builder, declaration);
}
hasChanged = true;
break;
default:
hasChanged = false;
break;
}
if (hasChanged)
{
node = new BoundBlock(node.Syntax, ImmutableArray<LocalSymbol>.Empty, builder.ToImmutable()) { WasCompilerGenerated = true };
}
builder.Free();
return node;
}
示例2: Visit
public override BoundNode Visit(BoundNode node)
{
if (_mayHaveSideEffects)
{
return null;
}
return base.Visit(node);
}
示例3: Visit
public override BoundNode Visit(BoundNode node)
{
var expression = node as BoundExpression;
if (expression != null)
{
_typeParameterChecker.Visit(expression.ExpressionSymbol);
}
return base.Visit(node);
}
示例4: Visit
protected override void Visit(BoundNode node)
{
if (node != null && node.Syntax != null)
{
NoteLocation(node.Syntax.Span);
}
base.Visit(node);
}
示例5: Rewrite
internal static BoundNode Rewrite(
ParameterSymbol targetMethodThisParameter,
Conversions conversions,
ImmutableDictionary<string, DisplayClassVariable> displayClassVariables,
BoundNode node,
DiagnosticBag diagnostics)
{
var rewriter = new CapturedVariableRewriter(targetMethodThisParameter, conversions, displayClassVariables, diagnostics);
return rewriter.Visit(node);
}
示例6: Visit
public override BoundNode Visit(BoundNode node)
{
var expression = node as BoundExpression;
if (expression != null)
{
var constantValue = expression.ConstantValue;
if (constantValue != null && constantValue.IsDecimal)
{
return RewriteConstant(expression);
}
}
return base.Visit(node);
}
示例7: Classify
/// <summary>
/// Classifies the operations performed on the <paramref name="variable" /> within the <paramref name="node" />.
/// </summary>
/// <param name="node">The node of a bound tree the <paramref name="variable" /> should be classified for.</param>
/// <param name="variable">The variable that should be classified.</param>
public static VariableOperations Classify(BoundNode node, VariableMetadata variable)
{
Requires.NotNull(node, () => node);
Requires.NotNull(variable, () => variable);
_instance._writeContext = 0;
_instance._operations = VariableOperations.None;
_instance._variable = variable;
_instance.Visit(node);
Assert.That(_instance._writeContext == 0, "Unbalanced write context operations.");
return _instance._operations;
}
示例8: Analyze
internal static IEnumerable<StatementSyntax> Analyze(Compilation compilation, MethodSymbol sourceMethod, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion)
{
var walker = new ReturnStatementsWalker(compilation, sourceMethod, node, firstInRegion, lastInRegion);
try
{
bool badRegion = false;
walker.Analyze(ref badRegion);
return badRegion ? Enumerable.Empty<StatementSyntax>() : walker.returnStatements.ToArray();
}
finally
{
walker.Free();
}
}
示例9: Visit
public override BoundNode Visit(BoundNode node)
{
if (found == null)
{
if (node != null && !node.WasCompilerGenerated && node.Syntax == syntax)
{
found = node;
}
else
{
base.Visit(node);
}
}
return null;
}
示例10: Visit
public override BoundNode Visit(BoundNode node)
{
if (node != null) //e.g. static method invocations have null receivers
{
_list.Add(node);
}
return base.Visit(node);
}
示例11: GetNodes
public static IEnumerable<BoundNode> GetNodes(BoundNode root)
{
var s = new BoundTreeSequencer();
s.Visit(root);
foreach (var node in s._list)
yield return node;
}
示例12: VisitStatement
public BoundNode VisitStatement(BoundNode node)
{
Debug.Assert(node == null || EvalStackIsEmpty());
var origStack = StackDepth();
var prevContext = _context;
var result = base.Visit(node);
_context = prevContext;
SetStackDepth(origStack);
_counter += 1;
return result;
}
示例13: Visit
public override BoundNode Visit(BoundNode node)
{
if (!_found)
{
return base.Visit(node);
}
return null;
}
示例14: LhsUsesStackWhenAssignedTo
// here we have a case of indirect assignment: *t1 = expr;
// normally we would need to push t1 and that will cause spilling of t2
//
// TODO: an interesting case arises in unused x[i]++ and ++x[i] :
// we have trees that look like:
//
// t1 = &(x[0])
// t2 = *t1
// *t1 = t2 + 1
//
// t1 = &(x[0])
// t2 = *t1 + 1
// *t1 = t2
//
// in these cases, we could keep t2 on stack (dev10 does).
// we are dealing with exactly 2 locals and access them in strict order
// t1, t2, t1, t2 and we are not using t2 after that.
// We may consider detecting exactly these cases and pretend that we do not need
// to push either t1 or t2 in this case.
//
private bool LhsUsesStackWhenAssignedTo(BoundNode node, ExprContext context)
{
Debug.Assert(context == ExprContext.AssignmentTarget);
switch (node.Kind)
{
case BoundKind.Parameter:
case BoundKind.Local:
return false;
case BoundKind.FieldAccess:
return !((BoundFieldAccess)node).FieldSymbol.IsStatic;
case BoundKind.Sequence:
return LhsUsesStackWhenAssignedTo(((BoundSequence)node).Value, context);
}
return true;
}
示例15: Check
public static void Check(BoundNode node, ImmutableArray<TypeParameterSymbol> acceptableTypeParameters)
{
new BlockChecker(new TypeParameterChecker(acceptableTypeParameters)).Visit(node);
}