コード例 #1
0
ファイル: NameLookupContext.cs プロジェクト: retahc/old-code
        public override bool ResolveName(string name, out TargetTemplate tmpl, IWarningLogger log)
        {
            tmpl = null;

            Type t;

            if (ResolveType(name, out t, log))
            {
                return(true);
            }

            if (t.IsSubclassOf(typeof(Rule)))
            {
                Type t2 = TemplateForRule(t, log);

                if (t2 == null)
                {
                    // So yeah this is kinda dumb namespacing.
                    tmpl = new Mono.Build.RuleLib.RegexMatcher.RuleOnlyTemplate(t);
                    return(false);
                }

                t = t2;
            }

            if (!t.IsSubclassOf(typeof(TargetTemplate)))
            {
                string s = String.Format("Type {0} (resolved from {1}) should be a TargetTemplate but isn't",
                                         t.FullName, name);
                log.Error(2022, s, null);
                return(true);
            }

            object o;

            if (InstantiateBoundType(t, out o, log))
            {
                return(true);
            }

            tmpl = (TargetTemplate)o;
            return(false);
        }
コード例 #2
0
ファイル: NameLookupContext.cs プロジェクト: emtees/old-code
	public override bool ResolveName (string name, out TargetTemplate tmpl, IWarningLogger log) 
	{
	    tmpl = null;

	    Type t;

	    if (ResolveType (name, out t, log))
		return true;

	    if (t.IsSubclassOf (typeof (Rule))) {
		Type t2 = TemplateForRule (t, log);

		if (t2 == null) {
		    // So yeah this is kinda dumb namespacing.
		    tmpl = new Mono.Build.RuleLib.RegexMatcher.RuleOnlyTemplate (t);
		    return false;
		}

		t = t2;
	    }

	    if (!t.IsSubclassOf (typeof (TargetTemplate))) {
		string s = String.Format ("Type {0} (resolved from {1}) should be a TargetTemplate but isn't",
					  t.FullName, name);
		log.Error (2022, s, null);
		return true;
	    }

	    object o;

	    if (InstantiateBoundType (t, out o, log))
		return true;

	    tmpl = (TargetTemplate) o;
	    return false;
	}