示例#1
0
        public bool DoneRequesting(TypeResolver res, IWarningLogger log)
        {
            if (done_modifying)
            {
                throw ExHelp.InvalidOp("Cannot call DoneRequesting twice on a provider");
            }

            foreach (KeyValuePair <string, TargetBuilder> kvp in targets)
            {
                TargetValidity tv       = kvp.Value.Validity;
                string         fullname = Basis + kvp.Key;

                if (tv == TargetValidity.Referenced)
                {
                    // FIXME: this error message sucks
                    log.Error(2000, "A target was referenced from another provider " +
                              "that was not formally allowed to request it, and the " +
                              "target was not defined by its provider", fullname);
                    return(true);
                }

                if (tv == TargetValidity.Requested)
                {
                    TargetTemplate tmpl;

                    if (res.TryMatch(kvp.Key, MatcherKind.Dependency, out tmpl, log))
                    {
                        return(true);
                    }

                    if (tmpl == null)
                    {
                        log.Error(2027, "Could not guess a rule for a target " +
                                  "implicitly defined in a dependency. Do you " +
                                  "need to add a using [] line?", fullname);
                        return(true);
                    }

                    kvp.Value.Define(log);
                    tmpl.ApplyTemplate(kvp.Value);
                }
            }

            done_modifying = true;
            return(false);
        }
示例#2
0
	public bool DoneRequesting (TypeResolver res, IWarningLogger log) 
	{
	    if (done_modifying)
		throw ExHelp.InvalidOp ("Cannot call DoneRequesting twice on a provider");

	    foreach (KeyValuePair<string,TargetBuilder> kvp in targets) {
		TargetValidity tv = kvp.Value.Validity;
		string fullname = Basis + kvp.Key;

		if (tv == TargetValidity.Referenced) {
		    // FIXME: this error message sucks
		    log.Error (2000, "A target was referenced from another provider " +
			       "that was not formally allowed to request it, and the " +
			       "target was not defined by its provider", fullname);
		    return true;
		}

		if (tv == TargetValidity.Requested) {
		    TargetTemplate tmpl;

		    if (res.TryMatch (kvp.Key, MatcherKind.Dependency, out tmpl, log))
			return true;
			
		    if (tmpl == null) {
			log.Error (2027, "Could not guess a rule for a target " + 
				   "implicitly defined in a dependency. Do you " +
				   "need to add a using [] line?", fullname);
			return true;
		    }
		    
		    kvp.Value.Define (log);
		    tmpl.ApplyTemplate (kvp.Value);
		}
	    }

	    done_modifying = true;
	    return false;
	}
示例#3
0
	protected override TargetTemplate InferTemplate (TypeResolver res, IWarningLogger log)
	{
	    TargetTemplate tmpl = null;
	    string dtname = DirectTransformDep;
		    
	    if (dtname != null) {
		if (res.TryMatch (dtname, MatcherKind.DirectTransform, out tmpl, log))
		    return null;

		if (tmpl != null)
		    return tmpl;
	    }
		    
	    if (Rule == null) {
		if (res.TryMatch (Name, MatcherKind.Target, out tmpl, log))
		    return null;
	    }
		    
	    if (tmpl == null)
		log.Error (2028, "Cannot guess the template or rule for this target", FullName);

	    return tmpl;
	}