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

C# ParenthesizedExpression类代码示例

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

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



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

示例1: VisitParenthesizedExpression

        public override void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression)
        {
            base.VisitParenthesizedExpression(parenthesizedExpression);

            if (parenthesizedExpression.Expression is PrimitiveExpression)
                parenthesizedExpression.ReplaceWith(parenthesizedExpression.Expression);
        }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:7,代码来源:RemoveParenthesisVisitor.cs


示例2: Visit

 public override object Visit(ParenthesizedExpression parenthesizedExpression, object data)
 {
     if (parenthesizedExpression == null) {
         return null;
     }
     return parenthesizedExpression.Expression.AcceptVisitor(this, data);
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:7,代码来源:TypeVisitor.cs


示例3: OptimizeExpression

        public static Expression OptimizeExpression(Expression node)
        {
            var root = new ParenthesizedExpression(node.Clone());
            var visitors = GetVisitors();
            string oldText = null;
            while (root.GetText() != oldText)
            {
                oldText = root.GetText();
                foreach (var visitor in visitors)
                    root.Expression.AcceptVisitor(visitor);
            }

            return root.Expression;
        }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:14,代码来源:AstHelpers.cs


示例4: GetValueFromParenthesizedExpression

 public static dynamic GetValueFromParenthesizedExpression(ParenthesizedExpression expr)
 {
     return GetValueFromExpression(expr.Expression);
 }
开发者ID:TreeSeed,项目名称:Tychaia,代码行数:4,代码来源:AstHelpers.cs


示例5: VisitParenthesizedExpression

 public void VisitParenthesizedExpression(ParenthesizedExpression parensExpr)
 {
     parensExpr.Expression.AcceptWalker(this);
 }
开发者ID:hazama-yuinyan,项目名称:Expresso,代码行数:4,代码来源:ExpressoNameBinder.cs


示例6: PostWalk

 protected internal virtual void PostWalk(ParenthesizedExpression node) { }
开发者ID:JamesTryand,项目名称:IronScheme,代码行数:1,代码来源:Walker.Generated.cs


示例7: Visit

			public override object Visit (Mono.CSharpPs.ParenthesizedExpression parenthesizedExpression)
			{
				var result = new ParenthesizedExpression ();
				var location = LocationsBag.GetLocations (parenthesizedExpression);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location [0]), Roles.LPar), Roles.LPar);
				if (parenthesizedExpression.Expr != null)
					result.AddChild ((Expression)parenthesizedExpression.Expr.Accept (this), Roles.Expression);
				if (location != null && location.Count > 1)
					result.AddChild (new CSharpTokenNode (Convert (location [1]), Roles.RPar), Roles.RPar);
				return result;
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:12,代码来源:CSharpParser.cs


示例8: VisitParenthesizedExpression

 public virtual void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(parenthesizedExpression);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs


示例9: actionPerformed

 /**
  * Call back method that must be called as soon as the given <code>
  * ParenthesizedExpression</code> object has been traversed.
  *
  * @param pParenthesizedExpression  The <code>ParenthesizedExpression</code>
  *                                  object that has just been traversed.
  */
 public void actionPerformed(
      
     ParenthesizedExpression pParenthesizedExpression)
 {
     // Nothing to do.
 }
开发者ID:smartmobili,项目名称:parsing,代码行数:13,代码来源:TraverseActionAdapter.cs


