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


C# ResolveResult类代码示例

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


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

示例1: ResolveConstructor

		public IMethod ResolveConstructor(ITypeResolveContext context)
		{
			CSharpResolver r = new CSharpResolver(context);
			IType type = attributeType.Resolve(context);
			int totalArgumentCount = 0;
			if (positionalArguments != null)
				totalArgumentCount += positionalArguments.Count;
			if (namedCtorArguments != null)
				totalArgumentCount += namedCtorArguments.Count;
			ResolveResult[] arguments = new ResolveResult[totalArgumentCount];
			string[] argumentNames = new string[totalArgumentCount];
			int i = 0;
			if (positionalArguments != null) {
				while (i < positionalArguments.Count) {
					IConstantValue cv = positionalArguments[i];
					arguments[i] = cv.Resolve(context);
					i++;
				}
			}
			if (namedCtorArguments != null) {
				foreach (var pair in namedCtorArguments) {
					argumentNames[i] = pair.Key;
					arguments[i] = pair.Value.Resolve(context);
					i++;
				}
			}
			MemberResolveResult mrr = r.ResolveObjectCreation(type, arguments, argumentNames) as MemberResolveResult;
			return mrr != null ? mrr.Member as IMethod : null;
		}
开发者ID:jiguixin,项目名称:ILSpy,代码行数:29,代码来源:CSharpAttribute.cs

示例2: GetArgumentsForCall

		public override IList<ResolveResult> GetArgumentsForCall()
		{
			ResolveResult[] results = new ResolveResult[Member.Parameters.Count];
			List<ResolveResult> paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
			// map arguments to parameters:
			for (int i = 0; i < Arguments.Count; i++) {
				int mappedTo;
				if (argumentToParameterMap != null)
					mappedTo = argumentToParameterMap[i];
				else
					mappedTo = IsExpandedForm ? Math.Min(i, results.Length - 1) : i;
				
				if (mappedTo >= 0 && mappedTo < results.Length) {
					if (IsExpandedForm && mappedTo == results.Length - 1)
						paramsArguments.Add(Arguments[i]);
					else
						results[mappedTo] = Arguments[i];
				}
			}
			if (IsExpandedForm)
				results[results.Length - 1] = new ArrayCreateResolveResult(Member.Parameters.Last().Type, null, paramsArguments.ToArray());
			
			for (int i = 0; i < results.Length; i++) {
				if (results[i] == null) {
					if (Member.Parameters[i].IsOptional) {
						results[i] = new ConstantResolveResult(Member.Parameters[i].Type, Member.Parameters[i].ConstantValue);
					} else {
						results[i] = ErrorResolveResult.UnknownError;
					}
				}
			}
			
			return results;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:34,代码来源:CSharpInvocationResolveResult.cs

示例3: ToolTipData

			public ToolTipData (ICSharpCode.NRefactory.CSharp.SyntaxTree unit, ICSharpCode.NRefactory.Semantics.ResolveResult result, ICSharpCode.NRefactory.CSharp.AstNode node, CSharpAstResolver file)
			{
				this.Unit = unit;
				this.Result = result;
				this.Node = node;
				this.Resolver = file;
			}
开发者ID:kthguru,项目名称:monodevelop,代码行数:7,代码来源:LanguageItemTooltipProvider.cs

示例4: ConversionResolveResult

		public ConversionResolveResult(IType targetType, ResolveResult input, Conversion conversion)
			: base(targetType)
		{
			if (input == null)
				throw new ArgumentNullException("input");
			this.Input = input;
			this.Conversion = conversion;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:8,代码来源:ConversionResolveResult.cs

示例5: UnaryOperatorResolveResult

		public UnaryOperatorResolveResult(IType resultType, UnaryOperatorType op, ResolveResult input)
			: base(resultType)
		{
			if (input == null)
				throw new ArgumentNullException("input");
			this.Operator = op;
			this.Input = input;
		}
开发者ID:sbeparey,项目名称:ILSpy,代码行数:8,代码来源:OperatorResolveResult.cs

示例6: ProcessConversion

			public void ProcessConversion(Expression expression, ResolveResult result, Conversion conversion, IType targetType)
			{
				if (!nodesWithConversions.Add(expression))
					throw new InvalidOperationException("Duplicate ProcessConversion() call");
				if (!conversion.IsValid && !allowErrors) {
					Console.WriteLine("Compiler error at " + fileName + ":" + expression.StartLocation + ": Cannot convert from " + result + " to " + targetType);
				}
			}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:8,代码来源:ResolverTest.cs

示例7: TestCast

		void TestCast(Type targetType, ResolveResult input, Conversion expectedConversion)
		{
			IType type = targetType.ToTypeReference().Resolve(context);
			ResolveResult rr = resolver.ResolveCast(type, input);
			AssertType(targetType, rr);
			Assert.AreEqual(typeof(ConversionResolveResult), rr.GetType());
			var crr = (ConversionResolveResult)rr;
			Assert.AreEqual(expectedConversion, crr.Conversion, "ConversionResolveResult.Conversion");
			Assert.AreSame(input, crr.Input, "ConversionResolveResult.Input");
		}
开发者ID:sbeparey,项目名称:ILSpy,代码行数:10,代码来源:CastTests.cs

示例8: TestCast

		void TestCast(Type targetType, ResolveResult input, Conversion expectedConversion)
		{
			IType type = compilation.FindType(targetType);
			ResolveResult rr = resolver.ResolveCast(type, input);
			AssertType(targetType, rr);
			Assert.AreEqual(typeof(ConversionResolveResult), rr.GetType());
			var crr = (ConversionResolveResult)rr;
			Assert.AreEqual(expectedConversion, crr.Conversion, "ConversionResolveResult.Conversion");
			Assert.AreSame(input, crr.Input, "ConversionResolveResult.Input");
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:10,代码来源:CastTests.cs

示例9: TestOperator

		void TestOperator(ResolveResult condition, ResolveResult trueExpr, ResolveResult falseExpr,
		                  Conversion conditionConv, Conversion trueConv, Conversion falseConv,
		                  Type expectedResultType)
		{
			var corr = (ConditionalOperatorResolveResult)resolver.ResolveConditional(condition, trueExpr, falseExpr);
			AssertType(expectedResultType, corr);
			AssertConversion(corr.Condition, condition, conditionConv, "Condition Conversion");
			AssertConversion(corr.True, trueExpr, trueConv, "True Conversion");
			AssertConversion(corr.False, falseExpr, falseConv, "False Conversion");
		}
开发者ID:jiguixin,项目名称:ILSpy,代码行数:10,代码来源:ConditionalOperatorTests.cs

示例10: Resolved

 public void Resolved(AstNode node, ResolveResult resolveResult)
 {
     if (resolveResult.IsError)
     {
         foreach(var error in GetErrorStrings(resolveResult))
         {
             _errors.Add(new ResolveErrors(node.StartLocation, error));
         }
     }
 }
开发者ID:gamwang,项目名称:vimrc,代码行数:10,代码来源:SemanticErrorsHandler.cs

示例11: GetMember

			static IMember GetMember (ResolveResult result)
			{
				if (result is MemberResolveResult) {
					return ((MemberResolveResult)result).Member;
				} else if (result is MethodGroupResolveResult) {
					return ((MethodGroupResolveResult)result).Methods.FirstOrDefault ();
				}

				return null;
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:10,代码来源:RedundantThisIssue.cs

示例12: ConversionFromDynamic

		public void ConversionFromDynamic()
		{
			// Explicit dynamic conversion is for resolve results only;
			// otherwise it's an explicit reference / unboxing conversion
			Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic), typeof(string)));
			Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(dynamic), typeof(int)));
			
			var dynamicRR = new ResolveResult(SpecialType.Dynamic);
			Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(string))));
			Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(int))));
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:11,代码来源:ExplicitConversionsTest.cs

