Example #1
0
        public string GetName(IEmitter emitter)
        {
            string fieldName = this.Name;

            if (this.VarInitializer != null)
            {
                var rr = emitter.Resolver.ResolveNode(this.VarInitializer, emitter) as MemberResolveResult;
                fieldName = OverloadsCollection.Create(emitter, rr.Member).GetOverloadName();
            }
            else if (this.Entity is PropertyDeclaration)
            {
                fieldName = OverloadsCollection.Create(emitter, (PropertyDeclaration)this.Entity).GetOverloadName();
            }
            else
            {
                fieldName = emitter.ChangeCase ? TypeConfigItem.ToLowerCamelCase(fieldName) : fieldName;
            }
            return(fieldName);
        }
        public string GetName(IEmitter emitter)
        {
            string fieldName = this.Name;

            if (this.VarInitializer != null)
            {
                var rr = emitter.Resolver.ResolveNode(this.VarInitializer, emitter) as MemberResolveResult;
                fieldName = OverloadsCollection.Create(emitter, rr.Member).GetOverloadName();
            }
            else if (this.Entity is PropertyDeclaration)
            {
                fieldName = OverloadsCollection.Create(emitter, (PropertyDeclaration)this.Entity).GetOverloadName();
            }
            else
            {
                fieldName = emitter.AssemblyInfo.PreserveMemberCase ? fieldName : TypeConfigItem.ToLowerCamelCase(fieldName);

                if (Helpers.IsReservedWord(fieldName))
                {
                    fieldName = Helpers.ChangeReservedWord(fieldName);
                }
            }
            return(fieldName);
        }
Example #3
0
        public string GetName(IEmitter emitter, bool withoutTypeParams = false)
        {
            string fieldName = this.Name;

            if (this.VarInitializer != null)
            {
                var rr = emitter.Resolver.ResolveNode(this.VarInitializer, emitter) as MemberResolveResult;
                fieldName = OverloadsCollection.Create(emitter, rr.Member).GetOverloadName(false, null, withoutTypeParams);
            }
            else if (this.Entity is PropertyDeclaration)
            {
                fieldName = OverloadsCollection.Create(emitter, (PropertyDeclaration)this.Entity).GetOverloadName(false, null, withoutTypeParams);
            }
            else
            {
                bool done = false;
                if (this.Entity != null)
                {
                    var rr = emitter.Resolver.ResolveNode(this.Entity, emitter) as MemberResolveResult;

                    if (rr != null)
                    {
                        fieldName = OverloadsCollection.Create(emitter, rr.Member).GetOverloadName(false, null, withoutTypeParams);
                        done      = true;
                    }
                }

                if (!done)
                {
                    fieldName = emitter.AssemblyInfo.PreserveMemberCase ? fieldName : TypeConfigItem.ToLowerCamelCase(fieldName);

                    /*if (Helpers.IsReservedWord(fieldName))
                     * {
                     *  fieldName = Helpers.ChangeReservedWord(fieldName);
                     * }*/
                }
            }
            return(fieldName);
        }