示例10: VisitParenthesizedExpression

		public override void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression)
		{
			ForceSpacesAfter(parenthesizedExpression.LParToken, policy.SpacesWithinParentheses);
			ForceSpacesBefore(parenthesizedExpression.RParToken, policy.SpacesWithinParentheses);
			base.VisitParenthesizedExpression(parenthesizedExpression);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:6,代码来源:AstFormattingVisitor.cs


示例11: VisitParenthesizedExpression

 public override void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression)
 {
     new ParenthesizedBlock(this, parenthesizedExpression).Emit();
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:4,代码来源:Emitter.Visitor.cs


示例12: VisitParenthesizedExpression

		public override void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression)
		{
			var lp = parenthesizedExpression.LParToken;
			var expr = parenthesizedExpression.Expression;
			int extraSpaces = 0;
			if (lp.StartLocation.Line == expr.StartLocation.Line) {
				ForceSpacesAfter(lp, policy.SpacesWithinParentheses);
			} else {
				extraSpaces += options.IndentSize;
				curIndent.ExtraSpaces += extraSpaces;
				FixIndentation(expr);
			}

			base.VisitParenthesizedExpression(parenthesizedExpression);

			var rp = parenthesizedExpression.RParToken;

			curIndent.ExtraSpaces -= extraSpaces;
			if (rp.StartLocation.Line == expr.EndLocation.Line) {
				ForceSpacesBefore(rp, policy.SpacesWithinParentheses);
			} else {
				FixIndentation(rp);
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:24,代码来源:FormattingVisitor_Expressions.cs


示例13: VisitParenthesizedExpression

 public override StringBuilder VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, int data)
 {
     throw new NotImplementedException();
 }
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:4,代码来源:GlslVisitor.Unimplemented.cs


示例14: CheckParenthesizedExpression

        /// <summary>
        /// Checks the given parenthesized expression to make sure that it is not unnecessary.
        /// </summary>
        /// <param name="element">The element containing the expression.</param>
        /// <param name="parenthesizedExpression">The parenthesized expression to check.</param>
        private void CheckParenthesizedExpression(Element element, ParenthesizedExpression parenthesizedExpression)
        {
            Param.AssertNotNull(element, "element");
            Param.AssertNotNull(parenthesizedExpression, "parenthesizedExpression");

            // Check the type of the inner expression to determine if it is one of types allowed to be wrapped within parenthesis.
            if (parenthesizedExpression.InnerExpression != null)
            {
                // The following types of expressions are allowed to be placed within a set of parenthesis.
                Expression innerExpression = parenthesizedExpression.InnerExpression;
                if (innerExpression.ExpressionType != ExpressionType.Arithmetic &&
                    innerExpression.ExpressionType != ExpressionType.As &&
                    innerExpression.ExpressionType != ExpressionType.Assignment &&
                    innerExpression.ExpressionType != ExpressionType.Cast &&
                    innerExpression.ExpressionType != ExpressionType.Conditional &&
                    innerExpression.ExpressionType != ExpressionType.ConditionalLogical &&
                    innerExpression.ExpressionType != ExpressionType.Decrement &&
                    innerExpression.ExpressionType != ExpressionType.Increment &&
                    innerExpression.ExpressionType != ExpressionType.Is &&
                    innerExpression.ExpressionType != ExpressionType.Lambda &&
                    innerExpression.ExpressionType != ExpressionType.Logical &&
                    innerExpression.ExpressionType != ExpressionType.New &&
                    innerExpression.ExpressionType != ExpressionType.NewArray &&
                    innerExpression.ExpressionType != ExpressionType.NullCoalescing &&
                    innerExpression.ExpressionType != ExpressionType.Query &&
                    innerExpression.ExpressionType != ExpressionType.Relational &&
                    innerExpression.ExpressionType != ExpressionType.Unary &&
                    innerExpression.ExpressionType != ExpressionType.UnsafeAccess)
                {
                    this.AddViolation(element, parenthesizedExpression.LineNumber, Rules.StatementMustNotUseUnnecessaryParenthesis);
                }
                else
                {
                    // These types of expressions are allowed in some cases to be surrounded by parenthesis,
                    // as long as the parenthesized expression is within another expression. They are not allowed
                    // to be within parenthesis within a variable declarator expression. For example:
                    // int x = (2 + 3);
                    if (!(parenthesizedExpression.Parent is Expression) || parenthesizedExpression.Parent is VariableDeclaratorExpression)
                    {
                        this.AddViolation(element, parenthesizedExpression.LineNumber, Rules.StatementMustNotUseUnnecessaryParenthesis);
                    }
                    else
                    {
                        // This is also not allowed when the expression is on the right-hand side of an assignment.
                        AssignmentExpression assignment = parenthesizedExpression.Parent as AssignmentExpression;
                        if (assignment != null && assignment.RightHandSide == parenthesizedExpression)
                        {
                            this.AddViolation(element, parenthesizedExpression.LineNumber, Rules.StatementMustNotUseUnnecessaryParenthesis);
                        }
                    }
                }
            }
        }
开发者ID:jonthegiant,项目名称:StyleCop,代码行数:58,代码来源:MaintainabilityRules.cs


示例15: SimpleNonInvocationExpression

	void SimpleNonInvocationExpression(
#line  1645 "VBNET.ATG" 
out Expression pexpr) {

#line  1647 "VBNET.ATG" 
		Expression expr;
		TypeReference type = null;
		string name = String.Empty;
		pexpr = null;
		
		if (StartOf(32)) {
			switch (la.kind) {
			case 3: {
				lexer.NextToken();

#line  1655 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 4: {
				lexer.NextToken();

#line  1656 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 7: {
				lexer.NextToken();

#line  1657 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 6: {
				lexer.NextToken();

#line  1658 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 5: {
				lexer.NextToken();

#line  1659 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 9: {
				lexer.NextToken();

#line  1660 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 8: {
				lexer.NextToken();

#line  1661 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 202: {
				lexer.NextToken();

#line  1663 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(true, "true");  
				break;
			}
			case 109: {
				lexer.NextToken();

#line  1664 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(false, "false"); 
				break;
			}
			case 151: {
				lexer.NextToken();

#line  1665 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(null, "null");  
				break;
			}
			case 25: {
				lexer.NextToken();
				Expr(
#line  1666 "VBNET.ATG" 
out expr);
				Expect(26);

#line  1666 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
				Identifier();

#line  1668 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val);
				pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
				
//.........这里部分代码省略.........
开发者ID:mgagne-atman,项目名称:Projects,代码行数:101,代码来源:Parser.cs


示例16: case_521

void case_521()
#line 3816 "cs-parser.jay"
{
		yyVal = new ParenthesizedExpression ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop]));
		lbag.AddLocation (yyVal, GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
开发者ID:furesoft,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs


示例17: CreateEqualsOverrides

		List<MethodDeclaration> CreateEqualsOverrides(IType currentClass)
		{
			List<MethodDeclaration> methods = new List<MethodDeclaration>();
			
			AstType boolReference = ConvertType(KnownTypeCode.Boolean);
			AstType objectReference = ConvertType(KnownTypeCode.Object);
			
			MethodDeclaration method = new MethodDeclaration {
				Name = "Equals",
				Modifiers = Modifiers.Public | Modifiers.Override,
				ReturnType = boolReference
			};
			method.Parameters.Add(new ParameterDeclaration(objectReference, "obj"));
			method.Body = new BlockStatement();
			
			AstType currentType = ConvertType(currentClass);
			Expression expr = null;
			
			if (currentClass.Kind == TypeKind.Struct) {
				// return obj is CurrentType && Equals((CurrentType)obj);
				expr = new IsExpression() {
					Expression = new IdentifierExpression("obj"),
					Type = currentType.Clone()
				};
				expr = new ParenthesizedExpression(expr);
				expr = new BinaryOperatorExpression(
					expr, BinaryOperatorType.ConditionalAnd,
					new InvocationExpression(
						new IdentifierExpression("Equals"),
						new List<Expression> {
							new CastExpression(currentType.Clone(), new IdentifierExpression("obj"))
						}));
				method.Body.Add(new ReturnStatement(expr));
				
				methods.Add(method);
				
				// IEquatable implementation:
				method = new MethodDeclaration {
					Name = "Equals",
					Modifiers = Modifiers.Public,
					ReturnType = boolReference.Clone()
				};
				method.Parameters.Add(new ParameterDeclaration(currentType, "other"));
				method.Body = new BlockStatement();
			} else {
				method.Body.Add(new VariableDeclarationStatement(
					currentType.Clone(),
					"other",
					new IdentifierExpression("obj").CastAs(currentType.Clone())));
				method.Body.Add(new IfElseStatement(
					new BinaryOperatorExpression(new IdentifierExpression("other"), BinaryOperatorType.Equality, new PrimitiveExpression(null, "null")),
					new ReturnStatement(new PrimitiveExpression(false, "false"))));
			}
			
			expr = null;
			foreach (IField field in currentClass.GetFields()) {
				if (field.IsStatic) continue;
				
				if (expr == null) {
					expr = TestEquality("other", field);
				} else {
					expr = new BinaryOperatorExpression(expr, BinaryOperatorType.ConditionalAnd,
					                                    TestEquality("other", field));
				}
			}
			
			foreach (IProperty property in currentClass.GetProperties()) {
				if (property.IsStatic || !property.IsAutoImplemented()) continue;
				if (expr == null) {
					expr = TestEquality("other", property);
				} else {
					expr = new BinaryOperatorExpression(expr, BinaryOperatorType.ConditionalAnd,
					                                    TestEquality("other", property));
				}
			}
			
			method.Body.Add(new ReturnStatement(expr ?? new PrimitiveExpression(true, "true")));
			
			methods.Add(method);
			
			return methods;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:82,代码来源:OverrideEqualsGetHashCodeMethodsDialog.xaml.cs


示例18: VisitParenthesizedExpression

 public abstract StringBuilder VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, int data);
开发者ID:hach-que,项目名称:SLSharp,代码行数:1,代码来源:VisitorBase.Abstract.cs


示例19: performAction

 /**
  * Call back method that must be called when the given <code>
  * ParenthesizedExpression</code> will become the next <i>traverse
  * candidate</i>.
  *
  * @param pParenthesizedExpression  The <code>ParenthesizedExpression</code>
  *                                  object that will become the next <i>
  *                                  traverse candidate</i>.
  */
 public void performAction(
      
     ParenthesizedExpression pParenthesizedExpression)
 {
     // Nothing to do.
 }
开发者ID:smartmobili,项目名称:parsing,代码行数:15,代码来源:TraverseActionAdapter.cs


示例20: Visit

		public virtual object Visit (ParenthesizedExpression parenthesizedExpression)
		{
			return null;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:4,代码来源:visit.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Parity类代码示例发布时间:2022-05-24
下一篇:
C# Parent类代码示例发布时间: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