override public object Clone()
        {
            BoolLiteralExpression clone = (BoolLiteralExpression)FormatterServices.GetUninitializedObject(typeof(BoolLiteralExpression));

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }

            clone._expressionType = _expressionType;
            clone._value          = _value;
            return(clone);
        }
Example #2
0
        override public object Clone()
        {
            BoolLiteralExpression clone = new BoolLiteralExpression();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            clone._expressionType = _expressionType;
            clone._value          = _value;
            return(clone);
        }
Example #3
0
 public override void OnBoolLiteralExpression(BoolLiteralExpression node)
 {
     BindExpressionType(node, TypeSystemServices.BoolType);
 }
Example #4
0
        bool BindNullableComparison(BinaryExpression node)
        {
            if (!IsNullableOperation(node))
                return false;

            if (IsNull(node.Left) || IsNull(node.Right))
            {
                Expression nullable = IsNull(node.Left) ? node.Right : node.Left;
                Expression val = new MemberReferenceExpression(nullable, "HasValue");
                node.Replace(node.Left, val);
                Visit(val);
                Expression nil = new BoolLiteralExpression(false);
                node.Replace(node.Right, nil);
                Visit(nil);
                BindExpressionType(node, TypeSystemServices.BoolType);
                return true;
            }

            BinaryExpression valueCheck = new BinaryExpression(
                (node.Operator == BinaryOperatorType.Inequality)
                    ? BinaryOperatorType.BitwiseOr
                    : BinaryOperatorType.BitwiseAnd,
                new BinaryExpression(
                    GetCorrespondingHasValueOperator(node.Operator),
                    CreateNullableHasValueOrTrueExpression(node.Left),
                    CreateNullableHasValueOrTrueExpression(node.Right)
                ),
                new BinaryExpression(
                    node.Operator,
                    CreateNullableGetValueOrDefaultExpression(node.Left),
                    CreateNullableGetValueOrDefaultExpression(node.Right)
                )
            );
            node.ParentNode.Replace(node, valueCheck);
            Visit(valueCheck);
            return true;
        }
