当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionResult.ToString方法代码示例

本文整理汇总了C#中ICSharpCode.SharpDevelop.Dom.ExpressionResult.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionResult.ToString方法的具体用法?C# ExpressionResult.ToString怎么用?C# ExpressionResult.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.SharpDevelop.Dom.ExpressionResult的用法示例。


在下文中一共展示了ExpressionResult.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Resolve

		public ResolveResult Resolve(ExpressionResult expressionResult,
		                             ParseInformation parseInfo, string fileContent)
		{
			if (!Initialize(parseInfo, expressionResult.Region.BeginLine, expressionResult.Region.BeginColumn))
				return null;
			LoggingService.Debug("Resolve " + expressionResult.ToString());
			if (expressionResult.Expression == "__GlobalNamespace") { // used for "import" completion
				return new NamespaceResolveResult(callingClass, callingMember, "");
			}
			
			ResolveResult rr = CtrlSpaceResolveHelper.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, this.caretLine, this.caretColumn, expressionResult);
			if (rr != null) return rr;
			
			AST.Expression expr;
			try {
				expr = Boo.Lang.Parser.BooParser.ParseExpression("expression", expressionResult.Expression);
			} catch (Exception ex) {
				LoggingService.Debug("Boo expression parser: " + ex.Message);
				return null;
			}
			if (expr == null)
				return null;
			if (expr is AST.IntegerLiteralExpression)
				return new IntegerLiteralResolveResult(callingClass, callingMember, pc.SystemTypes.Int32);
			
			if (expressionResult.Context == ExpressionFinder.BooAttributeContext.Instance) {
				AST.MethodInvocationExpression mie = expr as AST.MethodInvocationExpression;
				if (mie != null)
					expr = mie.Target;
				string name = expr.ToCodeString();
				SearchTypeResult searchTypeResult = pc.SearchType(new SearchTypeRequest(name, 0, callingClass, cu, caretLine, caretColumn));
				IReturnType rt = searchTypeResult.Result;
				if (rt != null && rt.GetUnderlyingClass() != null)
					return new TypeResolveResult(callingClass, callingMember, rt);
				rt = pc.SearchType(new SearchTypeRequest(name + "Attribute", 0, callingClass, cu, caretLine, caretColumn)).Result;
				if (rt != null && rt.GetUnderlyingClass() != null)
					return new TypeResolveResult(callingClass, callingMember, rt);
				if (BooProject.BooCompilerPC != null) {
					IClass c = BooProject.BooCompilerPC.GetClass("Boo.Lang." + char.ToUpper(name[0]) + name.Substring(1) + "Attribute", 0);
					if (c != null)
						return new TypeResolveResult(callingClass, callingMember, c);
				}
				string namespaceName = searchTypeResult.NamespaceResult;
				if (namespaceName != null) {
					return new NamespaceResolveResult(callingClass, callingMember, namespaceName);
				}
				return null;
			} else {
				if (expr.NodeType == AST.NodeType.ReferenceExpression) {
					// this could be a macro
					if (BooProject.BooCompilerPC != null) {
						string name = ((AST.ReferenceExpression)expr).Name;
						IClass c = BooProject.BooCompilerPC.GetClass("Boo.Lang." + char.ToUpper(name[0]) + name.Substring(1) + "Macro", 0);
						if (c != null)
							return new TypeResolveResult(callingClass, callingMember, c);
					}
				}
			}
			
			ResolveVisitor visitor = new ResolveVisitor(this);
			visitor.Visit(expr);
			ResolveResult result = visitor.ResolveResult;
			if (expressionResult.Context == ExpressionContext.Type && result is MixedResolveResult)
				result = (result as MixedResolveResult).TypeResult;
			return result;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:66,代码来源:BooResolver.cs


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