Babel.Compiler.MethodBaseData.Match C# (CSharp) Method

Match() public method

public Match ( TypedNodeList arguments ) : bool
arguments TypedNodeList
return bool
        public virtual bool Match(TypedNodeList arguments)
        {
            if (Parameters.Count != arguments.Length)
                return false;
            int pos = 0;
            foreach (ModalExpression arg in arguments) {
                ParameterData param = (ParameterData) Parameters[pos++];
                TypeData paramType = param.ParameterType;
                switch (arg.Mode) {
                case ArgumentMode.In:
                case ArgumentMode.Once:
                    if (paramType.IsByRef) {
                        return false;
                    }
                    if (arg.NodeType == null)
                        continue;
                    if (!arg.NodeType.IsSubtypeOf(paramType))
                        return false;
                    break;
                case ArgumentMode.Out:
                    if (!paramType.IsByRef || param.Mode != ArgumentMode.Out)
                        return false;
                    TypeData eltType = paramType.ElementType;
                    if (!eltType.IsSubtypeOf(arg.NodeType) ||
                        eltType.IsValueType && !arg.NodeType.IsValueType)
                        return false;
                    break;
                case ArgumentMode.InOut:
                    if (!paramType.IsByRef || param.Mode != ArgumentMode.InOut)
                        return false;
                    if (arg.NodeType != paramType.ElementType)
                        return false;
                    break;
                }
            }
            return true;
        }