Esempio n. 1
0
        /// <summary>
        /// Create a field without setting type info.
        /// </summary>
        private FieldEntity CreateFieldCore(string name, bool isStatic, bool prepare, Action <FieldEntity> extraInit = null)
        {
            if (_fields.ContainsKey(name))
            {
                Context.Error(CompilerMessages.FieldRedefinition, Name, name);
            }

            var fe = new FieldEntity(this)
            {
                Name     = name,
                IsStatic = isStatic,
            };

            _fields.Add(name, fe);

            extraInit?.Invoke(fe);

            if (prepare)
            {
                fe.PrepareSelf();
            }
            else
            {
                Context.UnpreparedTypeContents.Add(fe);
            }

            return(fe);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a field without setting type info.
        /// </summary>
        private FieldEntity createFieldCore(string name, bool isStatic, bool prepare)
        {
            if (_Fields.ContainsKey(name))
                Context.Error("Type '{0}' already contains field '{1}'!", Name, name);

            var fe = new FieldEntity
            {
                Name = name,
                IsStatic = isStatic,
                ContainerType = this,
            };

            _Fields.Add(name, fe);

            if(prepare)
                fe.PrepareSelf();

            return fe;
        }
Esempio n. 3
0
        /// <summary>
        /// Create a field without setting type info.
        /// </summary>
        private FieldEntity createFieldCore(string name, bool isStatic, bool prepare, Action<FieldEntity> extraInit = null)
        {
            if (_Fields.ContainsKey(name))
                Context.Error(CompilerMessages.FieldRedefinition, Name, name);

            var fe = new FieldEntity(this)
            {
                Name = name,
                IsStatic = isStatic,
            };

            _Fields.Add(name, fe);

            if (extraInit != null)
                extraInit(fe);

            if (prepare)
                fe.PrepareSelf();
            else
                Context.UnpreparedTypeContents.Add(fe);

            return fe;
        }