-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add async and throwing property support #267
Conversation
|
case .rethrows: | ||
return true | ||
case .typed(let errorType): | ||
return errorType != .neverType && errorType != "Swift.\(String.neverType)" |
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.
throws(Never)
means no throws. Without this consideration, there would be warnings in the generated code.
@@ -368,11 +368,48 @@ extension VariableDeclSyntax { | |||
typeName = vtype | |||
} | |||
|
|||
let storageType: VariableModel.MockStorageType | |||
switch v.accessorBlock?.accessors { |
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.
This block is very complicated 🤪 but mockolo handles both class and protocol here, so it has to be this way.
@@ -29,7 +41,7 @@ final class VariableModel: Model { | |||
} | |||
|
|||
var underlyingName: String { | |||
if isStatic || type.defaultVal() == nil { |
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.
The computed property is generated as below, but I think it is meaningless, so I will remove it.
https://github.com/uber/mockolo/pull/267/files#diff-0680dee8c19da68e406e1ecf918c1c39fe5c55214b3e399ac8dd929fe6b72c7cL43-L48
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.
Thank you for your PR! I will take more time to finish reviewing this PR.
Co-authored-by: Fumiya Tanaka <[email protected]>
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.
Thank you so much!
Main feature
Supported
{ get async throws }
.Side effects
var foo: Int { get }
, since the value is never set through original protocol, the call count has been removed.