internal Scope FindScopeByElementType(BamlKnownTypeCode typeCode)
            {
                var scope = this;

                while (scope != null)
                {
                    if (scope.ElementType != null && IsType(scope.ElementType, typeCode))
                    {
                        return(scope);
                    }

                    scope = scope.Parent;
                }

                return(null);
            }
        private static bool IsType(IBamlType bamlType, BamlKnownTypeCode typeCode)
        {
            var bamlKnownType = bamlType as BamlKnownType;

            if (bamlKnownType == null)
            {
                return(false);
            }

            if (bamlKnownType.KnownCode != typeCode)
            {
                return(false);
            }

            return(true);
        }
        private static bool IsProperty(IBamlProperty bamlProperty, string name, BamlKnownTypeCode typeCode)
        {
            var bamlPropertyInfo = bamlProperty as BamlPropertyInfo;

            if (bamlPropertyInfo == null)
            {
                return(false);
            }

            if (bamlPropertyInfo.Name != name)
            {
                return(false);
            }

            if (!IsType(bamlPropertyInfo.Type, typeCode))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public BamlKnownType(BamlKnownTypeCode knownCode)
 {
     _knownCode = knownCode;
 }