public override Stream <CompilationMessage> VisitVariable(VariableElement parameter, Void ignored) { Name annotation = parameter.getAnnotation(typeof(Name)); if (annotation == null) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: return(Stream.of(new ParameterMissingAnnotationError(parameter, AnnotationMirror(parameter.AnnotationMirrors), "@%s usage error: missing on parameter <%s>", typeof(Name).FullName, NameOf(parameter)))); } if (!_parameterTypeVisitor.visit(parameter.asType())) { Element method = parameter.EnclosingElement; return(Stream.of(new ParameterTypeError(parameter, "Unsupported parameter type <%s> of " + "procedure|function" + " %s#%s", parameter.asType().ToString(), method.EnclosingElement.SimpleName, method.SimpleName))); } return(Stream.empty()); }
private Stream <CompilationMessage> ValidateReturnType(ExecutableElement method) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getCanonicalName method: string streamClassName = typeof(Stream).FullName; TypeMirror streamType = _typeUtils.erasure(_elementUtils.getTypeElement(streamClassName).asType()); TypeMirror returnType = method.ReturnType; TypeMirror erasedReturnType = _typeUtils.erasure(returnType); TypeMirror voidType = _typeUtils.getNoType(TypeKind.VOID); if (_typeUtils.isSameType(returnType, voidType)) { return(Stream.empty()); } if (!_typeUtils.isSubtype(erasedReturnType, streamType)) { return(Stream.of(new ReturnTypeError(method, "Return type of %s#%s must be %s", method.EnclosingElement.SimpleName, method.SimpleName, streamClassName))); } return(_recordVisitor.visit(returnType)); }
//////////////////////////////////////////////////////////////////// public void visit(TypeVisitor v) { v.visit(this); }
public override void visit(TypeVisitor v) { v.visit(this); }
private Stream <CompilationMessage> ValidateFieldType(Element recordElement) { return(fieldsIn(recordElement.EnclosedElements).Where(element => !element.Modifiers.contains(STATIC)).Where(element => !_fieldTypeVisitor.visit(element.asType())).Select(element => new RecordTypeError(element, "Record definition error: type of field %s#%s is not supported", recordElement.SimpleName, element.SimpleName))); }