本文整理汇总了C#中Opcode.Unary方法的典型用法代码示例。如果您正苦于以下问题:C# Opcode.Unary方法的具体用法?C# Opcode.Unary怎么用?C# Opcode.Unary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opcode
的用法示例。
在下文中一共展示了Opcode.Unary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Op
}//OpsAt
/// <summary>
/// push right-associative operator (assign or special)
/// </summary>
public Parser Op( Opcode op )
{
Debug.Assert( ((op == Opcode.Comma) || (op.Prior() <= Opcode.Assign.Prior())) || (op.Unary() && (!op.Postfix())) );
if( OpsAt == Ops.Length )
{
Array.Resize( ref _ops, Ops.Length << 1 );
}
Ops[OpsAt++] = op;
return this;
}//Op
示例2: ParseError
/// <summary>
/// prepare top operator (prepare postfix record or expression tree node)
/// </summary>
void Parser.IGenerator.Prepare( Opcode op )
{
Debug.Assert( (op.Kind() <= Opkind.Prepost) && (op.Kind() >= Opkind.Special) );
if( op.Binary() )
{
goto binary;
}
if( op.Ternary() )
{
goto ternary;
}
if( op.Multi() )
{
goto multi;
}
Debug.Assert( op.Unary() );
var start = PopInt();
Vneed( 1 );
Vpush( unchecked((byte)op) );
Vpush( start );
return;
binary:
var rstart = TopInt();
var lstart = TopInt( rstart );
Vneed( 5 );
Vpush( op.Code() );
Vpush( lstart );
return;
ternary:
var fstart = TopInt();
var tstart = TopInt( fstart );
var cstart = TopInt( tstart );
Vneed( 5 );
Vpush( op.Code() );
Vpush( cstart );
return;
multi:
Debug.Assert( (((op == Opcode.Mcall) || (op == Opcode.Mindex)) || (op == Opcode.Array)) || (op == Opcode.Generic) );
var mstart = TopInt();
var n = 1;
if( (op == Opcode.Mcall) || (op == Opcode.Mindex) )
{
n++;
mstart = TopInt( mstart );
}
while( (Parser.OpsAt > 0) && (Parser.Top() == Opcode.Comma) ){
Parser.Pop();
n++;
mstart = TopInt( mstart );
}
if( n > 127 )
{
throw new ParseError( Parser, "Too many arguments" );
}
if( (n == 3) && (op == Opcode.Mcall) )
{
Vneed( 5 );
Vpush( unchecked((byte)Opcode.Call2) );
Vpush( mstart );
return;
}
Vneed( 6 );
Vpush( unchecked((byte)n) );
Vpush( op.Code() );
Vpush( mstart );
return;
}//Parser.IGenerator.Prepare