Esempio n. 1
0
		public FieldSpec CreateCallSiteField (FullNamedExpression type, Location loc)
		{
			int index = AnonymousMethodsCounter++;
			Field f = new HoistedField (this, type, Modifiers.PUBLIC | Modifiers.STATIC, "Site" + index.ToString ("X"), null, loc);
			f.Define ();

			AddField (f);
			return f.Spec;
		}
Esempio n. 2
0
        public FieldSpec CreateCallSiteField(FullNamedExpression type, Location loc)
        {
            int   index = fields == null ? 0 : fields.Count;
            Field f     = new HoistedField(this, type, Modifiers.PUBLIC | Modifiers.STATIC, "Site" + index.ToString("X"), null, loc);

            f.Define();

            AddField(f);
            return(f.Spec);
        }
Esempio n. 3
0
        public FieldSpec CreateCallSiteField(FullNamedExpression type, Location loc)
        {
            int   index = fields == null ? 0 : fields.Count;
            Field f     = new HoistedField(this, type, Modifiers.PUBLIC | Modifiers.STATIC, "Site" + index.ToString("X"), null, loc);

            f.Define();

            AddField(f);

            var fs = f.Spec;

            if (mutator != null)
            {
                //
                // Inflate the field, no need to keep it in MemberCache as it's accessed only once
                //
                var inflator = new TypeParameterInflator(instance_type, spec.MemberDefinition.TypeParameters, instance_type.TypeArguments);
                fs = (FieldSpec)fs.InflateMember(inflator);
            }

            return(fs);
        }
Esempio n. 4
0
		public Field AddCapturedVariable (string name, TypeSpec type)
		{
			CheckMembersDefined ();

			FullNamedExpression field_type = new TypeExpression (type, Location);
			if (!spec.IsGenericOrParentIsGeneric)
				return AddCompilerGeneratedField (name, field_type);

			const Modifiers mod = Modifiers.INTERNAL | Modifiers.COMPILER_GENERATED;
			Field f = new HoistedField (this, field_type, mod, name, null, Location);
			AddField (f);
			return f;
		}
Esempio n. 5
0
		public FieldSpec CreateCallSiteField (FullNamedExpression type, Location loc)
		{
			int index = AnonymousMethodsCounter++;
			Field f = new HoistedField (this, type, Modifiers.PUBLIC | Modifiers.STATIC, "Site" + index.ToString ("X"), null, loc);
			f.Define ();

			AddField (f);
			return f.Spec;
		}
        public FieldSpec CreateCallSiteField(FullNamedExpression type, Location loc)
        {
            int index = fields == null ? 0 : fields.Count;
            Field f = new HoistedField (this, type, Modifiers.PUBLIC | Modifiers.STATIC, "Site" + index.ToString ("X"), null, loc);
            f.Define ();

            AddField (f);

            var fs = f.Spec;
            if (mutator != null) {
                //
                // Inflate the field, no need to keep it in MemberCache as it's accessed only once
                //
                var inflator = new TypeParameterInflator (this, instance_type, spec.MemberDefinition.TypeParameters, instance_type.TypeArguments);
                fs = (FieldSpec) fs.InflateMember (inflator);
            }

            return fs;
        }
Esempio n. 7
0
        ////-------------------------------------------------------------------------------------------------------------------------------------------------

        //#region IEquatable<OperandCapture> Members

        //public bool Equals(OperandCapture other)
        //{
        //	if ( other != null )
        //	{
        //		return this.SourceOperand.Equals(other.SourceOperand);
        //	}
        //	else
        //	{
        //		return false;
        //	}
        //}

        //#endregion

        //-------------------------------------------------------------------------------------------------------------------------------------------------

        #region Overrides of Object

        //public override bool Equals(object obj)
        //{
        //	return Equals(obj as OperandCapture);
        //}

        ////-----------------------------------------------------------------------------------------------------------------------------------------------------

        //public override int GetHashCode()
        //{
        //	return this.SourceOperand.GetHashCode();
        //}

        //-------------------------------------------------------------------------------------------------------------------------------------------------

        public override string ToString()
        {
            return(HoistedField != null ? HoistedField.ToString() : SourceOperand.ToString());
        }