-
Notifications
You must be signed in to change notification settings - Fork 3
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 ProtocolReader #7
Conversation
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.
おお、大きな機能追加ありがとうございます。
パーサ実装は良さそうです。
テストコードはこれで十分だと思います。
対応しきれていないパターンは必要になった時に足せば良いでしょう。
@@ -5,6 +5,20 @@ import PackageDescription | |||
var dependencies: [Package.Dependency] = [] | |||
var targetDependencies: [Target.Dependency] = [] | |||
|
|||
#if swift(>=5.5) |
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.
Swift5.5/Xcode13.0環境では BinarySwiftSyntax
を使わずに SwiftSyntax
を使う状態になった?
これだと、未来のXcode14や、場合によってはXcode13.1でも動かなくなるので、
(指定してるSwiftSyntaxライブラリのバージョンと、ビルド環境が揃っていなければならない)
BinarySwiftSyntax
も更新して、
SwiftSytanx-Xcode13.0
ターゲットを提供するようにしたいですね。
このパッチのマージ後にいつかやるでいいですが。
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.
そのとおりだと思います。BinarySwiftSyntaxの作り方がよくわかっていなくてここは一旦サボりました
import Foundation | ||
|
||
public struct FunctionRequirement { | ||
public struct InputParameter { |
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.
FunctionにおいてParameterというと仮引数の事なので、「Input」というprefixは冗長なので消したいです。
Co-authored-by: omochimetaru <omochi.metaru@gmail.com>
概要
protocol
の読み取りに対応します。これにより、
protocol
をベースに実質的な関数型やクラス型を読み取ってコード生成し、TypeScriptに関数型を提供することが狙いです。型としての関数型やタプルには既存実装と同様に対応していません。
associatedtype
に対しても型名を読み取るだけです。実用上必要なタイミングがあれば型制約の部分の読み取りも実装します。レビューしてほしいところ
FunctionRequirement
PropertyRequirement
まわりの命名や保持するプロパティに違和感がないかその他
また
async
などの新しいキーワードを扱う都合上、Xcode12ではビルドできなくなります。(おそらくSwiftSyntaxの
asyncOrReasyncKeyword
が存在しないのでエラーになる)実用上問題ないかと思っているためXcode12への後方互換は気にしていない実装になっています。