Beispiel #1
0
        private Variable findVariable(Type type)
        {
            if (type == InputVariable.VariableType)
            {
                return(InputVariable);
            }

            if (_specific.Matches(type))
            {
                return(_specific.Create(type));
            }

            var created = Frames.SelectMany(x => x.Creates).FirstOrDefault(x => x.VariableType == type);

            if (created != null)
            {
                return(created);
            }


            var source = Config.Sources.FirstOrDefault(x => x.Matches(type));

            if (source == null)
            {
                throw new ArgumentOutOfRangeException(nameof(type),
                                                      $"Jasper doesn't know how to build a variable of type '{type.FullName}'");
            }

            return(source.Create(type));
        }