• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Ast.ExpressionStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Boo.Lang.Compiler.Ast.ExpressionStatement的典型用法代码示例。如果您正苦于以下问题:C# ExpressionStatement类的具体用法?C# ExpressionStatement怎么用?C# ExpressionStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExpressionStatement类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了ExpressionStatement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnExpressionStatement

 public override void OnExpressionStatement(ExpressionStatement node)
 {
     var e = node as ExpressionStatement;
     if(null!=e && e.Expression is BinaryExpression){
         Visit(e.Expression as BinaryExpression);
     }
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:7,代码来源:AssignsAreAttributes.cs


示例2: LeaveExpressionStatement

		override public void LeaveExpressionStatement(ExpressionStatement node)
		{
			// allow interactive evaluation of closures (see booish)
			var converted = ConvertExpression(node.Expression);
			if (converted != null)
				node.Expression = converted;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:InjectCallableConversions.cs


示例3: LeaveExpressionStatement

        public override void LeaveExpressionStatement(ExpressionStatement node)
        {
            IntegerLiteralExpression literal = node.Expression as IntegerLiteralExpression;
            if (null == literal)
                return;

            AssertLiteralInRange(literal, GetExpressionType(literal));
        }
开发者ID:neonux,项目名称:boo,代码行数:8,代码来源:CheckLiteralValues.cs


示例4: Lift

		public static TypeMember Lift(ExpressionStatement stmt)
		{
			var e = stmt.Expression;
			var closure = e as BlockExpression;
			if (closure != null)
				return TypeMember.Lift(closure);

			throw new NotImplementedException(stmt.ToCodeString());
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:9,代码来源:TypeMember.cs


示例5: OnExpressionStatement

 public override void OnExpressionStatement(ExpressionStatement es)
 {
     if (es.Expression is MethodInvocationExpression)
         es.Expression = ReplaceExpression(es.Expression);
     else if (es.Expression is BinaryExpression)
     {
         BinaryExpression expression = (BinaryExpression)es.Expression;
         expression.Right = ReplaceExpression(expression.Right);
     }
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:10,代码来源:RegisterComponentAndFacilitiesAfterCreation.cs


示例6: OnExpressionStatement

 public override void OnExpressionStatement(ExpressionStatement node)
 {
     base.OnExpressionStatement(node);
     base.EnsureDocumentInitialized(node);
     Expression expression = node.get_Expression();
     SourceLocation self = base.doc.TokenSourceLocationFollowing(BooExtensions.AsLexicalInfo(expression.get_EndSourceLocation(), null), ";");
     if (self != null)
     {
         node.set_EndSourceLocation(BooExtensions.OffsetedBy(self, 0, -2));
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:11,代码来源:FixParsedSourceLocations.cs


示例7: ReplaceWithInitializer

		static void ReplaceWithInitializer(DeclarationStatement decl)
		{
			if (decl.Initializer == null) {
				decl.ReplaceBy(null);
			} else {
				ExpressionStatement statement = new ExpressionStatement(decl.LexicalInfo);
				statement.Expression = new BinaryExpression(decl.LexicalInfo, BinaryOperatorType.Assign,
				                                            new ReferenceExpression(decl.Declaration.LexicalInfo, decl.Declaration.Name),
				                                            decl.Initializer);
				decl.ReplaceBy(statement);
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:RenameLocalsVisitor.cs


示例8: Expression_statement_is_transformed

        public void Expression_statement_is_transformed()
        {
            LiteralExpression exp = new StringLiteralExpression("arg1");
            ExpressionStatement doStuffStatement = new ExpressionStatement(exp);

            MacroStatement fixture = new MacroStatement(new LexicalInfo("test", 1, 1));
            fixture.Name = "DoStuff";
            fixture.Block = new Block();
            fixture.Block.Add(doStuffStatement);

            BlockToArgumentsTransformer transformer = new BlockToArgumentsTransformer("DoStuff");
            transformer.Visit(fixture);

            Assert.AreEqual(exp, fixture.Arguments[0]);
            Assert.IsFalse(fixture.Block.HasStatements, "MacroStatement block should be empty after transformation.");
        }
开发者ID:neilb14,项目名称:rhino-dsl,代码行数:16,代码来源:BlockToArgumentsTestFixture.cs


示例9: OnExpressionStatement

 public override void OnExpressionStatement(ExpressionStatement node)
 {
     if (node.Expression is LiteralExpression)
     {
         CurrentText.AppendLine( node.Expression.expand());
     }
     else if(node.Expression is UnaryExpression){
         var u = node.Expression as UnaryExpression;
         if(u.Operator==UnaryOperatorType.UnaryNegation){
             CurrentText.Append("-");
             CurrentText.Append(u.Operand.ToCodeString());
         }
     }else if(node.Expression is ExpressionInterpolationExpression){
         CurrentText.Append(node.Expression.expand());
     }
     else{
         base.OnExpressionStatement(node);
     }
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:19,代码来源:AssignsLiteralsAsTextStep.cs


示例10: MacroStatement_with_block_is_transformed_to_MethodInvocationExpression

        public void MacroStatement_with_block_is_transformed_to_MethodInvocationExpression()
        {
            const string methodInBlockName = "some_method";
            const string doStuff = "DoStuff";

            Expression argInBlockExpression = new StringLiteralExpression("argInBlock");
            Statement argInBlockStatement = new ExpressionStatement(argInBlockExpression);

            MacroStatement statementInBlock = GetMacroStatement(methodInBlockName, argInBlockStatement);

            MacroStatement doStuffStatement = GetMacroStatement(doStuff, statementInBlock);

            BlockToArgumentsTransformer transformer = new BlockToArgumentsTransformer(doStuff, methodInBlockName);
            transformer.Visit(doStuffStatement);

            MethodInvocationExpression mie = doStuffStatement.Arguments[0] as MethodInvocationExpression;

            Assert.IsNotNull(mie, "Could not cast argument one of MacroStatement to MethodInvocationExpression.");
            Assert.AreEqual(methodInBlockName, (mie.Target as ReferenceExpression).Name);
            Assert.IsAssignableFrom(typeof (BlockExpression), mie.Arguments[0]);
        }
开发者ID:neilb14,项目名称:rhino-dsl,代码行数:21,代码来源:BlockToArgumentsTestFixture.cs


示例11: OnExpressionStatement

            public override void OnExpressionStatement(ExpressionStatement node) {

                if(isWrite(node.Expression)) {
                    var arg = get_arg(node.Expression);
                    var first = arg;
                    if (!(arg is ExpressionInterpolationExpression))
                    {
                        
                        arg = new ExpressionInterpolationExpression();
                    }
                    var block = ((Block) node.ParentNode);
                    var index = block.Statements.IndexOf(node);
                    if(index==-1) return;
                    while (true) {
                        if (index > block.Statements.Count - 2) break;
                        var next = block.Statements[index + 1];
                        if(!(next is ExpressionStatement))break;
                        if(!isWrite(((ExpressionStatement)next).Expression)) break;
                        block.Statements.Remove(next);
                        var nextarg = get_arg(((ExpressionStatement) next).Expression);
                        if (nextarg is ExpressionInterpolationExpression)
                        {
                            foreach (var e in ((ExpressionInterpolationExpression)nextarg).Expressions) {
                                ((ExpressionInterpolationExpression)arg).Expressions.Add(e);  
                            }
                        }
                        else {
                            ((ExpressionInterpolationExpression) arg).Expressions.Add(nextarg);
                        }
                    }
                    if(((ExpressionInterpolationExpression)arg).Expressions.Count>0) {
                        if (first != arg) {
                            ((ExpressionInterpolationExpression) arg).Expressions.Insert(0, first);
                        }
                        set_arg(node.Expression, arg);
                    }
                }
            }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:38,代码来源:OutputWriteUnification.cs


示例12: EnterExpressionStatement

 public override bool EnterExpressionStatement(ExpressionStatement node)
 {
     EmitDebugInfo(node);
     return true;
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs


示例13: LeaveExpressionStatement

 public override void LeaveExpressionStatement(ExpressionStatement node)
 {
     // if the type of the inner expression is not
     // void we need to pop its return value to leave
     // the stack sane
     DiscardValueOnStack();
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:7,代码来源:EmitAssembly.cs


示例14: assignment_or_method_invocation_with_block_stmt

        //throws RecognitionException, TokenStreamException
        protected Statement assignment_or_method_invocation_with_block_stmt()
        {
            Statement stmt;

            IToken  op = null;

                stmt = null;
                Expression lhs = null;
                Expression rhs = null;
                StatementModifier modifier = null;
                BinaryOperatorType binaryOperator = BinaryOperatorType.None;
                IToken token = null;

            try {      // for error handling
            lhs=slicing_expression();
            {
                switch ( LA(1) )
                {
                case DEF:
                case DO:
                case COLON:
                {
                    {
                        lhs=method_invocation_block(lhs);
                        if (0==inputState.guessing)
                        {
                            stmt = new ExpressionStatement(lhs);
                        }
                    }
                    break;
                }
                case ASSIGN:
                {
                    {
                        {
                            op = LT(1);
                            match(ASSIGN);
                            if (0==inputState.guessing)
                            {
                                token = op; binaryOperator = OperatorParser.ParseAssignment(op.getText());
                            }
                            {
                                switch ( LA(1) )
                                {
                                case DEF:
                                case DO:
                                case COLON:
                                {
                                    rhs=callable_expression();
                                    break;
                                }
                                case ESEPARATOR:
                                case CAST:
                                case CHAR:
                                case FALSE:
                                case NOT:
                                case NULL:
                                case SELF:
                                case SUPER:
                                case TRUE:
                                case TYPEOF:
                                case ID:
                                case TRIPLE_QUOTED_STRING:
                                case LPAREN:
                                case DOUBLE_QUOTED_STRING:
                                case SINGLE_QUOTED_STRING:
                                case LBRACK:
                                case SUBTRACT:
                                case COMMA:
                                case SPLICE_BEGIN:
                                case DOT:
                                case MULTIPLY:
                                case LBRACE:
                                case QQ_BEGIN:
                                case LONG:
                                case INCREMENT:
                                case DECREMENT:
                                case ONES_COMPLEMENT:
                                case INT:
                                case RE_LITERAL:
                                case DOUBLE:
                                case FLOAT:
                                case TIMESPAN:
                                {
                                    {
                                        rhs=array_or_expression();
                                        {
                                            switch ( LA(1) )
                                            {
                                            case DEF:
                                            case DO:
                                            case COLON:
                                            {
                                                rhs=method_invocation_block(rhs);
                                                break;
                                            }
                                            case IF:
                                            case UNLESS:
                                            case WHILE:
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs


示例15: expression_stmt

        //throws RecognitionException, TokenStreamException
        protected ExpressionStatement expression_stmt()
        {
            ExpressionStatement s;

                s = null;
                Expression e = null;

            try {      // for error handling
            e=assignment_expression();
            if (0==inputState.guessing)
            {

                        s = new ExpressionStatement(e);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex, "expression_stmt");
                recover(ex,tokenSet_21_);
            }
            else
            {
                throw ex;
            }
            }
            return s;
        }
开发者ID:bmavity,项目名称:boo,代码行数:31,代码来源:BooParserBase.cs


示例16: LeaveExpressionStatement

 public override void LeaveExpressionStatement(ExpressionStatement node)
 {
     LeaveStatement(node);
 }
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:NormalizeStatementModifiers.cs


示例17: LeaveExpressionStatement

 public override void LeaveExpressionStatement(ExpressionStatement node)
 {
     // allow interactive evaluation of closures (see booish)
     Expression converted = ConvertExpression(node.Expression);
     if (null != converted)
     {
         node.Expression = converted;
     }
 }
开发者ID:rmartinho,项目名称:boo,代码行数:9,代码来源:InjectCallableConversions.cs


示例18: OnExpressionStatement

 public override void OnExpressionStatement(ExpressionStatement node)
 {
     WriteIndented();
     Visit(node.Expression);
     Visit(node.Modifier);
     WriteLine();
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:BooPrinterVisitor.cs


示例19: closure_expression_stmt

	protected Statement  closure_expression_stmt() //throws RecognitionException, TokenStreamException
{
		Statement s;
		
		
			s = null;
			Expression e = null;
		
		
		try {      // for error handling
			e=array_or_expression();
			if (0==inputState.guessing)
			{
				s = new ExpressionStatement(e);
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "closure_expression_stmt");
				recover(ex,tokenSet_90_);
			}
			else
			{
				throw ex;
			}
		}
		return s;
	}
开发者ID:hlizard,项目名称:boo,代码行数:30,代码来源:BooParserBase.cs


示例20: OnExpressionStatement

		public override void OnExpressionStatement(ExpressionStatement node)
		{
			_expression = null;
			node.Expression.Accept(this);
			if (_expression != null)
				_statements.Add(new CodeExpressionStatement(_expression));
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:CodeDomVisitor.cs



注:本文中的Boo.Lang.Compiler.Ast.ExpressionStatement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.Field类代码示例发布时间:2022-05-24
下一篇:
C# Ast.ExpressionCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap