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


C# ResolveContext.HasSet方法代码示例

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


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

示例1: Compatible

		public bool Compatible (ResolveContext ec)
		{
			// TODO: Implement clone
			BlockContext aec = new BlockContext (ec.MemberContext, Block, ReturnType);
			aec.CurrentAnonymousMethod = this;

			IDisposable aec_dispose = null;
			ResolveContext.Options flags = 0;
			if (ec.HasSet (ResolveContext.Options.InferReturnType)) {
				flags |= ResolveContext.Options.InferReturnType;
				aec.ReturnTypeInference = new TypeInferenceContext ();
			}

			if (ec.IsInProbingMode)
				flags |= ResolveContext.Options.ProbingMode;

			if (ec.HasSet (ResolveContext.Options.FieldInitializerScope))
				flags |= ResolveContext.Options.FieldInitializerScope;

			if (ec.IsUnsafe)
				flags |= ResolveContext.Options.UnsafeScope;

			if (ec.HasSet (ResolveContext.Options.CheckedScope))
				flags |= ResolveContext.Options.CheckedScope;

			// HACK: Flag with 0 cannot be set 
			if (flags != 0)
				aec_dispose = aec.Set (flags);

			bool res = Block.Resolve (ec.CurrentBranching, aec, Block.Parameters, null);

			if (aec.HasReturnLabel)
				return_label = aec.ReturnLabel;

			if (ec.HasSet (ResolveContext.Options.InferReturnType)) {
				aec.ReturnTypeInference.FixAllTypes (ec);
				ReturnType = aec.ReturnTypeInference.InferredTypeArguments [0];
			}

			if (aec_dispose != null) {
				aec_dispose.Dispose ();
			}

			return res;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:45,代码来源:anonymous.cs

示例2: BlockContext

		public BlockContext (ResolveContext rc, ExplicitBlock block, TypeSpec returnType)
			: this (rc.MemberContext, block, returnType)
		{
			if (rc.IsUnsafe)
				flags |= ResolveContext.Options.UnsafeScope;

			if (rc.HasSet (ResolveContext.Options.CheckedScope))
				flags |= ResolveContext.Options.CheckedScope;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:9,代码来源:context.cs

示例3: DoResolve

		protected override Expression DoResolve (ResolveContext ec)
		{
			if (ec.HasSet (ResolveContext.Options.ConstantScope)) {
				ec.Report.Error (1706, loc, "Anonymous methods and lambda expressions cannot be used in the current context");
				return null;
			}

			//
			// Set class type, set type
			//

			eclass = ExprClass.Value;

			//
			// This hack means `The type is not accessible
			// anywhere', we depend on special conversion
			// rules.
			// 
			type = InternalType.AnonymousMethod;

			if (!DoResolveParameters (ec))
				return null;

#if !STATIC
			// FIXME: The emitted code isn't very careful about reachability
			// so, ensure we have a 'ret' at the end
			BlockContext bc = ec as BlockContext;
			if (bc != null && bc.CurrentBranching != null && bc.CurrentBranching.CurrentUsageVector.IsUnreachable)
				bc.NeedReturnLabel ();
#endif
			return this;
		}
开发者ID:rabink,项目名称:mono,代码行数:32,代码来源:anonymous.cs

示例4: Compatible

		public AnonymousExpression Compatible (ResolveContext ec, AnonymousExpression ae)
		{
			if (block.Resolved)
				return this;

			// TODO: Implement clone
			BlockContext aec = new BlockContext (ec, block, ReturnType);
			aec.CurrentAnonymousMethod = ae;

			var am = this as AnonymousMethodBody;

			if (ec.HasSet (ResolveContext.Options.InferReturnType) && am != null) {
				am.ReturnTypeInference = new TypeInferenceContext ();
			}

			var bc = ec as BlockContext;

			if (bc != null) {
				aec.AssignmentInfoOffset = bc.AssignmentInfoOffset;
				aec.EnclosingLoop = bc.EnclosingLoop;
				aec.EnclosingLoopOrSwitch = bc.EnclosingLoopOrSwitch;
				aec.Switch = bc.Switch;
			}

			var errors = ec.Report.Errors;

			bool res = Block.Resolve (aec);

			if (res && errors == ec.Report.Errors) {
				MarkReachable (new Reachability ());

				if (!CheckReachableExit (ec.Report)) {
					return null;
				}

				if (bc != null)
					bc.AssignmentInfoOffset = aec.AssignmentInfoOffset;
			}

			if (am != null && am.ReturnTypeInference != null) {
				am.ReturnTypeInference.FixAllTypes (ec);
				ReturnType = am.ReturnTypeInference.InferredTypeArguments [0];
				am.ReturnTypeInference = null;

				//
				// If e is synchronous the inferred return type is T
				// If e is asynchronous and the body of F is either an expression classified as nothing
				// or a statement block where no return statements have expressions, the inferred return type is Task
				// If e is async and has an inferred result type T, the inferred return type is Task<T>
				//
				if (block.IsAsync && ReturnType != null) {
					ReturnType = ReturnType.Kind == MemberKind.Void ?
						ec.Module.PredefinedTypes.Task.TypeSpec :
						ec.Module.PredefinedTypes.TaskGeneric.TypeSpec.MakeGenericType (ec, new [] { ReturnType });
				}
			}

			if (res && errors != ec.Report.Errors)
				return null;

			return res ? this : null;
		}
开发者ID:erik-kallen,项目名称:NRefactory,代码行数:62,代码来源:anonymous.cs

示例5: CreateCallSiteBinder

        public Expression CreateCallSiteBinder(ResolveContext ec, Arguments args)
        {
            Arguments binder_args = new Arguments (4);

            MemberAccess sle = new MemberAccess (new MemberAccess (
                new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Linq", loc), "Expressions", loc);

            var flags = ec.HasSet (ResolveContext.Options.CheckedScope) ? CSharpBinderFlags.CheckedContext : 0;

            binder_args.Add (new Argument (new BinderFlags (flags, this)));
            binder_args.Add (new Argument (new MemberAccess (new MemberAccess (sle, "ExpressionType", loc), name, loc)));
            binder_args.Add (new Argument (new TypeOf (new TypeExpression (ec.CurrentType, loc), loc)));
            binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation ("[]", args.CreateDynamicBinderArguments (ec), loc)));

            return new Invocation (GetBinder ("UnaryOperation", loc), binder_args);
        }
开发者ID:speier,项目名称:shake,代码行数:16,代码来源:dynamic.cs

示例6: DoResolve

		protected override Expression DoResolve (ResolveContext rc)
		{
			if (rc.HasSet (ResolveContext.Options.ConstantScope)) {
				rc.Report.Error (1706, loc, "Anonymous methods and lambda expressions cannot be used in the current context");
				return null;
			}

			//
			// Update top-level block generated duting parsing with actual top-level block
			//
			if (rc.HasAny (ResolveContext.Options.FieldInitializerScope | ResolveContext.Options.BaseInitializer) && rc.CurrentMemberDefinition.Parent.PartialContainer.PrimaryConstructorParameters != null) {
				var tb = rc.ConstructorBlock.ParametersBlock.TopBlock;
				if (Block.TopBlock != tb) {
					Block b = Block;
					while (b.Parent != Block.TopBlock && b != Block.TopBlock)
						b = b.Parent;

					b.Parent = tb;
					tb.IncludeBlock (Block, Block.TopBlock);
					b.ParametersBlock.TopBlock = tb;
				}
			}

			eclass = ExprClass.Value;

			//
			// This hack means `The type is not accessible
			// anywhere', we depend on special conversion
			// rules.
			// 
			type = InternalType.AnonymousMethod;

			if (!DoResolveParameters (rc))
				return null;

			return this;
		}
开发者ID:FrancisVarga,项目名称:mono,代码行数:37,代码来源:anonymous.cs

示例7: DoResolve

		protected override Expression DoResolve (ResolveContext ec)
		{
			constructor_method = Delegate.GetConstructor (type);

			var invoke_method = Delegate.GetInvokeMethod (type);

			if (!ec.HasSet (ResolveContext.Options.ConditionalAccessReceiver)) {
				if (method_group.HasConditionalAccess ()) {
					conditional_access_receiver = true;
					ec.Set (ResolveContext.Options.ConditionalAccessReceiver);
				}
			}

			Arguments arguments = CreateDelegateMethodArguments (ec, invoke_method.Parameters, invoke_method.Parameters.Types, loc);
			method_group = method_group.OverloadResolve (ec, ref arguments, this, OverloadResolver.Restrictions.CovariantDelegate);

			if (conditional_access_receiver)
				ec.With (ResolveContext.Options.ConditionalAccessReceiver, false);

			if (method_group == null)
				return null;

			var delegate_method = method_group.BestCandidate;
			
			if (delegate_method.DeclaringType.IsNullableType) {
				ec.Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
					delegate_method.GetSignatureForError ());
				return null;
			}		
			
			if (!AllowSpecialMethodsInvocation)
				Invocation.IsSpecialMethodInvocation (ec, delegate_method, loc);

			ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;
			if (emg != null) {
				method_group.InstanceExpression = emg.ExtensionExpression;
				TypeSpec e_type = emg.ExtensionExpression.Type;
				if (TypeSpec.IsValueType (e_type)) {
					ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates",
						delegate_method.GetSignatureForError (), e_type.GetSignatureForError ());
				}
			}

			TypeSpec rt = method_group.BestCandidateReturnType;
			if (rt.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
				rt = ec.BuiltinTypes.Object;

			if (!Delegate.IsTypeCovariant (ec, rt, invoke_method.ReturnType)) {
				Expression ret_expr = new TypeExpression (delegate_method.ReturnType, loc);
				Error_ConversionFailed (ec, delegate_method, ret_expr);
			}

			if (method_group.IsConditionallyExcluded) {
				ec.Report.SymbolRelatedToPreviousError (delegate_method);
				MethodOrOperator m = delegate_method.MemberDefinition as MethodOrOperator;
				if (m != null && m.IsPartialDefinition) {
					ec.Report.Error (762, loc, "Cannot create delegate from partial method declaration `{0}'",
						delegate_method.GetSignatureForError ());
				} else {
					ec.Report.Error (1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute",
						TypeManager.CSharpSignature (delegate_method));
				}
			}

			var expr = method_group.InstanceExpression;
			if (expr != null && (expr.Type.IsGenericParameter || !TypeSpec.IsReferenceType (expr.Type)))
				method_group.InstanceExpression = new BoxedCast (expr, ec.BuiltinTypes.Object);

			eclass = ExprClass.Value;
			return this;
		}
开发者ID:psni,项目名称:mono,代码行数:71,代码来源:delegate.cs

示例8: DoResolve

        Expression DoResolve(ResolveContext ec, bool lvalue_instance, bool out_access)
        {
            if (!IsStatic){
                if (InstanceExpression == null){
                    //
                    // This can happen when referencing an instance field using
                    // a fully qualified type expression: TypeName.InstanceField = xxx
                    //
                    SimpleName.Error_ObjectRefRequired (ec, loc, GetSignatureForError ());
                    return null;
                }

                // Resolve the field's instance expression while flow analysis is turned
                // off: when accessing a field "a.b", we must check whether the field
                // "a.b" is initialized, not whether the whole struct "a" is initialized.

                if (lvalue_instance) {
                    using (ec.With (ResolveContext.Options.DoFlowAnalysis, false)) {
                        Expression right_side =
                            out_access ? EmptyExpression.LValueMemberOutAccess : EmptyExpression.LValueMemberAccess;

                        if (InstanceExpression != EmptyExpression.Null)
                            InstanceExpression = InstanceExpression.ResolveLValue (ec, right_side);
                    }
                } else {
                    if (InstanceExpression != EmptyExpression.Null) {
                        using (ec.With (ResolveContext.Options.DoFlowAnalysis, false)) {
                            InstanceExpression = InstanceExpression.Resolve (ec, ResolveFlags.VariableOrValue);
                        }
                    }
                }

                if (InstanceExpression == null)
                    return null;

                using (ec.Set (ResolveContext.Options.OmitStructFlowAnalysis)) {
                    InstanceExpression.CheckMarshalByRefAccess (ec);
                }
            }

            if (!ec.IsObsolete) {
                ObsoleteAttribute oa = spec.GetAttributeObsolete ();
                if (oa != null)
                    AttributeTester.Report_ObsoleteMessage (oa, TypeManager.GetFullNameSignature (spec), loc, ec.Report);
            }

            var fb = spec as FixedFieldSpec;
            IVariableReference var = InstanceExpression as IVariableReference;

            if (fb != null) {
                IFixedExpression fe = InstanceExpression as IFixedExpression;
                if (!ec.HasSet (ResolveContext.Options.FixedInitializerScope) && (fe == null || !fe.IsFixed)) {
                    ec.Report.Error (1666, loc, "You cannot use fixed size buffers contained in unfixed expressions. Try using the fixed statement");
                }

                if (InstanceExpression.eclass != ExprClass.Variable) {
                    ec.Report.SymbolRelatedToPreviousError (spec);
                    ec.Report.Error (1708, loc, "`{0}': Fixed size buffers can only be accessed through locals or fields",
                        TypeManager.GetFullNameSignature (spec));
                } else if (var != null && var.IsHoisted) {
                    AnonymousMethodExpression.Error_AddressOfCapturedVar (ec, var, loc);
                }

                return new FixedBufferPtr (this, fb.ElementType, loc).Resolve (ec);
            }

            eclass = ExprClass.Variable;

            // If the instance expression is a local variable or parameter.
            if (var == null || var.VariableInfo == null)
                return this;

            VariableInfo vi = var.VariableInfo;
            if (!vi.IsFieldAssigned (ec, Name, loc))
                return null;

            variable_info = vi.GetSubStruct (Name);
            return this;
        }
开发者ID:speier,项目名称:shake,代码行数:79,代码来源:ecore.cs

示例9: Error_ObjectRefRequired

 public static void Error_ObjectRefRequired(ResolveContext ec, Location l, string name)
 {
     if (ec.HasSet (ResolveContext.Options.FieldInitializerScope))
         ec.Report.Error (236, l,
             "A field initializer cannot reference the nonstatic field, method, or property `{0}'",
             name);
     else
         ec.Report.Error (120, l,
             "An object reference is required to access non-static member `{0}'",
             name);
 }
开发者ID:speier,项目名称:shake,代码行数:11,代码来源:ecore.cs

示例10: DoResolveLValue

        public override Expression DoResolveLValue(ResolveContext ec, Expression right_side)
        {
            IVariableReference var = InstanceExpression as IVariableReference;
            if (var != null && var.VariableInfo != null)
                var.VariableInfo.SetFieldAssigned (ec, Name);

            bool lvalue_instance = !spec.IsStatic && TypeManager.IsValueType (spec.DeclaringType);
            bool out_access = right_side == EmptyExpression.OutAccess.Instance || right_side == EmptyExpression.LValueMemberOutAccess;

            Expression e = DoResolve (ec, lvalue_instance, out_access);

            if (e == null)
                return null;

            spec.MemberDefinition.SetIsAssigned ();

            if ((right_side == EmptyExpression.UnaryAddress || right_side == EmptyExpression.OutAccess.Instance) &&
                    (spec.Modifiers & Modifiers.VOLATILE) != 0) {
                ec.Report.Warning (420, 1, loc,
                    "`{0}': A volatile field references will not be treated as volatile",
                    spec.GetSignatureForError ());
            }

            if (spec.IsReadOnly) {
                // InitOnly fields can only be assigned in constructors or initializers
                if (!ec.HasAny (ResolveContext.Options.FieldInitializerScope | ResolveContext.Options.ConstructorScope))
                    return Report_AssignToReadonly (ec, right_side);

                if (ec.HasSet (ResolveContext.Options.ConstructorScope)) {

                    // InitOnly fields cannot be assigned-to in a different constructor from their declaring type
                    if (!TypeManager.IsEqual (ec.CurrentMemberDefinition.Parent.Definition, DeclaringType.GetDefinition ()))
                        return Report_AssignToReadonly (ec, right_side);
                    // static InitOnly fields cannot be assigned-to in an instance constructor
                    if (IsStatic && !ec.IsStatic)
                        return Report_AssignToReadonly (ec, right_side);
                    // instance constructors can't modify InitOnly fields of other instances of the same type
                    if (!IsStatic && !(InstanceExpression is This))
                        return Report_AssignToReadonly (ec, right_side);
                }
            }

            if (right_side == EmptyExpression.OutAccess.Instance &&
                !IsStatic && !(InstanceExpression is This) && TypeManager.mbr_type != null && TypeManager.IsSubclassOf (DeclaringType, TypeManager.mbr_type)) {
                ec.Report.SymbolRelatedToPreviousError (DeclaringType);
                ec.Report.Warning (197, 1, loc,
                        "Passing `{0}' as ref or out or taking its address may cause a runtime exception because it is a field of a marshal-by-reference class",
                        GetSignatureForError ());
            }

            eclass = ExprClass.Variable;
            return this;
        }
开发者ID:speier,项目名称:shake,代码行数:53,代码来源:ecore.cs

示例11: ResolveMemberAccess

        public override MemberExpr ResolveMemberAccess(ResolveContext ec, Expression left, Location loc,
            SimpleName original)
        {
            //
            // If the event is local to this class, we transform ourselves into a FieldExpr
            //

            if (spec.DeclaringType == ec.CurrentType ||
                TypeManager.IsNestedChildOf(ec.CurrentType, spec.DeclaringType)) {

                // TODO: Breaks dynamic binder as currect context fields are imported and not compiled
                EventField mi = spec.MemberDefinition as EventField;

                if (mi != null && mi.HasBackingField) {
                    mi.SetIsUsed ();
                    if (!ec.IsObsolete)
                        mi.CheckObsoleteness (loc);

                    if ((mi.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0 && !ec.HasSet (ResolveContext.Options.CompoundAssignmentScope))
                        Error_AssignmentEventOnly (ec);

                    FieldExpr ml = new FieldExpr (mi.BackingField, loc);

                    InstanceExpression = null;

                    return ml.ResolveMemberAccess (ec, left, loc, original);
                }
            }

            if (left is This && !ec.HasSet (ResolveContext.Options.CompoundAssignmentScope))
                Error_AssignmentEventOnly (ec);

            return base.ResolveMemberAccess (ec, left, loc, original);
        }
开发者ID:speier,项目名称:shake,代码行数:34,代码来源:ecore.cs

示例12: CreateCallSiteBinder

		public Expression CreateCallSiteBinder (ResolveContext ec, Arguments args)
		{
			Arguments binder_args = new Arguments (4);

			MemberAccess ns;
			if (ec.Module.PredefinedTypes.IsPlayScriptAotMode) {
				ns = new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "PlayScript", loc);
			} else {
				ns = new MemberAccess (new MemberAccess (
					new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Linq", loc), "Expressions", loc);
			}

			var flags = ec.HasSet (ResolveContext.Options.CheckedScope) ? CSharpBinderFlags.CheckedContext : 0;

			binder_args.Add (new Argument (new BinderFlags (flags, this)));
			binder_args.Add (new Argument (new MemberAccess (new MemberAccess (ns, "ExpressionType", loc), name, loc)));
			binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc)));
			binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc)));

			return new Invocation (GetBinder ("UnaryOperation", loc), binder_args);
		}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:21,代码来源:dynamic.cs

示例13: CreateCallSiteBinder

		public Expression CreateCallSiteBinder (ResolveContext ec, Arguments args)
		{
			Arguments binder_args = new Arguments (4);

			MemberAccess ns;
			if (ec.Module.PredefinedTypes.IsPlayScriptAotMode) {
				ns = new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "PlayScript", loc);
			} else {
				ns = new MemberAccess (new MemberAccess (
					new QualifiedAliasMember (QualifiedAliasMember.GlobalAlias, "System", loc), "Linq", loc), "Expressions", loc);
			}

			CSharpBinderFlags flags = 0;
			if (ec.HasSet (ResolveContext.Options.CheckedScope))
				flags = CSharpBinderFlags.CheckedContext;

			if ((oper & Binary.Operator.LogicalMask) != 0)
				flags |= CSharpBinderFlags.BinaryOperationLogical;

			binder_args.Add (new Argument (new EnumConstant (new IntLiteral (ec.BuiltinTypes, (int) flags, loc), ec.Module.PredefinedTypes.GetBinderFlags(ec).Resolve ())));
			binder_args.Add (new Argument (new MemberAccess (new MemberAccess (ns, "ExpressionType", loc), this.name, loc)));
			binder_args.Add (new Argument (new TypeOf (ec.CurrentType, loc)));									
			binder_args.Add (new Argument (new ImplicitlyTypedArrayCreation (args.CreateDynamicBinderArguments (ec), loc)));

			return new Invocation (new MemberAccess (new TypeExpression (ec.Module.PredefinedTypes.GetBinder(ec).TypeSpec, loc), "BinaryOperation", loc), binder_args);
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:26,代码来源:dynamic.cs

示例14: Compatible

		//
		// Returns AnonymousMethod container if this anonymous method
		// expression can be implicitly converted to the delegate type `delegate_type'
		//
		public Expression Compatible (ResolveContext ec, TypeSpec type)
		{
			Expression am;
			if (compatibles.TryGetValue (type, out am))
				return am;

			TypeSpec delegate_type = CompatibleChecks (ec, type);
			if (delegate_type == null)
				return null;

			//
			// At this point its the first time we know the return type that is 
			// needed for the anonymous method.  We create the method here.
			//

			var invoke_mb = Delegate.GetInvokeMethod (delegate_type);
			TypeSpec return_type = invoke_mb.ReturnType;

			//
			// Second: the return type of the delegate must be compatible with 
			// the anonymous type.   Instead of doing a pass to examine the block
			// we satisfy the rule by setting the return type on the EmitContext
			// to be the delegate type return type.
			//

			var body = CompatibleMethodBody (ec, null, return_type, delegate_type);
			if (body == null)
				return null;

			bool etree_conversion = delegate_type != type;

			try {
				if (etree_conversion) {
					if (ec.HasSet (ResolveContext.Options.ExpressionTreeConversion)) {
						//
						// Nested expression tree lambda use same scope as parent
						// lambda, this also means no variable capturing between this
						// and parent scope
						//
						am = body.Compatible (ec, ec.CurrentAnonymousMethod);

						//
						// Quote nested expression tree
						//
						if (am != null)
							am = new Quote (am);
					} else {
						int errors = ec.Report.Errors;

						using (ec.Set (ResolveContext.Options.ExpressionTreeConversion)) {
							am = body.Compatible (ec);
						}

						//
						// Rewrite expressions into expression tree when targeting Expression<T>
						//
						if (am != null && errors == ec.Report.Errors)
							am = CreateExpressionTree (ec, delegate_type);
					}
				} else {
					if (Block.IsAsync) {
						var rt = body.ReturnType;
						if (rt.Kind != MemberKind.Void &&
							rt != ec.Module.PredefinedTypes.Task.TypeSpec &&
							!rt.IsGenericTask) {
							ec.Report.Error (4010, loc, "Cannot convert async {0} to delegate type `{1}'",
								GetSignatureForError (), type.GetSignatureForError ());
						}

						AsyncInitializer.Create (ec, body.Block, body.Parameters, ec.CurrentMemberDefinition.Parent, rt, loc);
					}

					am = body.Compatible (ec);
				}
			} catch (CompletionResult) {
				throw;
			} catch (Exception e) {
				throw new InternalErrorException (e, loc);
			}

			if (!ec.IsInProbingMode) {
				compatibles.Add (type, am ?? EmptyExpression.Null);
			}

			return am;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:90,代码来源:anonymous.cs

示例15: CreateExpressionTree

        public override Expression CreateExpressionTree(ResolveContext ec)
        {
            Arguments args = new Arguments (2);
            args.Add (new Argument (child.CreateExpressionTree (ec)));
            args.Add (new Argument (new TypeOf (new TypeExpression (type, loc), loc)));

            if (type.IsPointer || child.Type.IsPointer)
                Error_PointerInsideExpressionTree (ec);

            return CreateExpressionFactoryCall (ec, ec.HasSet (ResolveContext.Options.CheckedScope) ? "ConvertChecked" : "Convert", args);
        }
开发者ID:speier,项目名称:shake,代码行数:11,代码来源:ecore.cs


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