예제 #1
0
파일: Idioms.cs 프로젝트: x335/WootzJs
        public JsExpression GetPropertyValue(JsExpression target, IPropertySymbol property, bool isSetter, bool isBaseReference)
        {
            bool isExported = property.IsExported();
            var propertyName = property.GetMemberName();

            JsExpression inline;
            if (!isSetter && TryInline(property.GetMethod, target, new JsExpression[0], out inline))
            {
                return inline;
            }

            if (!isExported || IsMinimizedAutoProperty(property))
            {
                return target.Member(propertyName);
            }
            else
            {
                bool isExtension = property.IsExtension();
                if (isExtension || isBaseReference)
                    return InvokeMethodAs(property.GetMethod, target);
                else if (property.GetMethod != null)
                    return target.Member(property.GetMethod.GetMemberName()).Invoke();
                else 
                    return target.Member("get_" + property.GetMemberName()).Invoke();
            }
        }