Exemple #1
0
        public bool MatchSig(JsMethodSignature signature, MatchAntiCycle antiCycle = null)
        {
            if (signature == this)
            {
                return(true);
            }

            antiCycle = antiCycle ?? new MatchAntiCycle();

            if (this.MoreArgsType == null && (signature.MoreArgsType != null || signature.ArgumentTypes.Length > this.ArgumentTypes.Length))
            {
                return(false);
            }

            if (!ArgumentTypes.Zip(signature.ArgumentTypes, (a, b) => a.MatchType(b, antiCycle)).All(_ => _))
            {
                return(false);
            }

            if (!signature.ArgumentTypes.Skip(this.ArgumentTypes.Length).All(a => this.MoreArgsType.MatchType(a, antiCycle)))
            {
                return(false);
            }

            if (!this.ArgumentTypes.Skip(signature.ArgumentTypes.Length).All(a => a.MatchType(signature.MoreArgsType, antiCycle)))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
 private void SetType(JsNode node, IJsTypeInfo type, JsPropertyInfo prop = null, JsMethodSignature sig = null)
 {
     var a = node.Annotation<JsNodeTypeAnnotation>() ?? node.AddAnnotation(new JsNodeTypeAnnotation());
     if (a.Type != null) a.Type = type;
     if (a.Property != null) a.Property = prop;
     if (a.FunctionSignature != null) a.FunctionSignature = sig;
 }