本文整理汇总了C#中Mono.CSharp.UnaryMutator类的典型用法代码示例。如果您正苦于以下问题:C# UnaryMutator类的具体用法?C# UnaryMutator怎么用?C# UnaryMutator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnaryMutator类属于Mono.CSharp命名空间,在下文中一共展示了UnaryMutator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FallbackUnaryOperation
public override DynamicMetaObject FallbackUnaryOperation (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
{
Compiler.Expression expr = CSharpBinder.CreateCompilerExpression (argumentInfo [0], target);
if (Operation == ExpressionType.IsTrue) {
expr = new Compiler.BooleanExpression (expr);
} else {
if (Operation == ExpressionType.Increment)
expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreIncrement, expr, Compiler.Location.Null);
else if (Operation == ExpressionType.Decrement)
expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreDecrement, expr, Compiler.Location.Null);
else
expr = new Compiler.Unary (GetOperator (), expr, Compiler.Location.Null);
expr = new Compiler.Cast (new Compiler.TypeExpression (TypeImporter.Import (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
if ((flags & CSharpBinderFlags.CheckedContext) != 0)
expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
}
var binder = new CSharpBinder (this, expr, errorSuggestion);
binder.AddRestrictions (target);
return binder.Bind (context);
}
示例2: Visit
public override object Visit (UnaryMutator unaryMutatorExpression)
{
var result = new UnaryOperatorExpression ();
INode expression = (INode)unaryMutatorExpression.Expr.Accept (this);
switch (unaryMutatorExpression.UnaryMutatorMode) {
case UnaryMutator.Mode.PostDecrement:
result.UnaryOperatorType = UnaryOperatorType.PostDecrement;
result.AddChild (expression, UnaryOperatorExpression.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (unaryMutatorExpression.Location), 2), UnaryOperatorExpression.Operator);
break;
case UnaryMutator.Mode.PostIncrement:
result.UnaryOperatorType = UnaryOperatorType.PostIncrement;
result.AddChild (expression, UnaryOperatorExpression.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (unaryMutatorExpression.Location), 2), UnaryOperatorExpression.Operator);
break;
case UnaryMutator.Mode.PreIncrement:
result.UnaryOperatorType = UnaryOperatorType.Increment;
result.AddChild (new CSharpTokenNode (Convert (unaryMutatorExpression.Location), 2), UnaryOperatorExpression.Operator);
result.AddChild (expression, UnaryOperatorExpression.Roles.Expression);
break;
case UnaryMutator.Mode.PreDecrement:
result.UnaryOperatorType = UnaryOperatorType.Decrement;
result.AddChild (new CSharpTokenNode (Convert (unaryMutatorExpression.Location), 2), UnaryOperatorExpression.Operator);
result.AddChild (expression, UnaryOperatorExpression.Roles.Expression);
break;
}
return result;
}
示例3: case_576
void case_576()
#line 4147 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new UnaryMutator (UnaryMutator.Mode.PreDecrement, null, GetLocation (yyVals[-1+yyTop]));
}
示例4: yyparse
//.........这里部分代码省略.........
case 484:
case_484();
break;
case 485:
case_485();
break;
case 486:
case_486();
break;
case 487:
case_487();
break;
case 488:
#line 3569 "cs-parser.jay"
{
yyVal = new Argument ((Expression) yyVals[0+yyTop]);
}
break;
case 490:
#line 3577 "cs-parser.jay"
{
yyVal = new This (GetLocation (yyVals[0+yyTop]));
}
break;
case 491:
case_491();
break;
case 492:
case_492();
break;
case 493:
#line 3597 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 494:
#line 3604 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 495:
case_495();
break;
case 496:
case_496();
break;
case 497:
case_497();
break;
case 498:
case_498();
break;
case 499:
case_499();
break;
case 500:
case_500();
break;
case 501:
case_501();
break;
case 502:
#line 3671 "cs-parser.jay"
{
示例5: Visit
public virtual object Visit (UnaryMutator unaryMutatorExpression)
{
return null;
}
示例6: yyparse
//.........这里部分代码省略.........
case 484:
case_484();
break;
case 485:
case_485();
break;
case 486:
case_486();
break;
case 487:
case_487();
break;
case 488:
#line 3371 "cs-parser.jay"
{
yyVal = new Argument ((Expression) yyVals[0+yyTop]);
}
break;
case 490:
#line 3379 "cs-parser.jay"
{
yyVal = new This (GetLocation (yyVals[0+yyTop]));
}
break;
case 491:
case_491();
break;
case 492:
case_492();
break;
case 493:
#line 3399 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 494:
#line 3406 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 495:
case_495();
break;
case 496:
case_496();
break;
case 497:
case_497();
break;
case 498:
case_498();
break;
case 499:
case_499();
break;
case 500:
case_500();
break;
case 501:
case_501();
break;
case 502:
#line 3472 "cs-parser.jay"
{
示例7: yyparse
//.........这里部分代码省略.........
{
yyVal = new Argument ((Expression) yyVals[0+yyTop]);
}
break;
case 482:
#line 3371 "cs-parser.jay"
{
yyVal = new This (current_block, GetLocation (yyVals[0+yyTop]));
}
break;
case 483:
#line 3378 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
yyVal = new BaseAccess (lt.Value, (TypeArguments) yyVals[0+yyTop], lt.Location);
}
break;
case 484:
#line 3383 "cs-parser.jay"
{
yyVal = new BaseIndexerAccess ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-3+yyTop]));
}
break;
case 485:
#line 3387 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new BaseAccess (null, GetLocation (yyVals[0+yyTop]));
}
break;
case 486:
#line 3395 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 487:
#line 3402 "cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 488:
#line 3409 "cs-parser.jay"
{
if (yyVals[0+yyTop] != null) {
if (RootContext.Version <= LanguageVersion.ISO_2)
Report.FeatureIsNotAvailable (GetLocation (yyVals[-4+yyTop]), "object initializers");
yyVal = new NewInitialize ((Expression) yyVals[-4+yyTop], (Arguments) yyVals[-2+yyTop], (CollectionOrObjectInitializers) yyVals[0+yyTop], GetLocation (yyVals[-4+yyTop]));
}
else
yyVal = new New ((Expression) yyVals[-4+yyTop], (Arguments) yyVals[-2+yyTop], GetLocation (yyVals[-4+yyTop]));
}
break;
case 489:
#line 3420 "cs-parser.jay"
{
if (RootContext.Version <= LanguageVersion.ISO_2)
Report.FeatureIsNotAvailable (GetLocation (yyVals[-1+yyTop]), "collection initializers");
yyVal = new NewInitialize ((Expression) yyVals[-1+yyTop], null, (CollectionOrObjectInitializers) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 490:
#line 3432 "cs-parser.jay"
示例8: yyparse
//.........这里部分代码省略.........
case 502:
#line 3720 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new Argument ((Expression) yyVals[0+yyTop]);
}
break;
case 504:
#line 3728 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if(isRoleMethod) {
report.Error (10077, lexer.Location,
"Can't use this explicitly in role methods. Use self or role name to refer to the role");
}
yyVal = new This (GetLocation (yyVals[0+yyTop]));
}
break;
case 505:
#line 3739 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new ElementAccess (new BaseThis (GetLocation (yyVals[-3+yyTop])), (Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
break;
case 506:
#line 3744 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new ElementAccess (null, null, GetLocation (yyVals[-1+yyTop]));
}
break;
case 507:
#line 3752 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 508:
#line 3759 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
}
break;
case 509:
#line 3766 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (yyVals[0+yyTop] != null) {
if (lang_version <= LanguageVersion.ISO_2)
FeatureIsNotAvailable (GetLocation (yyVals[-5+yyTop]), "object initializers");
yyVal = new NewInitialize ((FullNamedExpression) yyVals[-4+yyTop], (Arguments) yyVals[-2+yyTop], (CollectionOrObjectInitializers) yyVals[0+yyTop], GetLocation (yyVals[-5+yyTop]));
} else {
yyVal = new New ((FullNamedExpression) yyVals[-4+yyTop], (Arguments) yyVals[-2+yyTop], GetLocation (yyVals[-5+yyTop]));
}
lbag.AddLocation (yyVal, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[-1+yyTop]));
}
break;
case 510:
#line 3779 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (lang_version <= LanguageVersion.ISO_2)
FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "collection initializers");
yyVal = new NewInitialize ((FullNamedExpression) yyVals[-1+yyTop], null, (CollectionOrObjectInitializers) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]));
}
break;