Exemplo n.º 1
0
 private PropertySymbol LoadProperty(PREDEFPROP property)
 {
     return(LoadProperty(
                property,
                GetPropName(property),
                GetPropGetter(property)));
 }
Exemplo n.º 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]);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 5
0
 private static PredefinedType GetPropPredefType(PREDEFPROP property)
 {
     return GetMethInfo(GetPropGetter(property)).type;
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
 private static PredefinedName GetPropPredefName(PREDEFPROP property)
 {
     return GetPropInfo(property).name;
 }
Exemplo n.º 9
0
 private Name GetPropName(PREDEFPROP property)
 {
     return GetPredefName(GetPropPredefName(property));
 }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
        // 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];
        }
Exemplo n.º 12
0
 private PropertySymbol LoadProperty(PREDEFPROP property)
 {
     return LoadProperty(
                 property,
                 GetPropName(property),
                 GetPropGetter(property),
                 GetPropSetter(property));
 }
Exemplo n.º 13
0
 private void ReportError(PREDEFPROP property)
 {
     ReportError(GetPropPredefType(property), GetPropPredefName(property));
 }
Exemplo n.º 14
0
        private static PropertySymbol LoadProperty(PREDEFPROP property)
        {
            PredefinedPropertyInfo info = GetPropInfo(property);

            return(LoadProperty(property, NameManager.GetPredefinedName(info.name), info.getter));
        }
Exemplo n.º 15
0
 private static PredefinedType GetPropPredefType(PREDEFPROP property)
 {
     return(GetMethInfo(GetPropGetter(property)).type);
 }
Exemplo n.º 16
0
 public PredefinedPropertyInfo(PREDEFPROP property, PredefinedName name, PREDEFMETH getter)
 {
     this.property = property;
     this.name     = name;
     this.getter   = getter;
 }
Exemplo n.º 17
0
 private static PredefinedName GetPropPredefName(PREDEFPROP property)
 {
     return(GetPropInfo(property).name);
 }
Exemplo n.º 18
0
 public PropertySymbol GetProperty(PREDEFPROP property)
 {
     Debug.Assert(property >= 0 && property < PREDEFPROP.PP_COUNT);
     return(_properties[(int)property] ?? (_properties[(int)property] = LoadProperty(property)));
 }
Exemplo n.º 19
0
 private Name GetPropName(PREDEFPROP property)
 {
     return(GetPredefName(GetPropPredefName(property)));
 }
Exemplo n.º 20
0
        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];
        }
Exemplo n.º 21
0
 public PredefinedPropertyInfo(PREDEFPROP property, MethodRequiredEnum required, PredefinedName name, PREDEFMETH getter, PREDEFMETH setter)
 {
     this.property = property;
     this.name = name;
     this.getter = getter;
     this.setter = setter;
 }