示例13: Resolved

			public void Resolved(AstNode node, ResolveResult result)
			{
				if (!resolvedNodes.Add(node))
					throw new InvalidOperationException("Duplicate Resolved() call");
				if (CSharpAstResolver.IsUnresolvableNode(node))
					throw new InvalidOperationException("Resolved unresolvable node");
				
				if (result.IsError && !allowErrors) {
					Console.WriteLine("Compiler error at " + fileName + ":" + node.StartLocation + ": " + result);
				}
			}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:11,代码来源:ResolverTest.cs

示例14: BinaryOperatorResolveResult

		public BinaryOperatorResolveResult(IType resultType, ResolveResult lhs, BinaryOperatorType op, ResolveResult rhs)
			: base(resultType)
		{
			if (lhs == null)
				throw new ArgumentNullException("lhs");
			if (rhs == null)
				throw new ArgumentNullException("rhs");
			this.Left = lhs;
			this.Operator = op;
			this.Right = rhs;
		}
开发者ID:sbeparey,项目名称:ILSpy,代码行数:11,代码来源:OperatorResolveResult.cs

示例15: Resolve

 public override ResolveResult Resolve(CSharpResolver resolver)
 {
     ResolveResult[] elements = new ResolveResult[arrayElements.Count];
     for (int i = 0; i < elements.Length; i++) {
         elements[i] = arrayElements[i].Resolve(resolver);
     }
     if (elementType != null) {
         return resolver.ResolveArrayCreation(elementType.Resolve(resolver.CurrentTypeResolveContext), 1, null, elements);
     } else {
         return resolver.ResolveArrayCreation(null, 1, null, elements);
     }
 }
开发者ID:holmak,项目名称:NRefactory,代码行数:12,代码来源:ConstantValues.cs


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