private void BuildCode(PropertySymbol propertySymbol)
        {
            if (propertySymbol.IsAbstract)
            {
                return;
            }

            ImplementationBuilder implBuilder = new ImplementationBuilder(_options, _errorHandler);

            propertySymbol.AddImplementation(implBuilder.BuildPropertyGetter(propertySymbol), /* getter */ true);
            _implementations.Add(propertySymbol.GetterImplementation);

            if (propertySymbol.IsReadOnly == false)
            {
                propertySymbol.AddImplementation(implBuilder.BuildPropertySetter(propertySymbol), /* getter */ false);
                _implementations.Add(propertySymbol.SetterImplementation);
            }

            if (propertySymbol.AnonymousMethods != null)
            {
                foreach (AnonymousMethodSymbol anonymousMethod in propertySymbol.AnonymousMethods)
                {
                    Debug.Assert(anonymousMethod.Implementation != null);

                    _implementations.Add(anonymousMethod.Implementation);
                }
            }
        }
Exemple #2
0
        private void BuildCode(PropertySymbol propertySymbol)
        {
            if (propertySymbol.IsAbstract)
            {
                return;
            }

            ImplementationBuilder implBuilder = new ImplementationBuilder(options, errorHandler);

            SymbolImplementation getter = implBuilder.BuildPropertyGetter(propertySymbol);

            if (getter != null)
            {
                propertySymbol.AddImplementation(getter, /* getter */ true);
                implementations.Add(getter);
            }

            SymbolImplementation setter = implBuilder.BuildPropertySetter(propertySymbol);

            if (setter != null)
            {
                propertySymbol.AddImplementation(setter, /* getter */ false);
                implementations.Add(setter);
            }

            if (propertySymbol.AnonymousMethods != null)
            {
                foreach (AnonymousMethodSymbol anonymousMethod in propertySymbol.AnonymousMethods)
                {
                    Debug.Assert(anonymousMethod.Implementation != null);

                    implementations.Add(anonymousMethod.Implementation);
                }
            }
        }