Example #1
0
 private PropertySymbol LoadProperty(PREDEFPROP property)
 {
     return(LoadProperty(
                property,
                GetPropName(property),
                GetPropGetter(property)));
 }
Example #2
0
        private static PredefinedPropertyInfo GetPropInfo(PREDEFPROP property)
        {
            Debug.Assert(property >= 0 && property < PREDEFPROP.PP_COUNT);
            Debug.Assert(s_predefinedProperties[(int)property].property == property);

            return(s_predefinedProperties[(int)property]);
        }
Example #3
0
        private static PREDEFMETH GetPropGetter(PREDEFPROP property)
        {
            PREDEFMETH result = GetPropInfo(property).getter;

            // getters are MethodRequiredEnum.Required
            Debug.Assert(result >= 0 && result < PREDEFMETH.PM_COUNT);

            return(result);
        }
Example #4
0
        private PropertySymbol LoadProperty(
            PREDEFPROP predefProp,
            Name propertyName,
            PREDEFMETH propertyGetter)
        {
            Debug.Assert(propertyName != null);
            Debug.Assert(propertyGetter >= 0 && propertyGetter < PREDEFMETH.PM_COUNT);

            RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable(
                GetPredefAgg(GetPropPredefType(predefProp)), propertyName);
            MethodSymbol getter = GetMethod(propertyGetter);

            getter.SetMethKind(MethodKindEnum.PropAccessor);
            PropertySymbol property = getter.getProperty();
            Debug.Assert(property != null);
            return property;
        }
 private static PredefinedType GetPropPredefType(PREDEFPROP property)
 {
     return GetMethInfo(GetPropGetter(property)).type;
 }
        private static PREDEFMETH GetPropSetter(PREDEFPROP property)
        {
            PREDEFMETH result = GetPropInfo(property).setter;

            // setters are not MethodRequiredEnum.Required
            Debug.Assert(result > PREDEFMETH.PM_FIRST && result <= PREDEFMETH.PM_COUNT);

            return GetPropInfo(property).setter;
        }
        public PropertySymbol GetProperty(PREDEFPROP property)  // Reports an error if the property is not found.
        {
            PropertySymbol result = EnsureProperty(property);
            if (result == null)
            {
                ReportError(property);
            }

            return result;
        }
 private static PredefinedName GetPropPredefName(PREDEFPROP property)
 {
     return GetPropInfo(property).name;
 }
 private Name GetPropName(PREDEFPROP property)
 {
     return GetPredefName(GetPropPredefName(property));
 }
        private PropertySymbol LoadProperty(
            PREDEFPROP predefProp,
            Name propertyName,
            PREDEFMETH propertyGetter,
            PREDEFMETH propertySetter)
        {
            Debug.Assert(propertyName != null);
            Debug.Assert(propertyGetter > PREDEFMETH.PM_FIRST && propertyGetter < PREDEFMETH.PM_COUNT);
            Debug.Assert(propertySetter > PREDEFMETH.PM_FIRST && propertySetter <= PREDEFMETH.PM_COUNT);

            MethodSymbol getter = GetOptionalMethod(propertyGetter);
            MethodSymbol setter = null;
            if (propertySetter != PREDEFMETH.PM_COUNT)
            {
                setter = GetOptionalMethod(propertySetter);
            }

            if (getter == null && setter == null)
            {
                RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable(GetOptPredefAgg(GetPropPredefType(predefProp)), propertyName);
                getter = GetOptionalMethod(propertyGetter);
                if (propertySetter != PREDEFMETH.PM_COUNT)
                {
                    setter = GetOptionalMethod(propertySetter);
                }
            }

            if (setter != null)
            {
                setter.SetMethKind(MethodKindEnum.PropAccessor);
            }

            PropertySymbol property = null;
            if (getter != null)
            {
                getter.SetMethKind(MethodKindEnum.PropAccessor);
                property = getter.getProperty();

                // Didn't find it, so load it.
                if (property == null)
                {
                    RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable(GetOptPredefAgg(GetPropPredefType(predefProp)), propertyName);
                }
                property = getter.getProperty();
                Debug.Assert(property != null);

                if (property.name != propertyName ||
                    (propertySetter != PREDEFMETH.PM_COUNT &&
                        (setter == null ||
                         !setter.isPropertyAccessor() ||
                         setter.getProperty() != property)) ||
                    property.getBogus())
                {
                    property = null;
                }
            }

            return property;
        }
        // property specific helpers
        private PropertySymbol EnsureProperty(PREDEFPROP property)
        {
            RETAILVERIFY((int)property > (int)PREDEFMETH.PM_FIRST && (int)property < (int)PREDEFMETH.PM_COUNT);

            if (_properties[(int)property] == null)
            {
                _properties[(int)property] = LoadProperty(property);
            }
            return _properties[(int)property];
        }
 private PropertySymbol LoadProperty(PREDEFPROP property)
 {
     return LoadProperty(
                 property,
                 GetPropName(property),
                 GetPropGetter(property),
                 GetPropSetter(property));
 }
 private void ReportError(PREDEFPROP property)
 {
     ReportError(GetPropPredefType(property), GetPropPredefName(property));
 }
Example #14
0
        private static PropertySymbol LoadProperty(PREDEFPROP property)
        {
            PredefinedPropertyInfo info = GetPropInfo(property);

            return(LoadProperty(property, NameManager.GetPredefinedName(info.name), info.getter));
        }
Example #15
0
 private static PredefinedType GetPropPredefType(PREDEFPROP property)
 {
     return(GetMethInfo(GetPropGetter(property)).type);
 }
Example #16
0
 public PredefinedPropertyInfo(PREDEFPROP property, PredefinedName name, PREDEFMETH getter)
 {
     this.property = property;
     this.name     = name;
     this.getter   = getter;
 }
Example #17
0
 private static PredefinedName GetPropPredefName(PREDEFPROP property)
 {
     return(GetPropInfo(property).name);
 }
Example #18
0
 public PropertySymbol GetProperty(PREDEFPROP property)
 {
     Debug.Assert(property >= 0 && property < PREDEFPROP.PP_COUNT);
     return(_properties[(int)property] ?? (_properties[(int)property] = LoadProperty(property)));
 }
Example #19
0
 private Name GetPropName(PREDEFPROP property)
 {
     return(GetPredefName(GetPropPredefName(property)));
 }
        public static PredefinedPropertyInfo GetPropInfo(PREDEFPROP property)
        {
            RETAILVERIFY(property > PREDEFPROP.PP_FIRST && property < PREDEFPROP.PP_COUNT);
            RETAILVERIFY(s_predefinedProperties[(int)property].property == property);

            return s_predefinedProperties[(int)property];
        }
 public PredefinedPropertyInfo(PREDEFPROP property, MethodRequiredEnum required, PredefinedName name, PREDEFMETH getter, PREDEFMETH setter)
 {
     this.property = property;
     this.name = name;
     this.getter = getter;
     this.setter = setter;
 }