예제 #1
0
            public FieldMember FIELD(TypeMember type, string name, Action body = null)
            {
                var context          = GetContextOrThrow();
                var modifiers        = context.PopStateOrThrow <MemberModifierState>();
                var declaringTypeRef = context.TryLookupState <MemberRef <TypeMember> >();
                var member           = new FieldMember(
                    name,
                    declaringTypeRef,
                    MemberStatus.Generator,
                    modifiers.Visibility,
                    modifiers.Modifier,
                    ImmutableList <AttributeDescription> .Empty,
                    type.GetRef(),
                    modifiers.IsReadonly,
                    initializer: null);

                using (context.PushState(member.GetRef()))
                {
                    body?.Invoke();
                }

                return(member);
            }