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


C# MonoCSharp.ResolveContext类代码示例

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


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

示例1: ImplicitConversionRequired

		public Constant ImplicitConversionRequired (ResolveContext ec, TypeSpec type)
		{
			Constant c = ConvertImplicitly (type);
			if (c == null)
				Error_ValueCannotBeConverted (ec, type, false);

			return c;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:8,代码来源:constant.cs

示例2: DoResolve

		protected override Expression DoResolve (ResolveContext ec)
		{
			var results = new List<string> ();

			ec.CurrentMemberDefinition.GetCompletionStartingWith (Prefix, results);

			throw new CompletionResult (Prefix, results.Distinct ().Select (l => l.Substring (Prefix.Length)).ToArray ());
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:8,代码来源:complete.cs

示例3: Error_ValueCannotBeConverted

		public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec target, bool expl)
		{
			if (!expl && IsLiteral && type.BuiltinType != BuiltinTypeSpec.Type.Double &&
				BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (target) &&
				BuiltinTypeSpec.IsPrimitiveTypeOrDecimal (type)) {
				ec.Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
					GetValueAsLiteral (), target.GetSignatureForError ());
			} else {
				base.Error_ValueCannotBeConverted (ec, target, expl);
			}
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:11,代码来源:constant.cs

示例4: ConvertPromotion

		static bool ConvertPromotion (ResolveContext rc, ref Constant prim, ref Constant second, TypeSpec type)
		{
			Constant c = prim.ConvertImplicitly (type);
			if (c != null) {
				prim = c;
				return true;
			}

			if (type.BuiltinType == BuiltinTypeSpec.Type.UInt) {
				type = rc.BuiltinTypes.Long;
				prim = prim.ConvertImplicitly (type);
				second = second.ConvertImplicitly (type);
				return prim != null && second != null;
			}

			return false;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:17,代码来源:cfold.cs

示例5: DoBinaryNumericPromotions

		//
		// Performs the numeric promotions on the left and right expresions
		// and deposits the results on `lc' and `rc'.
		//
		// On success, the types of `lc' and `rc' on output will always match,
		// and the pair will be one of:
		//
		// TODO: BinaryFold should be called as an optimization step only,
		// error checking here is weak
		//		
		static bool DoBinaryNumericPromotions (ResolveContext rc, ref Constant left, ref Constant right)
		{
			TypeSpec ltype = left.Type;
			TypeSpec rtype = right.Type;

			foreach (TypeSpec t in rc.BuiltinTypes.BinaryPromotionsTypes) {
				if (t == ltype)
					return t == rtype || ConvertPromotion (rc, ref right, ref left, t);

				if (t == rtype)
					return t == ltype || ConvertPromotion (rc, ref left, ref right, t);
			}

			left = left.ConvertImplicitly (rc.BuiltinTypes.Int);
			right = right.ConvertImplicitly (rc.BuiltinTypes.Int);
			return left != null && right != null;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:27,代码来源:cfold.cs

示例6: Error_ValueCannotBeConverted

		public override void Error_ValueCannotBeConverted (ResolveContext ec, TypeSpec t, bool expl)
		{
			if (t.IsGenericParameter) {
				ec.Report.Error(403, loc,
					"Cannot convert null to the type parameter `{0}' because it could be a value " +
					"type. Consider using `default ({0})' instead", t.Name);
				return;
			}

			if (TypeSpec.IsValueType (t)) {
				ec.Report.Error(37, loc, "Cannot convert null to `{0}' because it is a value type",
					t.GetSignatureForError ());
				return;
			}

			base.Error_ValueCannotBeConverted (ec, t, expl);
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:17,代码来源:literal.cs

示例7: ResolveParameters

		protected override ParametersCompiled ResolveParameters (ResolveContext ec, TypeInferenceContext tic, TypeSpec delegateType)
		{
			if (!delegateType.IsDelegate)
				return null;

			AParametersCollection d_params = Delegate.GetParameters (delegateType);

			if (HasExplicitParameters) {
				if (!VerifyExplicitParameters (ec, tic, delegateType, d_params))
					return null;

				return Parameters;
			}

			//
			// If L has an implicitly typed parameter list we make implicit parameters explicit
			// Set each parameter of L is given the type of the corresponding parameter in D
			//
			if (!VerifyParameterCompatibility (ec, tic, delegateType, d_params, ec.IsInProbingMode))
				return null;

			TypeSpec [] ptypes = new TypeSpec [Parameters.Count];
			for (int i = 0; i < d_params.Count; i++) {
				// D has no ref or out parameters
				if ((d_params.FixedParameters[i].ModFlags & Parameter.Modifier.RefOutMask) != 0)
					return null;

				TypeSpec d_param = d_params.Types [i];

				//
				// When type inference context exists try to apply inferred type arguments
				//
				if (tic != null) {
					d_param = tic.InflateGenericArgument (ec, d_param);
				}

				ptypes [i] = d_param;
				ImplicitLambdaParameter ilp = (ImplicitLambdaParameter) Parameters.FixedParameters [i];
				ilp.SetParameterType (d_param);
				ilp.Resolve (null, i);
			}

			Parameters.Types = ptypes;
			return Parameters;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:45,代码来源:lambda.cs

示例8: ConvertInitializer

		public override Constant ConvertInitializer (ResolveContext rc, Constant expr)
		{
			if (expr is EnumConstant)
				expr = ((EnumConstant) expr).Child;

			var en = (Enum)Parent;
			var underlying = en.UnderlyingType;
			if (expr != null) {
				expr = expr.ImplicitConversionRequired (rc, underlying);
				if (expr != null && !IsValidEnumType (expr.Type)) {
					en.Error_UnderlyingType (Location);
					expr = null;
				}
			}

			if (expr == null)
				expr = New.Constantify (underlying, Location);

			return new EnumConstant (expr, MemberType);
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:20,代码来源:enum.cs

示例9: CreateExpressionTree

		protected override Expression CreateExpressionTree (ResolveContext ec, TypeSpec delegate_type)
		{
			if (ec.IsInProbingMode)
				return this;

			BlockContext bc = new BlockContext (ec.MemberContext, ec.ConstructorBlock, ec.BuiltinTypes.Void) {
				CurrentAnonymousMethod = ec.CurrentAnonymousMethod
			};

			Expression args = Parameters.CreateExpressionTree (bc, loc);
			Expression expr = Block.CreateExpressionTree (ec);
			if (expr == null)
				return null;

			Arguments arguments = new Arguments (2);
			arguments.Add (new Argument (expr));
			arguments.Add (new Argument (args));
			return CreateExpressionFactoryCall (ec, "Lambda",
				new TypeArguments (new TypeExpression (delegate_type, loc)),
				arguments);
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:21,代码来源:lambda.cs

示例10: DoResolveLValue

		public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
		{
			if (right_side == EmptyExpression.OutAccess) {
				right_side.DoResolveLValue (rc, this);
				return null;
			}

			if (DoResolveCore (rc)) {
				setter_args = CreateSetterArguments (rc, right_side);
				setter = CreateCallSiteBinder (rc, setter_args, true);
			}

			eclass = ExprClass.Variable;
			return this;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:15,代码来源:dynamic.cs

示例11: CreateIsFalse

		public static DynamicUnaryConversion CreateIsFalse (ResolveContext rc, Arguments args, Location loc)
		{
			return new DynamicUnaryConversion ("IsFalse", args, loc) { type = rc.BuiltinTypes.Bool };
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:4,代码来源:dynamic.cs

示例12: CreateCallSiteBinder

		protected abstract Expression CreateCallSiteBinder (ResolveContext ec, Arguments args, bool isSet);
开发者ID:furesoft,项目名称:NRefactory,代码行数:1,代码来源:dynamic.cs

示例13: CreateSetterArguments

		protected virtual Arguments CreateSetterArguments (ResolveContext rc, Expression rhs)
		{
			var setter_args = new Arguments (Arguments.Count + 1);
			setter_args.AddRange (Arguments);
			setter_args.Add (new Argument (rhs));
			return setter_args;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:7,代码来源:dynamic.cs

示例14: DoResolve

		protected override Expression DoResolve (ResolveContext rc)
		{
			if (DoResolveCore (rc))
				binder_expr = binder.CreateCallSiteBinder (rc, arguments);

			return this;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:7,代码来源:dynamic.cs

示例15: CreateExpressionTree

		public override Expression CreateExpressionTree (ResolveContext ec)
		{
			return condition.CreateExpressionTree (ec);
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:4,代码来源:dynamic.cs


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