-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MethodDescriptor: add input and output types #1503
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,34 +149,30 @@ class MethodDescriptor private[descriptors] ( | |
|
||
def getOptions = asProto.getOptions | ||
|
||
lazy val inputType: ScalaType = { | ||
lazy val inputType: Descriptor = { | ||
val inputType = asProto.inputType.getOrElse( | ||
throw new DescriptorValidationException(this, "missing method input type") | ||
) | ||
|
||
ScalaType.Message( | ||
FileDescriptor | ||
.find(containingService.file, this, inputType) | ||
.getOrElse( | ||
throw new DescriptorValidationException(this, "couldn't build input type descriptor") | ||
) | ||
.asInstanceOf[Descriptor] | ||
) | ||
FileDescriptor | ||
.find(containingService.file, this, inputType) | ||
.getOrElse( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets use pattern matching on |
||
throw new DescriptorValidationException(this, "couldn't build input type descriptor") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
.asInstanceOf[Descriptor] | ||
} | ||
|
||
lazy val outputType: ScalaType = { | ||
lazy val outputType: Descriptor = { | ||
val outputType = asProto.outputType.getOrElse( | ||
throw new DescriptorValidationException(this, "missing method output type") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
|
||
ScalaType.Message( | ||
FileDescriptor | ||
.find(containingService.file, this, outputType) | ||
.getOrElse( | ||
throw new DescriptorValidationException(this, "couldn't build output type descriptor") | ||
) | ||
.asInstanceOf[Descriptor] | ||
) | ||
FileDescriptor | ||
.find(containingService.file, this, outputType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as earlier comments (capital letter, avoid asInstanceOf through pattern matching) |
||
.getOrElse( | ||
throw new DescriptorValidationException(this, "couldn't build output type descriptor") | ||
) | ||
.asInstanceOf[Descriptor] | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s"Missing method input type for method $fullName"