本文整理汇总了C#中ExprContext类的典型用法代码示例。如果您正苦于以下问题:C# ExprContext类的具体用法?C# ExprContext怎么用?C# ExprContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExprContext类属于命名空间,在下文中一共展示了ExprContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FalseLiteralContext
public FalseLiteralContext(ExprContext context) { CopyFrom(context); }
示例2: VisitExpression
public BoundExpression VisitExpression(BoundExpression node, ExprContext context)
{
var prevContext = _context;
int prevStack = StackDepth();
_context = context;
// Do not recurse into constant expressions. Their children do not push any values.
var result = node.ConstantValue == null ?
node = (BoundExpression)base.Visit(node) :
node;
_context = prevContext;
_counter += 1;
switch (context)
{
case ExprContext.Sideeffects:
SetStackDepth(prevStack);
break;
case ExprContext.AssignmentTarget:
break;
case ExprContext.Value:
case ExprContext.Address:
case ExprContext.Box:
SetStackDepth(prevStack);
PushEvalStack(node, context);
break;
default:
throw ExceptionUtilities.UnexpectedValue(context);
}
return result;
}
示例3: VisitExpression
private BoundExpression VisitExpression(BoundExpression node, ExprContext context)
{
BoundExpression result;
_recursionDepth++;
if (_recursionDepth > 1)
{
StackGuard.EnsureSufficientExecutionStack(_recursionDepth);
result = VisitExpressionCore(node, context);
}
else
{
result = VisitExpressionCoreWithStackGuard(node, context);
}
_recursionDepth--;
return result;
}
示例4: PushEvalStack
private void PushEvalStack(BoundExpression result, ExprContext context)
{
Debug.Assert(result != null || context == ExprContext.None);
_evalStack.Add((result, context));
}
示例5: VisitExpression
public BoundExpression VisitExpression(BoundExpression node, ExprContext context)
{
var prevContext = _context;
int prevStack = _evalStack;
_context = context;
var result = ReuseOrVisit(node, context);
_counter += 1;
switch (context)
{
case ExprContext.Sideeffects:
_evalStack = prevStack;
break;
case ExprContext.Value:
case ExprContext.Address:
case ExprContext.Box:
_evalStack = prevStack + 1;
break;
case ExprContext.AssignmentTarget:
_evalStack = prevStack;
if (LhsUsesStackWhenAssignedTo(node, context))
{
_evalStack = prevStack + 1;
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(context);
}
_context = prevContext;
return result;
}
示例6: 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;
}
示例7: IfStatementContext
public IfStatementContext(ExprContext context) { CopyFrom(context); }
示例8: SignContext
public SignContext(ExprContext context) { CopyFrom(context); }
示例9: TrueLiteralContext
public TrueLiteralContext(ExprContext context) { CopyFrom(context); }
示例10: IndexContext
public IndexContext(ExprContext context) { CopyFrom(context); }
示例11: InfLiteralContext
public InfLiteralContext(ExprContext context) { CopyFrom(context); }
示例12: FunctionCallContext
public FunctionCallContext(ExprContext context) { CopyFrom(context); }
示例13: ComplexLiteralContext
public ComplexLiteralContext(ExprContext context) { CopyFrom(context); }
示例14: expr
public ExprContext expr() {
ExprContext _localctx = new ExprContext(Context, State);
EnterRule(_localctx, 112, RULE_expr);
int _la;
try {
EnterOuterAlt(_localctx, 1);
{
State = 748; xor_expr();
State = 753;
ErrorHandler.Sync(this);
_la = TokenStream.La(1);
while (_la==OR_OP) {
{
{
State = 749; Match(OR_OP);
State = 750; xor_expr();
}
}
State = 755;
ErrorHandler.Sync(this);
_la = TokenStream.La(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
ErrorHandler.ReportError(this, re);
ErrorHandler.Recover(this, re);
}
finally {
ExitRule();
}
return _localctx;
}
示例15: UserOpContext
public UserOpContext(ExprContext context) { CopyFrom(context); }