|
|
|
@ -199,11 +199,49 @@ namespace Grunwald.BooBinding.Designer |
|
|
|
_class.Members.Add(method); |
|
|
|
_class.Members.Add(method); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static CodeBinaryOperatorType GetOperatorType(BinaryOperatorType op) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (op) { |
|
|
|
|
|
|
|
case BinaryOperatorType.Addition: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Add; |
|
|
|
|
|
|
|
case BinaryOperatorType.And: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.BooleanAnd; |
|
|
|
|
|
|
|
case BinaryOperatorType.BitwiseAnd: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.BitwiseAnd; |
|
|
|
|
|
|
|
case BinaryOperatorType.BitwiseOr: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.BitwiseOr; |
|
|
|
|
|
|
|
case BinaryOperatorType.Division: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Divide; |
|
|
|
|
|
|
|
case BinaryOperatorType.Equality: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.ValueEquality; |
|
|
|
|
|
|
|
case BinaryOperatorType.GreaterThan: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.GreaterThan; |
|
|
|
|
|
|
|
case BinaryOperatorType.GreaterThanOrEqual: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.GreaterThanOrEqual; |
|
|
|
|
|
|
|
case BinaryOperatorType.LessThan: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.LessThan; |
|
|
|
|
|
|
|
case BinaryOperatorType.LessThanOrEqual: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.LessThanOrEqual; |
|
|
|
|
|
|
|
case BinaryOperatorType.Modulus: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Modulus; |
|
|
|
|
|
|
|
case BinaryOperatorType.Multiply: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Multiply; |
|
|
|
|
|
|
|
case BinaryOperatorType.Or: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.BooleanOr; |
|
|
|
|
|
|
|
case BinaryOperatorType.Subtraction: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Subtract; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return CodeBinaryOperatorType.Assign; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void OnBinaryExpression(BinaryExpression node) |
|
|
|
public override void OnBinaryExpression(BinaryExpression node) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BinaryOperatorType op = node.Operator; |
|
|
|
|
|
|
|
if (op == BinaryOperatorType.Assign) { |
|
|
|
|
|
|
|
_expression = null; |
|
|
|
_expression = null; |
|
|
|
|
|
|
|
CodeBinaryOperatorType op = GetOperatorType(node.Operator); |
|
|
|
|
|
|
|
if (op == CodeBinaryOperatorType.Assign) { |
|
|
|
|
|
|
|
// non-standard op
|
|
|
|
|
|
|
|
if (node.Operator == BinaryOperatorType.Assign) { |
|
|
|
node.Left.Accept(this); |
|
|
|
node.Left.Accept(this); |
|
|
|
CodeExpression left = _expression; |
|
|
|
CodeExpression left = _expression; |
|
|
|
_expression = null; |
|
|
|
_expression = null; |
|
|
|
@ -211,8 +249,7 @@ namespace Grunwald.BooBinding.Designer |
|
|
|
if (left != null && _expression != null) |
|
|
|
if (left != null && _expression != null) |
|
|
|
_statements.Add(new CodeAssignStatement(left, _expression)); |
|
|
|
_statements.Add(new CodeAssignStatement(left, _expression)); |
|
|
|
_expression = null; |
|
|
|
_expression = null; |
|
|
|
} else if (op == BinaryOperatorType.InPlaceAddition) { |
|
|
|
} else if (node.Operator == BinaryOperatorType.InPlaceAddition) { |
|
|
|
_expression = null; |
|
|
|
|
|
|
|
node.Left.Accept(this); |
|
|
|
node.Left.Accept(this); |
|
|
|
CodeEventReferenceExpression left = _expression as CodeEventReferenceExpression; |
|
|
|
CodeEventReferenceExpression left = _expression as CodeEventReferenceExpression; |
|
|
|
_expression = null; |
|
|
|
_expression = null; |
|
|
|
@ -221,7 +258,14 @@ namespace Grunwald.BooBinding.Designer |
|
|
|
_statements.Add(new CodeAttachEventStatement(left, _expression)); |
|
|
|
_statements.Add(new CodeAttachEventStatement(left, _expression)); |
|
|
|
_expression = null; |
|
|
|
_expression = null; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LoggingService.Warn("CodeDomVisitor: ignoring unknown Binary Operator" + op); |
|
|
|
LoggingService.Warn("CodeDomVisitor: ignoring unknown Binary Operator" + node.Operator); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
node.Left.Accept(this); |
|
|
|
|
|
|
|
CodeExpression left = _expression; |
|
|
|
|
|
|
|
_expression = null; |
|
|
|
|
|
|
|
node.Right.Accept(this); |
|
|
|
|
|
|
|
_expression = new CodeBinaryOperatorExpression(left, op, _expression); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|