protected override bool OnValidate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params) { if (validated) { return(is_valid); } validated = true; if (!support.OnValidate(opt)) { is_valid = false; return(false); } // We're validating this in prior to BaseType. if (TypeParameters != null && !TypeParameters.Validate(opt, type_params)) { is_valid = false; return(false); } if (Char.IsNumber(Name [0])) { // it is an anonymous class which does not need output. is_valid = false; return(false); } base_symbol = IsAnnotation ? opt.SymbolTable.Lookup("java.lang.Object") : BaseType != null?opt.SymbolTable.Lookup(BaseType) : null; if (base_symbol == null && FullName != "Java.Lang.Object" && FullName != "System.Object") { Report.Warning(0, Report.WarningClassGen + 2, "Class {0} has unknown base type {1}.", FullName, BaseType); is_valid = false; return(false); } if ((base_symbol != null && !base_symbol.Validate(opt, TypeParameters)) || !base.OnValidate(opt, type_params)) { Report.Warning(0, Report.WarningClassGen + 3, "Class {0} has invalid base type {1}.", FullName, BaseType); is_valid = false; return(false); } List <Ctor> valid_ctors = new List <Ctor> (); foreach (Ctor c in ctors) { if (c.Validate(opt, TypeParameters)) { valid_ctors.Add(c); } } ctors = valid_ctors; return(true); }
protected override bool OnValidate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params) { if (validated) { return(is_valid); } validated = true; // Due to demand to validate in prior to validate ClassGen's BaseType, it is *not* done at // GenBase. if (TypeParameters != null && !TypeParameters.Validate(opt, type_params)) { return(false); } if (!base.OnValidate(opt, type_params) || iface_validation_failed || MethodValidationFailed) { if (iface_validation_failed) { Report.Warning(0, Report.WarningInterfaceGen + 2, "Invalidating {0} and all nested types because some of its interfaces were invalid.", FullName); } else if (MethodValidationFailed) { Report.Warning(0, Report.WarningInterfaceGen + 3, "Invalidating {0} and all nested types because some of its methods were invalid.", FullName); } foreach (GenBase nest in NestedTypes) { nest.Invalidate(); } is_valid = false; return(false); } return(true); }