コード例 #1
0
        public bool Validate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params, CodeGeneratorContext context)
        {
            if (ConstraintExpressions == null || ConstraintExpressions.Length == 0)
            {
                return(true);
            }
            if (validated)
            {
                return(is_valid);
            }
            var syms = new List <ISymbol> ();

            foreach (var c in ConstraintExpressions)
            {
                var sym = opt.SymbolTable.Lookup(c, type_params);
                if (sym == null)
                {
                    Report.LogCodedWarning(0, Report.WarningUnknownGenericConstraint, c, context.GetContextTypeMember());
                    validated = true;
                    return(false);
                }
                syms.Add(sym);
            }
            Constraints = syms.ToArray();
            validated   = is_valid = true;
            return(true);
        }
コード例 #2
0
 public bool Validate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params, CodeGeneratorContext context)
 {
     sym = (IsEnumified ? opt.SymbolTable.Lookup(managed_type, type_params) : null) ?? opt.SymbolTable.Lookup(java_type, type_params);
     if (sym == null)
     {
         Report.LogCodedWarning(0, Report.WarningUnknownReturnType, owner, java_type, context.GetContextTypeMember());
         return(false);
     }
     if (!sym.Validate(opt, type_params, context))
     {
         Report.LogCodedWarning(0, Report.WarningInvalidReturnType, owner, java_type, context.GetContextTypeMember());
         return(false);
     }
     return(true);
 }
コード例 #3
0
ファイル: Parameter.cs プロジェクト: jonpryor/java.interop
 public bool Validate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params, CodeGeneratorContext context)
 {
     sym = opt.SymbolTable.Lookup(type, type_params);
     if (sym == null)
     {
         Report.LogCodedWarning(0, Report.WarningUnknownParameterType, this, type, context.GetContextTypeMember());
         return(false);
     }
     if (!sym.Validate(opt, type_params, context))
     {
         Report.LogCodedWarning(0, Report.WarningInvalidParameterType, this, type, context.GetContextTypeMember());
         return(false);
     }
     return(true);
 }
コード例 #4
0
ファイル: Field.cs プロジェクト: jonpryor/java.interop
        public bool Validate(CodeGenerationOptions opt, GenericParameterDefinitionList type_params, CodeGeneratorContext context)
        {
            Symbol = opt.SymbolTable.Lookup(TypeName, type_params);

            if (Symbol == null || !Symbol.Validate(opt, type_params, context))
            {
                Report.LogCodedWarning(0, Report.WarningUnexpectedFieldType, this, TypeName, context.GetContextTypeMember());
                return(false);
            }

            if (!string.IsNullOrEmpty(Value) && Symbol != null && Symbol.FullName == "char" && !Value.StartsWith("(char)"))
            {
                Value = "(char)" + Value;
            }

            SetParameters = new ParameterList {
                SetterParameter,
            };

            if (!SetParameters.Validate(opt, type_params, context))
            {
                throw new NotSupportedException(
                          string.Format("Unable to generate setter parameter list {0}", context.ContextString));
            }

            return(true);
        }