Example #5
0
	protected BoolLiteralExpression  bool_literal() //throws RecognitionException, TokenStreamException
{
		BoolLiteralExpression e;
		
		IToken  t = null;
		IToken  f = null;
		e = null;
		
		try {      // for error handling
			switch ( LA(1) )
			{
			case TRUE:
			{
				t = LT(1);
				match(TRUE);
				if (0==inputState.guessing)
				{
					
							e = new BoolLiteralExpression(ToLexicalInfo(t));
							e.Value = true;
						
				}
				break;
			}
			case FALSE:
			{
				f = LT(1);
				match(FALSE);
				if (0==inputState.guessing)
				{
					
							e = new BoolLiteralExpression(ToLexicalInfo(f));
							e.Value = false;
						
				}
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			 }
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "bool_literal");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
Example #6
0
 public override void OnBoolLiteralExpression(BoolLiteralExpression node)
 {
     if (node.Value)
     {
         _il.Emit(OpCodes.Ldc_I4_1);
     }
     else
     {
         _il.Emit(OpCodes.Ldc_I4_0);
     }
     PushBool();
 }
		public override void OnBoolLiteralExpression(BoolLiteralExpression node)
		{
			MakeResult(projectContent.SystemTypes.Boolean);
		}
 public override void OnBoolLiteralExpression(BoolLiteralExpression node)
 {
     ReplaceWithCallToExpressionConstant(node);
 }
Example #9
0
 public override void OnBoolLiteralExpression(BoolLiteralExpression node)
 {
     if (node.ContainsAnnotation(ConstantFolding.FoldedExpression))
         WarnAboutConstantExpression(node);
 }
		public override void OnBoolLiteralExpression(BoolLiteralExpression node)
		{
			_expression = new CodePrimitiveExpression(node.Value);
		}
Example #11
0
 public override void OnBoolLiteralExpression(BoolLiteralExpression node)
 {
     if (node.Value)
     {
         WriteKeyword("true");
     }
     else
     {
         WriteKeyword("false");
     }
 }
        public Statement for_c(Block container)
        {
            Statement statement = null;
            try
            {
                Expression expression;
                Expression expression2;
                WhileStatement statement3;
                Block block;
                string str;
                switch (this.LA(1))
                {
                    case 0x2d:
                        this.declaration_statement(container);
                        if (base.inputState.guessing == 0)
                        {
                            statement = container.get_Statements().get_Item(-1) as DeclarationStatement;
                            if (statement != null)
                            {
                                statement.Annotate("PrivateScope");
                            }
                        }
                        break;

                    case 12:
                    case 15:
                    case 0x13:
                    case 0x1b:
                    case 0x1d:
                    case 0x27:
                    case 40:
                    case 0x2a:
                    case 0x2c:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3f:
                    case 0x44:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                    case 0x6d:
                        this.expression_statement(container);
                        break;

                    case 0x4d:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                this.match(0x4d);
                switch (this.LA(1))
                {
                    case 12:
                    case 15:
                    case 0x13:
                    case 0x1b:
                    case 0x1d:
                    case 0x27:
                    case 40:
                    case 0x2a:
                    case 0x2c:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3f:
                    case 0x44:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                    case 0x6d:
                        expression = this.expression();
                        break;

                    case 0x4d:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                this.match(0x4d);
                switch (this.LA(1))
                {
                    case 12:
                    case 15:
                    case 0x13:
                    case 0x1b:
                    case 0x1d:
                    case 0x27:
                    case 40:
                    case 0x2a:
                    case 0x2c:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3f:
                    case 0x44:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                    case 0x6d:
                        expression2 = this.assignment_expression();
                        break;

                    case 0x40:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                if (base.inputState.guessing == 0)
                {
                    WhileStatement statement2;
                    WhileStatement statement1 = statement2 = new WhileStatement();
                    statement2.set_Condition(expression);
                    statement3 = statement2;
                    if (expression == null)
                    {
                        BoolLiteralExpression expression3;
                        BoolLiteralExpression expression1 = expression3 = new BoolLiteralExpression();
                        expression3.set_Value(true);
                        statement3.set_Condition(expression3);
                    }
                    block = statement3.get_Block();
                    statement = statement3;
                    str = this.SetUpLoopLabel(statement3);
                    container.Add(statement);
                    this.EnterLoop(statement3);
                }
                this.match(0x40);
                this.compound_or_single_stmt(block);
                if (base.inputState.guessing != 0)
                {
                    return statement;
                }
                this.LeaveLoop(statement3);
                if (this.IsLabelInUse(statement3))
                {
                    LabelStatement statement4;
                    LabelStatement statement5 = statement4 = new LabelStatement();
                    statement4.set_Name(str);
                    block.Add(statement4);
                }
                if (expression2 != null)
                {
                    block.Add(expression2);
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_15_);
                return statement;
            }
            return statement;
        }
        public BoolLiteralExpression bool_literal()
        {
            BoolLiteralExpression expression = null;
            IToken token = null;
            IToken token2 = null;
            try
            {
                switch (this.LA(1))
                {
                    case 0x2a:
                        token = this.LT(1);
                        this.match(0x2a);
                        if (base.inputState.guessing == 0)
                        {
                            BoolLiteralExpression expression2;
                            BoolLiteralExpression expression1 = expression2 = new BoolLiteralExpression(ToLexicalInfo(token));
                            expression2.set_Value(true);
                            expression = expression2;
                        }
                        return expression;

                    case 15:
                        token2 = this.LT(1);
                        this.match(15);
                        if (base.inputState.guessing == 0)
                        {
                            BoolLiteralExpression expression3;
                            BoolLiteralExpression expression4 = expression3 = new BoolLiteralExpression(ToLexicalInfo(token2));
                            expression3.set_Value(false);
                            expression = expression3;
                        }
                        return expression;
                }
                throw new NoViableAltException(this.LT(1), this.getFilename());
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_20_);
                return expression;
            }
            return expression;
        }
Example #14
0
		override public object Clone()
		{
		
			BoolLiteralExpression clone = new BoolLiteralExpression();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._expressionType = _expressionType;
			clone._value = _value;
			return clone;


		}
Example #15
0
 public BoolLiteralExpression CreateBoolLiteral(bool value)
 {
     BoolLiteralExpression expression = new BoolLiteralExpression(value);
     expression.ExpressionType = _tss.BoolType;
     return expression;
 }