Boo.Lang.Compiler.Steps.ProcessMethodBodies.AssertLValue C# (CSharp) Метод

AssertLValue() защищенный Метод

protected AssertLValue ( Node node, IEntity entity ) : bool
node Node
entity IEntity
Результат bool
        protected virtual bool AssertLValue(Node node, IEntity entity)
        {
            if (null != entity)
            {
                switch (entity.EntityType)
                {
                    case EntityType.Error:
                        return false;

                    case EntityType.Parameter:
                    case EntityType.Local:
                    case EntityType.Event: //for Event=null case (other => EventIsNotAnExpression)
                        return true;

                    case EntityType.Property:
                        {
                            var property = ((IProperty)entity);
                            if (property.GetSetMethod() == null)
                            {
                                Error(CompilerErrorFactory.PropertyIsReadOnly(MemberAnchorFor(node), property));
                                return false;
                            }
                            return true;
                        }

                    case EntityType.Field:
                        {
                            IField fld = (IField)entity;
                            if (TypeSystemServices.IsReadOnlyField(fld))
                            {
                                if (EntityType.Constructor == _currentMethod.EntityType
                                    && _currentMethod.DeclaringType == fld.DeclaringType
                                    && fld.IsStatic == _currentMethod.IsStatic)
                                {
                                    InternalField ifld = entity as InternalField;
                                    if (null != ifld && ifld.IsStatic)
                                        ifld.StaticValue = null; //downgrade 'literal' to 'init-only'
                                }
                                else
                                {
                                    Error(CompilerErrorFactory.FieldIsReadonly(MemberAnchorFor(node), entity.FullName));
                                    return false;
                                }
                            }
                            return true;
                        }
                }
            }
            LValueExpected(node);
            return false;
        }

Same methods

ProcessMethodBodies::AssertLValue ( Expression node ) : bool
ProcessMethodBodies