示例#1
0
void case_132()
#line 1206 "cs-parser.jay"
{
		if (doc_support) {
			current_field.DocComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.Allowed;
	    }

		current_field.Initializer = (ConstInitializer) yyVals[-2+yyTop];	    
		lbag.AddMember (current_field, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop]));
		yyVal = current_field;
	    current_field = null;
	  }
示例#2
0
文件: class.cs 项目: 0xd4d/NRefactory
		public bool AddField (FieldBase field)
		{
			AddMember (field);

			if ((field.ModFlags & Modifiers.STATIC) != 0)
				return true;

			var first_field = PartialContainer.first_nonstatic_field;
			if (first_field == null) {
				PartialContainer.first_nonstatic_field = field;
				return true;
			}

			if (Kind == MemberKind.Struct && first_field.Parent != field.Parent) {
				Report.SymbolRelatedToPreviousError (first_field.Parent);
				Report.Warning (282, 3, field.Location,
					"struct instance field `{0}' found in different declaration from instance field `{1}'",
					field.GetSignatureForError (), first_field.GetSignatureForError ());
			}
			return true;
		}
示例#3
0
void case_130()
#line 1182 "cs-parser.jay"
{ 
		if (doc_support) {
			current_field.DocComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.Allowed;
		}
			
		lbag.AddMember (current_field, GetModifierLocations (), GetLocation (yyVals[0+yyTop]));
		yyVal = current_field;
		current_field = null;
	  }
示例#4
0
void case_131()
#line 1195 "cs-parser.jay"
{ 
		if (lang_version < LanguageVersion.ISO_2)
			FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "fixed size buffers");

		var lt = (LocatedToken) yyVals[0+yyTop];
		current_field = new FixedField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop],
			new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
			
		current_type.AddField (current_field);
	  }
示例#5
0
void case_116()
#line 1082 "cs-parser.jay"
{
		var lt = (LocatedToken) yyVals[0+yyTop];
		var mod = (Modifiers) yyVals[-3+yyTop];
		current_field = new Const (current_type, (FullNamedExpression) yyVals[-1+yyTop], mod, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
		current_type.AddMember (current_field);
		
		if ((mod & Modifiers.STATIC) != 0) {
			report.Error (504, current_field.Location, "The constant `{0}' cannot be marked static", current_field.GetSignatureForError ());
		}
		
		yyVal = current_field;
	  }
示例#6
0
void case_129()
#line 1167 "cs-parser.jay"
{
	  	lexer.parsing_generic_declaration = false;

		FullNamedExpression type = (FullNamedExpression) yyVals[-1+yyTop];
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (670, GetLocation (yyVals[-1+yyTop]), "Fields cannot have void type");
			
		var lt = (LocatedToken) yyVals[0+yyTop];
		current_field = new Field (current_type, type, (Modifiers) yyVals[-2+yyTop], new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-3+yyTop]);
		current_type.AddField (current_field);
		yyVal = current_field;
	  }
示例#7
0
		public virtual FullNamedExpression GetFieldTypeExpression (FieldBase field)
		{
			return new TypeExpression (field.MemberType, Name.Location); 
		}
示例#8
0
		public ConstInitializer (FieldBase field, Expression value, Location loc)
			: base (value)
		{
			this.loc = loc;
			this.field = field;
		}
示例#9
0
 public ConstInitializer(FieldBase field, Expression value, Location loc)
     : base(value)
 {
     this.loc   = loc;
     this.field = field;
 }
示例#10
0
 public virtual FullNamedExpression GetFieldTypeExpression(FieldBase field)
 {
     return(new TypeExpression(field.MemberType, Name.Location));
 }
示例#11
0
		public FieldInitializer (FieldBase mc, Expression expression, Location loc)
			: base (new FieldExpr (mc.Spec, expression.Location), expression, loc)
		{
			this.mc = mc;
			if (!mc.IsStatic)
				((FieldExpr)target).InstanceExpression = new CompilerGeneratedThis (mc.CurrentType, expression.Location);
		}