public DependencyPropertyValueRule(IStyleSelector selector,
                                    ValueDeclaration <TValue> declaration)
 {
     Selector    = selector;
     _hashCode   = selector.GetHashCode() & declaration.GetHashCode();
     Declaration = declaration;
 }
Exemplo n.º 2
0
        public JsonNode CreateKeyValuePair(TextRange textRange, KeyDeclaration key, ValueDeclaration value)
        {
            Assume.NotNull(textRange, nameof(textRange));
            Assume.NotNull(key, nameof(key));
            Assume.NotNull(value, nameof(value));

            return(new KeyValueDeclaration(key, value, textRange));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Fetch Type Declaration, and tests if it's equal or derived from a specific TypeNode
        /// Fails if declaration is not of a Type
        /// </summary>
        public ValueDeclaration FetchValue(String name, System.Type expected)
        {
            ValueDeclaration vdecl = FetchValue(name);

            if (vdecl == null || !vdecl.ISA(expected))
            {
                throw new InvalidIdentifier("Invalid value '" + vdecl + "'. Required '" + expected + "'");
            }
            return(vdecl);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Parametric Check function for ValueDeclaration. Returns null if not found
        /// </summary>
        public T CheckValue <T>(String name) where T : ValueDeclaration
        {
            ValueDeclaration decl = GetDeclaration(name) as ValueDeclaration;

            if (decl == null || !(decl is T))
            {
                return(null);
            }
            return((T)decl);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Fetch Value Declaration.
        /// Fails if declaration is not of a Type
        /// </summary>
        public ValueDeclaration FetchValue(String name)
        {
            Declaration decl = GetDeclaration(name);

            if (decl == null)
            {
                throw new DeclarationNotFound(name);
            }

            if (!(decl is ValueDeclaration))
            {
                throw new InvalidIdentifier("Identifier '" + name + "' does not refer to a value decla");
            }

            ValueDeclaration tdecl = (ValueDeclaration)decl;

            return(tdecl);
        }
Exemplo n.º 6
0
 public virtual T Visit(ValueDeclaration node)
 {
     return(Visit((Declaration)node));
 }
        public JsonNode CreateKeyValuePair(TextRange textRange, KeyDeclaration key, ValueDeclaration value)
        {
            Assume.NotNull(textRange, nameof(textRange));
            Assume.NotNull(key, nameof(key));
            Assume.NotNull(value, nameof(value));

            return new KeyValueDeclaration(key, value, textRange);
        }
Exemplo n.º 8
0
 public override bool Visit(ValueDeclaration node)
 {
     Visit((Declaration)node);
     return(true);
 }