mirror of https://github.com/mtshiba/pylyzer
Compare commits
14 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
5eb9db3b8a | |
|
|
ebc7eaf929 | |
|
|
3a82bb0392 | |
|
|
8e8fc8eb29 | |
|
|
6f65d113b5 | |
|
|
a94a51aac8 | |
|
|
e7f3931d64 | |
|
|
bbe3bc39ab | |
|
|
b1988b73b1 | |
|
|
3a55f989da | |
|
|
51dbe6d7ec | |
|
|
7384e17243 | |
|
|
f505c18f74 | |
|
|
db79b8b233 |
|
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.19.0"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
|
@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.1"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
|
||||
checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
@ -75,9 +75,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.67"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
|
||||
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
|
|
@ -172,9 +172,12 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
|
@ -199,9 +202,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
|
@ -246,15 +249,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "els"
|
||||
version = "0.1.26-nightly.4"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c5a0e259df10904a6f0a16a63ad896cebfcbd46086c3cec3de72de82087460e"
|
||||
checksum = "17769c569be9b7c6b52b254651ad6e98e5c144d1e08a58c0dca94d3398b576a7"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_compiler",
|
||||
|
|
@ -274,21 +277,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "erg_common"
|
||||
version = "0.6.14-nightly.4"
|
||||
version = "0.6.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d198aa66805c129d8bf54ac2a6b141146f01a01b03b3b02777fb2bc88613578"
|
||||
checksum = "ac8819e38222e0a4e971b0835b83f02d5f990ab83a6912cbcd0e924aa0187fec"
|
||||
dependencies = [
|
||||
"backtrace-on-stack-overflow",
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
"parking_lot",
|
||||
"thread_local",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "erg_compiler"
|
||||
version = "0.6.14-nightly.4"
|
||||
version = "0.6.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1297cb7c6aacd21439a038ca8a4cdcc650fa1b92a23cb1ac902cb2d17dc4e1a4"
|
||||
checksum = "ce0197836e3ac1e09da5584543d3157d5ee3a7d151fe099c478008359d3cd879"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_parser",
|
||||
|
|
@ -296,9 +298,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "erg_parser"
|
||||
version = "0.6.14-nightly.4"
|
||||
version = "0.6.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac57a120256d58782ca7d0d336969894af7396918909b14cda8ddbf1bcd3a845"
|
||||
checksum = "da7dba865dc494c8348497e1917491a8f9efcd6908d1edff5f90b22aae70a214"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"unicode-xid 0.2.4",
|
||||
|
|
@ -318,9 +320,9 @@ checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
|
|||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
||||
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
|
@ -353,9 +355,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.27.2"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
|
||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
|
@ -368,9 +370,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
|
||||
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
|
|
@ -387,9 +389,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "lalrpop"
|
||||
|
|
@ -430,18 +432,25 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.144"
|
||||
version = "0.2.147"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
|
||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
|
||||
dependencies = [
|
||||
"autocfg 1.1.0",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
|
|
@ -473,9 +482,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
|
@ -522,22 +531,28 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
|
||||
dependencies = [
|
||||
"autocfg 1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.30.3"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
|
||||
checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
version = "0.2.3"
|
||||
|
|
@ -551,10 +566,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.2.0"
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall 0.3.5",
|
||||
"smallvec",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
|
|
@ -593,16 +631,16 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.58"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "py2erg"
|
||||
version = "0.0.31"
|
||||
version = "0.0.41"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_compiler",
|
||||
|
|
@ -611,7 +649,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pylyzer"
|
||||
version = "0.0.31"
|
||||
version = "0.0.41"
|
||||
dependencies = [
|
||||
"els",
|
||||
"erg_common",
|
||||
|
|
@ -622,9 +660,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.27"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
|
@ -750,6 +788,15 @@ version = "0.1.57"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.3.5"
|
||||
|
|
@ -757,19 +804,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.1.57",
|
||||
"rust-argon2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.8.1"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
||||
checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax 0.7.1",
|
||||
"regex-automata",
|
||||
"regex-syntax 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -780,9 +839,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.1"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
|
||||
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rust-argon2"
|
||||
|
|
@ -820,24 +879,30 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.163"
|
||||
version = "1.0.186"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
|
||||
checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.163"
|
||||
version = "1.0.186"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
|
||||
checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -846,9 +911,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.96"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
|
||||
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
|
@ -857,9 +922,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_repr"
|
||||
version = "0.1.12"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
|
||||
checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -884,6 +949,12 @@ version = "0.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.7.5"
|
||||
|
|
@ -926,9 +997,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.16"
|
||||
version = "2.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
|
||||
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -946,6 +1017,16 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
|
|
@ -1027,9 +1108,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.8"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
|
|
@ -1060,9 +1141,9 @@ checksum = "87d6678d7916394abad0d4b19df4d3802e1fd84abd7d701f39b75ee71b9e8cf1"
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.3.1"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
|
||||
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
|
|
@ -1097,3 +1178,60 @@ name = "winapi-x86_64-pc-windows-gnu"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
|
|
|||
10
Cargo.toml
10
Cargo.toml
|
|
@ -15,16 +15,16 @@ members = [
|
|||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.0.31"
|
||||
version = "0.0.41"
|
||||
authors = ["Shunsuke Shibayama <sbym1346@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/mtshiba/pylyzer"
|
||||
|
||||
[workspace.dependencies]
|
||||
erg_common = { version = "0.6.14-nightly.4", features = ["py_compat", "els"] }
|
||||
erg_compiler = { version = "0.6.14-nightly.4", features = ["py_compat", "els"] }
|
||||
els = { version = "0.1.26-nightly.4", features = ["py_compat"] }
|
||||
erg_common = { version = "0.6.19", features = ["py_compat", "els"] }
|
||||
erg_compiler = { version = "0.6.19", features = ["py_compat", "els"] }
|
||||
els = { version = "0.1.31", features = ["py_compat"] }
|
||||
rustpython-parser = "0.1.2"
|
||||
# erg_compiler = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compat", "els"] }
|
||||
# erg_common = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compat", "els"] }
|
||||
|
|
@ -45,7 +45,7 @@ erg_compiler = { workspace = true }
|
|||
erg_common = { workspace = true }
|
||||
els = { workspace = true }
|
||||
rustpython-parser = { workspace = true }
|
||||
py2erg = { version = "0.0.31", path = "./crates/py2erg" }
|
||||
py2erg = { version = "0.0.41", path = "./crates/py2erg" }
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::path::Path;
|
|||
|
||||
use erg_common::config::ErgConfig;
|
||||
use erg_common::dict::Dict as HashMap;
|
||||
use erg_common::fresh::fresh_varname;
|
||||
use erg_common::fresh::FRESH_GEN;
|
||||
use erg_common::set::Set as HashSet;
|
||||
use erg_common::traits::{Locational, Stream};
|
||||
use erg_common::{log, set};
|
||||
|
|
@ -19,7 +19,7 @@ use erg_compiler::erg_parser::ast::{
|
|||
VisModifierSpec,
|
||||
};
|
||||
use erg_compiler::erg_parser::desugar::Desugarer;
|
||||
use erg_compiler::erg_parser::token::{Token, TokenKind, AS, DOT, EQUAL};
|
||||
use erg_compiler::erg_parser::token::{Token, TokenKind, AS, COLON, DOT, EQUAL};
|
||||
use erg_compiler::erg_parser::Parser;
|
||||
use erg_compiler::error::{CompileError, CompileErrors};
|
||||
use rustpython_parser::ast::{
|
||||
|
|
@ -34,6 +34,21 @@ use crate::error::*;
|
|||
|
||||
pub const ARROW: Token = Token::dummy(TokenKind::FuncArrow, "->");
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum CanShadow {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
impl CanShadow {
|
||||
pub const fn is_yes(&self) -> bool {
|
||||
matches!(self, Self::Yes)
|
||||
}
|
||||
pub const fn is_no(&self) -> bool {
|
||||
matches!(self, Self::No)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum NameKind {
|
||||
Variable,
|
||||
|
|
@ -225,7 +240,7 @@ pub struct ASTConverter {
|
|||
block_id_counter: usize,
|
||||
block_ids: Vec<usize>,
|
||||
/// Erg does not allow variables to be defined multiple times, so rename them using this
|
||||
names: HashMap<String, NameInfo>,
|
||||
names: Vec<HashMap<String, NameInfo>>,
|
||||
warns: CompileErrors,
|
||||
errs: CompileErrors,
|
||||
}
|
||||
|
|
@ -238,18 +253,46 @@ impl ASTConverter {
|
|||
namespace: vec![String::from("<module>")],
|
||||
block_id_counter: 0,
|
||||
block_ids: vec![0],
|
||||
names: HashMap::new(),
|
||||
names: vec![HashMap::new()],
|
||||
warns: CompileErrors::empty(),
|
||||
errs: CompileErrors::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_name(&self, name: &str) -> Option<&NameInfo> {
|
||||
self.names.get(name)
|
||||
for ns in self.names.iter().rev() {
|
||||
if let Some(ni) = ns.get(name) {
|
||||
return Some(ni);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn get_mut_name(&mut self, name: &str) -> Option<&mut NameInfo> {
|
||||
self.names.get_mut(name)
|
||||
for ns in self.names.iter_mut().rev() {
|
||||
if let Some(ni) = ns.get_mut(name) {
|
||||
return Some(ni);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn define_name(&mut self, name: String, info: NameInfo) {
|
||||
self.names.last_mut().unwrap().insert(name, info);
|
||||
}
|
||||
|
||||
fn declare_name(&mut self, name: String, info: NameInfo) {
|
||||
self.names.first_mut().unwrap().insert(name, info);
|
||||
}
|
||||
|
||||
fn grow(&mut self, namespace: String) {
|
||||
self.namespace.push(namespace);
|
||||
self.names.push(HashMap::new());
|
||||
}
|
||||
|
||||
fn pop(&mut self) {
|
||||
self.namespace.pop();
|
||||
self.names.pop();
|
||||
}
|
||||
|
||||
fn cur_block_id(&self) -> usize {
|
||||
|
|
@ -260,14 +303,21 @@ impl ASTConverter {
|
|||
self.namespace.join(".")
|
||||
}
|
||||
|
||||
fn register_name_info(&mut self, name: &str, kind: NameKind) {
|
||||
fn register_name_info(&mut self, name: &str, kind: NameKind) -> CanShadow {
|
||||
let cur_namespace = self.cur_namespace();
|
||||
if let Some(name_info) = self.names.get_mut(name) {
|
||||
if name_info.defined_in == cur_namespace {
|
||||
let cur_block_id = self.cur_block_id();
|
||||
if let Some(name_info) = self.get_mut_name(name) {
|
||||
if name_info.defined_in == cur_namespace && name_info.defined_block_id == cur_block_id {
|
||||
name_info.defined_times += 1;
|
||||
} else if name_info.defined_in.is_unknown() {
|
||||
}
|
||||
if name_info.defined_in.is_unknown() {
|
||||
name_info.defined_in = DefinedPlace::Known(cur_namespace);
|
||||
name_info.defined_times += 1;
|
||||
name_info.defined_times += 1; // 0 -> 1
|
||||
}
|
||||
if name_info.defined_block_id == cur_block_id {
|
||||
CanShadow::Yes
|
||||
} else {
|
||||
CanShadow::No
|
||||
}
|
||||
} else {
|
||||
// In Erg, classes can only be defined in uppercase
|
||||
|
|
@ -279,7 +329,8 @@ impl ASTConverter {
|
|||
};
|
||||
let defined_in = DefinedPlace::Known(self.cur_namespace());
|
||||
let info = NameInfo::new(rename, defined_in, self.cur_block_id(), 1);
|
||||
self.names.insert(String::from(name), info);
|
||||
self.define_name(String::from(name), info);
|
||||
CanShadow::Yes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +371,7 @@ impl ASTConverter {
|
|||
};
|
||||
let mut info = NameInfo::new(None, defined_in, cur_block_id, 0);
|
||||
info.add_referrer(cur_namespace);
|
||||
self.names.insert(name.clone(), info);
|
||||
self.declare_name(name.clone(), info);
|
||||
name
|
||||
};
|
||||
let token = Token::new(
|
||||
|
|
@ -357,6 +408,7 @@ impl ASTConverter {
|
|||
Identifier::new(VisModifierSpec::Public(dot), name)
|
||||
}
|
||||
|
||||
// Duplicate param names will result in an error at the parser. So we don't need to check it here.
|
||||
fn convert_param_pattern(&mut self, arg: String, loc: PyLocation) -> ParamPattern {
|
||||
self.register_name_info(&arg, NameKind::Variable);
|
||||
let ident = self.convert_ident(arg, loc);
|
||||
|
|
@ -444,9 +496,8 @@ impl ASTConverter {
|
|||
(self.convert_for_param(name, expr.location), vec![])
|
||||
}
|
||||
ExpressionType::Tuple { elements } => {
|
||||
let tmp = fresh_varname();
|
||||
let tmp_name =
|
||||
VarName::from_str_and_line((&tmp).into(), expr.location.row() as u32);
|
||||
let tmp = FRESH_GEN.fresh_varname();
|
||||
let tmp_name = VarName::from_str_and_line(tmp, expr.location.row() as u32);
|
||||
let tmp_expr = Expr::Accessor(Accessor::Ident(Identifier::new(
|
||||
VisModifierSpec::Public(DOT),
|
||||
tmp_name.clone(),
|
||||
|
|
@ -1055,10 +1106,10 @@ impl ASTConverter {
|
|||
Expr::BinOp(BinOp::new(op, lhs, rhs))
|
||||
}
|
||||
ExpressionType::Lambda { args, body } => {
|
||||
self.namespace.push("<lambda>".to_string());
|
||||
self.grow("<lambda>".to_string());
|
||||
let params = self.convert_params(*args);
|
||||
let body = vec![self.convert_expr(*body)];
|
||||
self.namespace.pop();
|
||||
self.pop();
|
||||
let sig = LambdaSignature::new(params, None, TypeBoundSpecs::empty());
|
||||
let op = Token::from_str(TokenKind::FuncArrow, "->");
|
||||
Expr::Lambda(Lambda::new(sig, op, Block::new(body), DefId(0)))
|
||||
|
|
@ -1263,7 +1314,9 @@ impl ASTConverter {
|
|||
self.namespace.last().unwrap().into(),
|
||||
sig.ln_begin().unwrap_or(0),
|
||||
);
|
||||
let class_expr = Expr::Accessor(Accessor::Ident(class_ident.clone()));
|
||||
let class_spec = TypeSpec::mono(class_ident);
|
||||
let class_spec = TypeSpecWithOp::new(COLON, class_spec, class_expr);
|
||||
let sig = Signature::Subr(SubrSignature::new(
|
||||
set! { Decorator(Expr::static_local("Override")) },
|
||||
call_ident,
|
||||
|
|
@ -1287,7 +1340,9 @@ impl ASTConverter {
|
|||
let params = Params::new(vec![], None, vec![], None);
|
||||
let class_ident =
|
||||
Identifier::public_with_line(DOT, self.namespace.last().unwrap().into(), line as u32);
|
||||
let class_expr = Expr::Accessor(Accessor::Ident(class_ident.clone()));
|
||||
let class_spec = TypeSpec::mono(class_ident);
|
||||
let class_spec = TypeSpecWithOp::new(COLON, class_spec, class_expr);
|
||||
let sig = Signature::Subr(SubrSignature::new(
|
||||
set! { Decorator(Expr::static_local("Override")) },
|
||||
call_ident,
|
||||
|
|
@ -1322,8 +1377,7 @@ impl ASTConverter {
|
|||
if def
|
||||
.sig
|
||||
.ident()
|
||||
.map(|id| &id.inspect()[..] == "__init__")
|
||||
.unwrap_or(false)
|
||||
.is_some_and(|id| &id.inspect()[..] == "__init__")
|
||||
{
|
||||
if let Some(call_def) = self.extract_init(&mut base_type, def) {
|
||||
attrs.insert(0, ClassAttr::Def(call_def));
|
||||
|
|
@ -1406,15 +1460,11 @@ impl ASTConverter {
|
|||
loc: PyLocation,
|
||||
) -> Expr {
|
||||
// if reassigning of a function referenced by other functions is occurred, it is an error
|
||||
if self
|
||||
.get_name(&name)
|
||||
.map(|info| {
|
||||
info.defined_times > 0
|
||||
&& info.defined_in == DefinedPlace::Known(self.cur_namespace())
|
||||
&& !info.referenced.difference(&set! {name.clone()}).is_empty()
|
||||
})
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if self.get_name(&name).is_some_and(|info| {
|
||||
info.defined_times > 0
|
||||
&& info.defined_in == DefinedPlace::Known(self.cur_namespace())
|
||||
&& !info.referenced.difference(&set! {name.clone()}).is_empty()
|
||||
}) {
|
||||
let err = reassign_func_error(
|
||||
self.cfg.input.clone(),
|
||||
pyloc_to_ergloc(loc, name.len()),
|
||||
|
|
@ -1431,9 +1481,13 @@ impl ASTConverter {
|
|||
self.register_name_info(&name, NameKind::Function);
|
||||
let func_name_loc = PyLocation::new(loc.row(), loc.column() + 4);
|
||||
let ident = self.convert_ident(name, func_name_loc);
|
||||
self.namespace.push(ident.inspect().to_string());
|
||||
self.grow(ident.inspect().to_string());
|
||||
let params = self.convert_params(params);
|
||||
let return_t = returns.map(|ret| self.convert_type_spec(ret));
|
||||
let return_t = returns.map(|ret| {
|
||||
let t_spec = self.convert_type_spec(clone_loc_expr(&ret));
|
||||
let expr = self.convert_expr(ret);
|
||||
TypeSpecWithOp::new(COLON, t_spec, expr)
|
||||
});
|
||||
let sig = Signature::Subr(SubrSignature::new(
|
||||
decos,
|
||||
ident,
|
||||
|
|
@ -1444,7 +1498,7 @@ impl ASTConverter {
|
|||
let block = self.convert_block(body, BlockKind::Function);
|
||||
let body = DefBody::new(EQUAL, block, DefId(0));
|
||||
let def = Def::new(sig, body);
|
||||
self.namespace.pop();
|
||||
self.pop();
|
||||
Expr::Def(def)
|
||||
}
|
||||
}
|
||||
|
|
@ -1484,7 +1538,7 @@ impl ASTConverter {
|
|||
let class_name_loc = PyLocation::new(loc.row(), loc.column() + 6);
|
||||
let ident = self.convert_ident(name, class_name_loc);
|
||||
let sig = Signature::Var(VarSignature::new(VarPattern::Ident(ident.clone()), None));
|
||||
self.namespace.push(ident.inspect().to_string());
|
||||
self.grow(ident.inspect().to_string());
|
||||
let (base_type, methods) = self.extract_method_list(ident, body, inherit);
|
||||
let classdef = if inherit {
|
||||
// TODO: multiple inheritance
|
||||
|
|
@ -1519,7 +1573,7 @@ impl ASTConverter {
|
|||
let def = Def::new(sig, body);
|
||||
ClassDef::new(def, methods)
|
||||
};
|
||||
self.namespace.pop();
|
||||
self.pop();
|
||||
Expr::ClassDef(classdef)
|
||||
}
|
||||
|
||||
|
|
@ -1599,11 +1653,9 @@ impl ASTConverter {
|
|||
Expr::ReDef(adef)
|
||||
}
|
||||
ExpressionType::Tuple { elements } => {
|
||||
let tmp = fresh_varname();
|
||||
let tmp_name = VarName::from_str_and_line(
|
||||
(&tmp).into(),
|
||||
stmt.location.row() as u32,
|
||||
);
|
||||
let tmp = FRESH_GEN.fresh_varname();
|
||||
let tmp_name =
|
||||
VarName::from_str_and_line(tmp, stmt.location.row() as u32);
|
||||
let tmp_ident = Identifier::new(VisModifierSpec::Public(DOT), tmp_name);
|
||||
let tmp_expr = Expr::Accessor(Accessor::Ident(tmp_ident.clone()));
|
||||
let sig = Signature::Var(VarSignature::new(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use erg_common::config::Input;
|
||||
use erg_common::error::{ErrorCore, ErrorKind, Location, SubMessage};
|
||||
use erg_common::io::Input;
|
||||
use erg_common::switch_lang;
|
||||
use erg_compiler::error::CompileError;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use std::fs::File;
|
||||
use std::io::{BufWriter, Write};
|
||||
|
||||
use erg_common::config::Input;
|
||||
use erg_common::io::Input;
|
||||
use erg_common::log;
|
||||
use erg_common::traits::LimitedDisplay;
|
||||
use erg_compiler::context::register::{CheckStatus, PylyzerStatus};
|
||||
use erg_compiler::hir::{Expr, HIR};
|
||||
use erg_compiler::ty::value::{GenTypeObj, TypeObj};
|
||||
|
|
@ -25,23 +26,21 @@ pub struct DeclFileGenerator {
|
|||
|
||||
impl DeclFileGenerator {
|
||||
pub fn new(input: &Input, status: CheckStatus) -> Self {
|
||||
let (timestamp, hash) = if let Some(py_file_path) = input.path() {
|
||||
let (timestamp, hash) = {
|
||||
let py_file_path = input.path();
|
||||
let metadata = std::fs::metadata(py_file_path).unwrap();
|
||||
let dummy_hash = metadata.len();
|
||||
(metadata.modified().unwrap(), dummy_hash)
|
||||
} else {
|
||||
let now = std::time::SystemTime::now();
|
||||
(now, now.elapsed().unwrap().as_secs())
|
||||
};
|
||||
let status = PylyzerStatus {
|
||||
status,
|
||||
file: input.unescaped_path().into(),
|
||||
file: input.path().into(),
|
||||
timestamp,
|
||||
hash,
|
||||
};
|
||||
let code = format!("{status}\n");
|
||||
Self {
|
||||
filename: input.unescaped_filename().replace(".py", ".d.er"),
|
||||
filename: input.filename().replace(".py", ".d.er"),
|
||||
namespace: "".to_string(),
|
||||
code,
|
||||
}
|
||||
|
|
@ -68,7 +67,7 @@ impl DeclFileGenerator {
|
|||
.replace('\0', "")
|
||||
.replace('%', "___");
|
||||
let ref_t = def.sig.ident().ref_t();
|
||||
let typ = ref_t.replace_failure().to_string();
|
||||
let typ = ref_t.replace_failure().to_string_unabbreviated();
|
||||
let typ = escape_type(typ);
|
||||
// Erg can automatically import nested modules
|
||||
// `import http.client` => `http = pyimport "http"`
|
||||
|
|
@ -97,7 +96,7 @@ impl DeclFileGenerator {
|
|||
self.code += &decl;
|
||||
self.code.push('\n');
|
||||
if let GenTypeObj::Subclass(class) = &def.obj {
|
||||
let sup = class.sup.as_ref().typ().to_string();
|
||||
let sup = class.sup.as_ref().typ().to_string_unabbreviated();
|
||||
let sup = escape_type(sup);
|
||||
let decl = format!(".{class_name} <: {sup}\n");
|
||||
self.code += &decl;
|
||||
|
|
@ -108,7 +107,7 @@ impl DeclFileGenerator {
|
|||
}) = def.obj.base_or_sup()
|
||||
{
|
||||
for (attr, t) in rec.iter() {
|
||||
let typ = escape_type(t.to_string());
|
||||
let typ = escape_type(t.to_string_unabbreviated());
|
||||
let decl = format!("{}.{}: {typ}\n", self.namespace, attr.symbol);
|
||||
self.code += &decl;
|
||||
}
|
||||
|
|
@ -119,7 +118,7 @@ impl DeclFileGenerator {
|
|||
}) = def.obj.additional()
|
||||
{
|
||||
for (attr, t) in rec.iter() {
|
||||
let typ = escape_type(t.to_string());
|
||||
let typ = escape_type(t.to_string_unabbreviated());
|
||||
let decl = format!("{}.{}: {typ}\n", self.namespace, attr.symbol);
|
||||
self.code += &decl;
|
||||
}
|
||||
|
|
@ -147,7 +146,7 @@ pub fn reserve_decl_er(input: Input) {
|
|||
if !pycache_dir.exists() {
|
||||
std::fs::create_dir(pycache_dir).unwrap();
|
||||
}
|
||||
let filename = input.unescaped_filename();
|
||||
let filename = input.filename();
|
||||
let mut path = pycache_dir.join(filename);
|
||||
path.set_extension("d.er");
|
||||
if !path.exists() {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ use erg_common::Str;
|
|||
use erg_compiler::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArtifact};
|
||||
use erg_compiler::context::register::CheckStatus;
|
||||
use erg_compiler::context::ModuleContext;
|
||||
use erg_compiler::erg_parser::ast::{Module, AST};
|
||||
use erg_compiler::erg_parser::error::ParseErrors;
|
||||
use erg_compiler::erg_parser::ast::AST;
|
||||
use erg_compiler::erg_parser::error::{
|
||||
CompleteArtifact as PCompleteArtifact, IncompleteArtifact as PIncompleteArtifact, ParseErrors,
|
||||
};
|
||||
use erg_compiler::erg_parser::parse::Parsable;
|
||||
use erg_compiler::error::{CompileError, CompileErrors};
|
||||
use erg_compiler::lower::ASTLowerer;
|
||||
|
|
@ -21,7 +23,7 @@ use crate::handle_err;
|
|||
pub struct SimplePythonParser {}
|
||||
|
||||
impl Parsable for SimplePythonParser {
|
||||
fn parse(code: String) -> Result<Module, ParseErrors> {
|
||||
fn parse(code: String) -> Result<PCompleteArtifact, PIncompleteArtifact> {
|
||||
let py_program = parser::parse_program(&code).map_err(|_err| ParseErrors::empty())?;
|
||||
let shadowing = if cfg!(feature = "debug") {
|
||||
ShadowingMode::Visible
|
||||
|
|
@ -29,11 +31,18 @@ impl Parsable for SimplePythonParser {
|
|||
ShadowingMode::Invisible
|
||||
};
|
||||
let converter = py2erg::ASTConverter::new(ErgConfig::default(), shadowing);
|
||||
let IncompleteArtifact{ object: Some(erg_module), errors, .. } = converter.convert_program(py_program) else { unreachable!() };
|
||||
if errors.is_empty() {
|
||||
Ok(erg_module)
|
||||
let art = converter.convert_program(py_program);
|
||||
if art.errors.is_empty() {
|
||||
Ok(PCompleteArtifact::new(
|
||||
art.object.unwrap(),
|
||||
art.warns.into(),
|
||||
))
|
||||
} else {
|
||||
Err(ParseErrors::empty())
|
||||
Err(PIncompleteArtifact::new(
|
||||
art.object,
|
||||
art.errors.into(),
|
||||
art.warns.into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -155,11 +164,11 @@ impl PythonAnalyzer {
|
|||
}
|
||||
|
||||
pub fn run(&mut self) {
|
||||
if self.cfg.output_dir.is_some() {
|
||||
if self.cfg.dist_dir.is_some() {
|
||||
reserve_decl_er(self.cfg.input.clone());
|
||||
}
|
||||
let py_code = self.cfg.input.read();
|
||||
let filename = self.cfg.input.unescaped_filename();
|
||||
let filename = self.cfg.input.filename();
|
||||
println!("{BLUE}Start checking{RESET}: {filename}");
|
||||
match self.analyze(py_code, "exec") {
|
||||
Ok(artifact) => {
|
||||
|
|
@ -167,15 +176,12 @@ impl PythonAnalyzer {
|
|||
println!(
|
||||
"{YELLOW}Found {} warnings{RESET}: {}",
|
||||
artifact.warns.len(),
|
||||
self.cfg.input.unescaped_filename()
|
||||
self.cfg.input.filename()
|
||||
);
|
||||
artifact.warns.fmt_all_stderr();
|
||||
artifact.warns.write_all_stderr();
|
||||
}
|
||||
println!(
|
||||
"{GREEN}All checks OK{RESET}: {}",
|
||||
self.cfg.input.unescaped_filename()
|
||||
);
|
||||
if self.cfg.output_dir.is_some() {
|
||||
println!("{GREEN}All checks OK{RESET}: {}", self.cfg.input.filename());
|
||||
if self.cfg.dist_dir.is_some() {
|
||||
dump_decl_er(
|
||||
self.cfg.input.clone(),
|
||||
artifact.object,
|
||||
|
|
@ -190,27 +196,24 @@ impl PythonAnalyzer {
|
|||
println!(
|
||||
"{YELLOW}Found {} warnings{RESET}: {}",
|
||||
artifact.warns.len(),
|
||||
self.cfg.input.unescaped_filename()
|
||||
self.cfg.input.filename()
|
||||
);
|
||||
artifact.warns.fmt_all_stderr();
|
||||
artifact.warns.write_all_stderr();
|
||||
}
|
||||
let code = if artifact.errors.is_empty() {
|
||||
println!(
|
||||
"{GREEN}All checks OK{RESET}: {}",
|
||||
self.cfg.input.unescaped_filename()
|
||||
);
|
||||
println!("{GREEN}All checks OK{RESET}: {}", self.cfg.input.filename());
|
||||
0
|
||||
} else {
|
||||
println!(
|
||||
"{RED}Found {} errors{RESET}: {}",
|
||||
artifact.errors.len(),
|
||||
self.cfg.input.unescaped_filename()
|
||||
self.cfg.input.filename()
|
||||
);
|
||||
artifact.errors.fmt_all_stderr();
|
||||
artifact.errors.write_all_stderr();
|
||||
1
|
||||
};
|
||||
// Even if type checking fails, some APIs are still valid, so generate a file
|
||||
if self.cfg.output_dir.is_some() {
|
||||
if self.cfg.dist_dir.is_some() {
|
||||
dump_decl_er(
|
||||
self.cfg.input.clone(),
|
||||
artifact.object.unwrap(),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use erg_common::config::{ErgConfig, ErgMode, Input};
|
||||
use erg_common::config::{ErgConfig, ErgMode};
|
||||
use erg_common::io::Input;
|
||||
use erg_common::switch_lang;
|
||||
|
||||
fn command_message() -> &'static str {
|
||||
|
|
@ -94,7 +95,7 @@ pub(crate) fn parse_args() -> ErgConfig {
|
|||
cfg.quiet_repl = true;
|
||||
}
|
||||
"--dump-decl" => {
|
||||
cfg.output_dir = Some("");
|
||||
cfg.dist_dir = Some("");
|
||||
}
|
||||
"--verbose" => {
|
||||
cfg.verbose = args
|
||||
|
|
|
|||
|
|
@ -10,3 +10,8 @@ def g(x: int):
|
|||
if True:
|
||||
x = "a" # ERR
|
||||
return x
|
||||
|
||||
def h(x: str):
|
||||
if True:
|
||||
x = "a" # OK
|
||||
return x
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
i: int = 0
|
||||
i: str = "a" # OK
|
||||
|
||||
if True:
|
||||
i = 1 # ERR
|
||||
else:
|
||||
i = 2 # ERR
|
||||
|
||||
while False:
|
||||
i = 3 # ERR
|
||||
|
||||
def f(x: int):
|
||||
i = 1 # OK
|
||||
return x + i
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use erg_common::config::{ErgConfig, Input};
|
||||
use erg_common::config::ErgConfig;
|
||||
use erg_common::io::Input;
|
||||
use erg_common::spawn::exec_new_thread;
|
||||
use erg_common::traits::Stream;
|
||||
use erg_compiler::artifact::{CompleteArtifact, IncompleteArtifact};
|
||||
|
|
@ -103,3 +104,8 @@ fn exec_collections() {
|
|||
fn exec_call() {
|
||||
expect("tests/call.py", 0, 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exec_shadowing() {
|
||||
expect("tests/shadowing.py", 0, 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue