示例#1
0
        void VisitIn(DOMProperty property)
        {
            Assert.IsFalse(string.IsNullOrEmpty(property.type), "type is required for <property />");
            Assert.IsFalse(string.IsNullOrEmpty(property.name), "name is required for <property />");

            var fieldName = NameUtility.SlugifyFieldName(property.name);
            var pptName   = NameUtility.SlugifyConstName(property.name);

            var getterContent = property.getter != null ? property.getter.textContent : string.Empty;
            var setterContent = property.setter != null ? property.setter.textContent : string.Empty;

            GeneratePropertyInternal(property.type, property.name, fieldName, pptName, getterContent, setterContent);

            m_Class.AddField(new CSField(Scope.Private, fieldName, property.type, property.@default));
        }
示例#2
0
        void RegisterPropertyGetterDependencies(DOMProperty property)
        {
            Assert.IsNotNull(property);
            Assert.IsFalse(string.IsNullOrEmpty(property.name));

            if (property.getter != null && !string.IsNullOrEmpty(property.getter.textContent))
            {
                var matches = kVariableReference.Matches(property.getter.textContent);
                for (int i = 0; i < matches.Count; i++)
                {
                    var match = matches[i];
                    var referencedProperty = match.Groups[1].Value.Trim();
                    if (!m_PropertyGetterDependencies.ContainsKey(referencedProperty))
                    {
                        m_PropertyGetterDependencies[referencedProperty] = new HashSet <string>();
                    }
                    m_PropertyGetterDependencies[referencedProperty].Add(property.name);
                }
            }
        }