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

C# ResolveResult类代码示例

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

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



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


示例16: AwaitResolveResult

		public AwaitResolveResult(IType resultType, ResolveResult getAwaiterInvocation, IType awaiterType, IProperty isCompletedProperty, IMethod onCompletedMethod, IMethod getResultMethod)
			: base(resultType)
		{
			if (awaiterType == null)
				throw new ArgumentNullException("awaiterType");
			if (getAwaiterInvocation == null)
				throw new ArgumentNullException("getAwaiterInvocation");
			this.GetAwaiterInvocation = getAwaiterInvocation;
			this.AwaiterType = awaiterType;
			this.IsCompletedProperty = isCompletedProperty;
			this.OnCompletedMethod = onCompletedMethod;
			this.GetResultMethod = getResultMethod;
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:13,代码来源:AwaitResolveResult.cs


示例17: GetSymbol

		protected static ISymbol GetSymbol(ResolveResult symbol)
		{
			TypeResolveResult trr = symbol as TypeResolveResult;
			if (trr != null)
				return trr.Type.GetDefinition();
			MemberResolveResult mrr = symbol as MemberResolveResult;
			if (mrr != null)
				return mrr.Member.MemberDefinition;
			LocalResolveResult lrr = symbol as LocalResolveResult;
			if (lrr != null)
				return lrr.Variable;
			return null;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:13,代码来源:SymbolUnderCaretMenuCommand.cs


示例18: Write

        public virtual void Write(TextWriter writer, ResolveResult result)
        {
            var error = result.BestMatch.Errors[0];

            writer.WriteLine(error.Message);

            if (error.Parameter != null)
            {
                foreach (var parameter in error.Parameter)
                {
                    this.WriteParameter(writer, result, parameter);
                }
            }
        }
开发者ID:LBiNetherlands,项目名称:LBi.Cli.Arguments,代码行数:14,代码来源:ErrorWriter.cs


示例19: ArgumentsInfo

        public ArgumentsInfo(IEmitter emitter, Expression expression, ResolveResult rr = null)
        {
            this.Emitter = emitter;
            this.Expression = expression;

            this.ArgumentsExpressions = new Expression[] { expression };
            this.ArgumentsNames = new string[] { "{this}" };
            this.ThisArgument = expression;
            this.CreateNamedExpressions(this.ArgumentsNames, this.ArgumentsExpressions);

            if (rr is MemberResolveResult)
            {
                this.BuildTypedArguments((MemberResolveResult)rr);
            }
        }
开发者ID:RashmiPankaj,项目名称:Bridge,代码行数:15,代码来源:ArgumentsInfo.cs


示例20: Resolved

			public virtual void Resolved(AstNode node, ResolveResult result)
			{
				if (resolvedNodes.ContainsKey(node))
					throw new InvalidOperationException("Duplicate Resolved() call");
				resolvedNodes.Add(node, result);
				if (CSharpAstResolver.IsUnresolvableNode(node))
					throw new InvalidOperationException("Resolved unresolvable node");
				if (!ParenthesizedExpression.ActsAsParenthesizedExpression(node))
					if (!resolveResults.Add(result) && result != ErrorResolveResult.UnknownError)
						throw new InvalidOperationException("Duplicate resolve result");
				
				if (result.IsError && !allowErrors) {
					Console.WriteLine("Compiler error at " + fileName + ":" + node.StartLocation + ": " + result);
				}
			}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:15,代码来源:ResolverTest.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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