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); }
void case_123() #line 1129 "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; }
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; }
void case_121() #line 1105 "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; }
void case_122() #line 1118 "cs-parser.jay" { if (lang_version < LanguageVersion.ISO_2) FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "fixed size buffers"); var lt = (Tokenizer.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); }
void case_120() #line 1090 "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 = (Tokenizer.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; }
void case_107() #line 1005 "cs-parser.jay" { var lt = (Tokenizer.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; }
public ConstInitializer(FieldBase field, Expression value, Location loc) : base(value) { this.loc = loc; this.field = field; }
void case_138() #line 1232 "ps-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop]; var mod = (Modifiers) yyVals[-4+yyTop]; mod &= ~Modifiers.STATIC; current_field = new Const (current_type, (FullNamedExpression) yyVals[0+yyTop], mod, new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-5+yyTop]); if (is_config_enabled) { current_type.AddMember (current_field); } is_config_enabled = true; yyVal = current_field; }
public ConstInitializer (FieldBase field, Expression value, Location loc) : base (value) { this.loc = loc; this.field = field; }