本文整理汇总了C#中BinaryOperatorType类的典型用法代码示例。如果您正苦于以下问题:C# BinaryOperatorType类的具体用法?C# BinaryOperatorType怎么用?C# BinaryOperatorType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BinaryOperatorType类属于命名空间,在下文中一共展示了BinaryOperatorType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CommutativeOperator
/// <summary>
/// Produces a choice pattern for <c>expr1 op expr2</c> or <c>expr2 op expr1</c>.
/// </summary>
public static Expression CommutativeOperator(Expression expr1, BinaryOperatorType op, Expression expr2)
{
return new Choice {
new BinaryOperatorExpression(expr1, op, expr2),
new BinaryOperatorExpression(expr2.Clone(), op, expr1.Clone())
};
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:10,代码来源:PatternHelper.cs
示例2: BinaryExpression
public BinaryExpression(LexicalInfo lexicalInfoProvider, BinaryOperatorType operator_, Expression left, Expression right)
: base(lexicalInfoProvider)
{
this.Operator = operator_;
this.Left = left;
this.Right = right;
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:BinaryExpression.cs
示例3: VBNetTestBinaryOperatorExpressionTest
void VBNetTestBinaryOperatorExpressionTest(string program, BinaryOperatorType op)
{
BinaryOperatorExpression boe = ParseUtil.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(op, boe.Op);
Assert.IsTrue(boe.Left is SimpleNameExpression);
Assert.IsTrue(boe.Right is SimpleNameExpression);
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:8,代码来源:BinaryOperatorExpressionTests.cs
示例4: NegateConditionOperator
/// <summary>
/// Get negation of the condition operator
/// </summary>
/// <returns>
/// negation of the specified condition operator, or BinaryOperatorType.Any if it's not a condition operator
/// </returns>
public static BinaryOperatorType NegateConditionOperator(BinaryOperatorType op)
{
switch (op) {
case BinaryOperatorType.ConditionalOr:
return BinaryOperatorType.ConditionalAnd;
case BinaryOperatorType.ConditionalAnd:
return BinaryOperatorType.ConditionalOr;
}
return BinaryOperatorType.Any;
}
开发者ID:porcus,项目名称:NRefactory,代码行数:16,代码来源:CSharpUtil.cs
示例5: BinaryOperatorResolveResult
public BinaryOperatorResolveResult(IType resultType, ResolveResult lhs, BinaryOperatorType op, ResolveResult rhs)
: base(resultType)
{
if (lhs == null)
throw new ArgumentNullException("lhs");
if (rhs == null)
throw new ArgumentNullException("rhs");
this.Left = lhs;
this.Operator = op;
this.Right = rhs;
}
开发者ID:sbeparey,项目名称:ILSpy,代码行数:11,代码来源:OperatorResolveResult.cs
示例6: Create
public static BinaryOperatorNode Create(BinaryOperatorType type, SubExpressionNode left, SubExpressionNode right, Token token, int tokenIndex)
{
switch (type)
{
case BinaryOperatorType.Ampersand:
return new AmpersandBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.AmpersandEqual:
return new AmpersandEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Caret:
return new CaretBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.CaretEqual:
return new CaretEqualBinaryOperaratorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Divide:
return new DivideBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.DivideEqual:
return new DivideEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Minus:
return new MinusBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.MinusEqual:
return new MinusEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Mod:
return new ModBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.ModEqual:
return new ModEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Pipe:
return new PipeBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.PipeEqual:
return new PipeEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Plus:
return new PlusBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.PlusEqual:
return new PlusEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.ShiftLeft:
return new ShiftLeftBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.ShiftLeftEqual:
return new ShiftLeftEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.ShiftRight:
return new ShiftRightBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.ShiftRightEqual:
return new ShiftRightEqualBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.Star:
return new StarBinaryOperatorNode(left, right, token, tokenIndex);
case BinaryOperatorType.StarEqual:
return new StarEqualBinaryOperatorNode(left, right, token, tokenIndex);
default:
throw new InternalCompilerException("Unknown BinaryOperatorType.");
}
}
开发者ID:GregoryComer,项目名称:CSubCompiler,代码行数:48,代码来源:BinaryOperatorNodeFactory.cs
示例7: NegateRelationalOperator
/// <summary>
/// Get negation of the specified relational operator
/// </summary>
/// <returns>
/// negation of the specified relational operator, or BinaryOperatorType.Any if it's not a relational operator
/// </returns>
public static BinaryOperatorType NegateRelationalOperator (BinaryOperatorType op)
{
switch (op) {
case BinaryOperatorType.GreaterThan:
return BinaryOperatorType.LessThanOrEqual;
case BinaryOperatorType.GreaterThanOrEqual:
return BinaryOperatorType.LessThan;
case BinaryOperatorType.Equality:
return BinaryOperatorType.InEquality;
case BinaryOperatorType.InEquality:
return BinaryOperatorType.Equality;
case BinaryOperatorType.LessThan:
return BinaryOperatorType.GreaterThanOrEqual;
case BinaryOperatorType.LessThanOrEqual:
return BinaryOperatorType.GreaterThan;
}
return BinaryOperatorType.Any;
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:24,代码来源:CSharpUtil.cs
示例8: Process
private static string Process(BinaryOperatorType binaryOperatorType)
{
switch (binaryOperatorType)
{
case BinaryOperatorType.Equal:
return " = ";
case BinaryOperatorType.NotEqual:
return " != ";
case BinaryOperatorType.Greater:
return " > ";
case BinaryOperatorType.GreaterOrEqual:
return " >= ";
case BinaryOperatorType.Less:
return " < ";
case BinaryOperatorType.LessOrEqual:
return " <= ";
case BinaryOperatorType.Like:
return " LIKE ";
case BinaryOperatorType.Minus:
return " - ";
case BinaryOperatorType.Plus:
return " + ";
case BinaryOperatorType.Multiply:
return " * ";
case BinaryOperatorType.Divide:
return " / ";
default:
throw new NotSupportedException("Не поддерживаем BinaryOperatorType отличный от 'Equal', 'NotEqual', 'Greater', 'GreaterOrEqual', 'Less', 'LessOrEqual', 'Like', 'Minus', 'Plus', 'Multiply', 'Divide'. Переданное значение BinaryOperatorType: '{0}'".FillWith(binaryOperatorType));
}
}
开发者ID:chiganock,项目名称:VtecTeamFlasher,代码行数:41,代码来源:NHibernateFilterCriteriaProcessor.cs
示例9: SameOperatorPrecedenceTest
void SameOperatorPrecedenceTest(string firstOperator, BinaryOperatorType firstOperatorType,
string secondOperator, BinaryOperatorType secondOperatorType, bool vb)
{
string program = "a " + secondOperator + " b " + firstOperator + " c";
BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(firstOperatorType, boe.Operator);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
Assert.AreEqual(secondOperatorType, boe.Operator);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is IdentifierExpression);
program = "a " + firstOperator + " b " + secondOperator + " c";
boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(secondOperatorType, boe.Operator);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
Assert.AreEqual(firstOperatorType, boe.Operator);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is IdentifierExpression);
}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:21,代码来源:BinaryOperatorExpressionTests.cs
示例10: BinaryOperator
public BinaryOperator(IElementCreationContext context, BinaryOperatorType defaultOperatorType)
: base(context, context.Owner.GetFloatType())
{
var services = new []
{
new BinaryOperatorService(BinaryOperatorType.Addition, "+", (a, b) => a + b),
new BinaryOperatorService(BinaryOperatorType.Subtraction, "-", (a, b) => a - b),
new BinaryOperatorService(BinaryOperatorType.Multiplication, "*", (a, b) => a * b),
new BinaryOperatorService(BinaryOperatorType.Division, "/", (a, b) => a / b),
new BinaryOperatorService(BinaryOperatorType.ShiftLeft, "<<", (a, b) => a << b),
new BinaryOperatorService(BinaryOperatorType.ShiftRight, ">>", (a, b) => a >> b),
new BinaryOperatorService(BinaryOperatorType.BitwiseAnd, "&", (a , b) => a & b),
new BinaryOperatorService(BinaryOperatorType.BitwiseOr, "|", (a , b) => a | b),
new BinaryOperatorService(BinaryOperatorType.Modulus, "%", (a , b) => a % b),
};
foreach (var service in services)
{
AddAction(new ElementAction(service.Text, () => OperatorType = service.Type));
}
_services = services.ToDictionary(s => s.Type, s => s);
ParameterA = context.Owner.CreateParameter("a", context.Owner.GetFloatType());
ParameterB = context.Owner.CreateParameter("b", context.Owner.GetFloatType());
Parameters.Add(ParameterA);
Parameters.Add(ParameterB);
Service = _services[BinaryOperatorType.Addition];
OperatorType = defaultOperatorType;
if (!string.IsNullOrWhiteSpace(context.Data))
{
var data = JsonConvert.DeserializeObject<BinaryOperatorData>(context.Data);
OperatorType = data.OperatorType;
}
}
开发者ID:CaptiveAire,项目名称:VPL,代码行数:40,代码来源:BinaryOperator.cs
示例11: OperatorPrecedenceTest
void OperatorPrecedenceTest(string strongOperator, BinaryOperatorType strongOperatorType,
string weakOperator, BinaryOperatorType weakOperatorType, bool vb)
{
string program = "a " + weakOperator + " b " + strongOperator + " c";
BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(weakOperatorType, boe.Operator);
Assert.IsTrue(boe.Left is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Right;
Assert.AreEqual(strongOperatorType, boe.Operator);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is IdentifierExpression);
program = "a " + strongOperator + " b " + weakOperator + " c";
boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
Assert.AreEqual(weakOperatorType, boe.Operator);
Assert.IsTrue(boe.Right is IdentifierExpression);
boe = (BinaryOperatorExpression)boe.Left;
Assert.AreEqual(strongOperatorType, boe.Operator);
Assert.IsTrue(boe.Left is IdentifierExpression);
Assert.IsTrue(boe.Right is IdentifierExpression);
}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:22,代码来源:BinaryOperatorExpressionTests.cs
示例12: BinaryOperatorExpression
public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right)
{
this.left = left;
this.op = op;
this.right = right;
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:6,代码来源:BinaryOperatorExpression.cs
示例13: GetOperatorPrecedence
static int GetOperatorPrecedence(Dictionary<BinaryOperatorType, int> dict, BinaryOperatorType op)
{
int p;
dict.TryGetValue(op, out p);
return p;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:6,代码来源:OperatorPrecedence.cs
示例14: HandleEnumOperator
/// <summary>
/// Handle the following enum operators:
/// E operator +(E x, U y);
/// E operator +(U x, E y);
/// E operator –(E x, U y);
/// E operator &(E x, E y);
/// E operator |(E x, E y);
/// E operator ^(E x, E y);
/// </summary>
ResolveResult HandleEnumOperator(bool isNullable, IType enumType, BinaryOperatorType op, ResolveResult lhs, ResolveResult rhs)
{
// evaluate as (E)((U)x op (U)y)
if (lhs.IsCompileTimeConstant && rhs.IsCompileTimeConstant && !isNullable) {
IType elementType = GetEnumUnderlyingType(enumType);
lhs = ResolveCast(elementType, lhs);
if (lhs.IsError)
return lhs;
rhs = ResolveCast(elementType, rhs);
if (rhs.IsError)
return rhs;
return CheckErrorAndResolveCast(enumType, ResolveBinaryOperator(op, lhs, rhs));
}
IType resultType = MakeNullable(enumType, isNullable);
return BinaryOperatorResolveResult(resultType, lhs, op, rhs);
}
开发者ID:holmak,项目名称:NRefactory,代码行数:25,代码来源:CSharpResolver.cs
示例15: BinaryOperatorResolveResult
ResolveResult BinaryOperatorResolveResult(IType resultType, ResolveResult lhs, BinaryOperatorType op, ResolveResult rhs)
{
return new OperatorResolveResult(resultType, BinaryOperatorExpression.GetLinqNodeType(op, this.CheckForOverflow), lhs, rhs);
}
开发者ID:holmak,项目名称:NRefactory,代码行数:4,代码来源:CSharpResolver.cs
示例16: CreateBoundBinaryExpression
public BinaryExpression CreateBoundBinaryExpression(IType expressionType, BinaryOperatorType op, Expression lhs, Expression rhs)
{
return new BinaryExpression(op, lhs, rhs) { ExpressionType = expressionType, IsSynthetic = true };
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs
示例17: GetRelatedBinaryOperatorForInPlaceOperator
BinaryOperatorType GetRelatedBinaryOperatorForInPlaceOperator(BinaryOperatorType op)
{
switch (op)
{
case BinaryOperatorType.InPlaceAddition:
return BinaryOperatorType.Addition;
case BinaryOperatorType.InPlaceSubtraction:
return BinaryOperatorType.Subtraction;
case BinaryOperatorType.InPlaceMultiply:
return BinaryOperatorType.Multiply;
case BinaryOperatorType.InPlaceDivision:
return BinaryOperatorType.Division;
case BinaryOperatorType.InPlaceModulus:
return BinaryOperatorType.Modulus;
case BinaryOperatorType.InPlaceBitwiseAnd:
return BinaryOperatorType.BitwiseAnd;
case BinaryOperatorType.InPlaceBitwiseOr:
return BinaryOperatorType.BitwiseOr;
case BinaryOperatorType.InPlaceExclusiveOr:
return BinaryOperatorType.ExclusiveOr;
case BinaryOperatorType.InPlaceShiftLeft:
return BinaryOperatorType.ShiftLeft;
case BinaryOperatorType.InPlaceShiftRight:
return BinaryOperatorType.ShiftRight;
}
throw new ArgumentException("op");
}
开发者ID:stuman08,项目名称:boo,代码行数:36,代码来源:ProcessMethodBodies.cs
示例18: CreateSideEffectAwareSlicingOperation
private Expression CreateSideEffectAwareSlicingOperation(LexicalInfo lexicalInfo, BinaryOperatorType binaryOperator, SlicingExpression lvalue, Expression rvalue, InternalLocal returnValue)
{
MethodInvocationExpression eval = CodeBuilder.CreateEvalInvocation(lexicalInfo);
if (HasSideEffect(lvalue.Target))
{
InternalLocal temp = AddInitializedTempLocal(eval, lvalue.Target);
lvalue.Target = CodeBuilder.CreateReference(temp);
}
foreach (Slice slice in lvalue.Indices)
{
Expression index = slice.Begin;
if (HasSideEffect(index))
{
InternalLocal temp = AddInitializedTempLocal(eval, index);
slice.Begin = CodeBuilder.CreateReference(temp);
}
}
BinaryExpression addition = CodeBuilder.CreateBoundBinaryExpression(
GetExpressionType(lvalue),
binaryOperator,
CloneOrAssignToTemp(returnValue, lvalue),
rvalue);
Expression expansion = CodeBuilder.CreateAssignment(
lvalue.CloneNode(),
addition);
// Resolve operator overloads if any
BindArithmeticOperator(addition);
if (eval.Arguments.Count > 0 || null != returnValue)
{
eval.Arguments.Add(expansion);
if (null != returnValue)
{
eval.Arguments.Add(CodeBuilder.CreateReference(returnValue));
}
BindExpressionType(eval, GetExpressionType(lvalue));
expansion = eval;
}
return expansion;
}
开发者ID:stuman08,项目名称:boo,代码行数:41,代码来源:ProcessMethodBodies.cs
示例19: GetBinaryOperatorText
static string GetBinaryOperatorText(BinaryOperatorType op)
{
return BooPrinterVisitor.GetBinaryOperatorText(op);
}
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs
示例20: IsShiftOrHigher
bool IsShiftOrHigher (BinaryOperatorType t)
{
return IsAdditivOrHigher(t) || t == BinaryOperatorType.ShiftLeft || t == BinaryOperatorType.ShiftRight;
}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:4,代码来源:IntegrateTemporaryVariableRefactoring.cs
注:本文中的BinaryOperatorType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论