diff --git a/compiler/erg_compiler/lib.rs b/compiler/erg_compiler/lib.rs index 94ff20c5b..f248dab45 100644 --- a/compiler/erg_compiler/lib.rs +++ b/compiler/erg_compiler/lib.rs @@ -15,12 +15,12 @@ pub mod effectcheck; pub mod error; pub mod global; pub mod hir; +pub mod index; pub mod link; pub mod linter; pub mod lower; pub mod mod_cache; -// pub mod name_resolve; -pub mod index; +pub mod name_resolve; pub mod optimize; pub mod ownercheck; pub mod reorder; diff --git a/compiler/erg_compiler/name_resolve.rs b/compiler/erg_compiler/name_resolve.rs new file mode 100644 index 000000000..0b3549738 --- /dev/null +++ b/compiler/erg_compiler/name_resolve.rs @@ -0,0 +1,2 @@ +#[derive(Debug)] +pub struct NameResolver {} diff --git a/doc/zh_CN/dev_guide/test.md b/doc/zh_CN/dev_guide/test.md index 93b2e2c5b..be86a0b01 100644 --- a/doc/zh_CN/dev_guide/test.md +++ b/doc/zh_CN/dev_guide/test.md @@ -1,25 +1,25 @@ -# 测试 - -[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432) - -测试是确保代码质量的重要部分 - -使用以下命令执行测试 - -``` sh -cargo test --features large_thread -``` - -由于cargo需要一个小线程来运行测试,我们使用 `large_thread` 标志来避免堆栈溢出 - -## 放置测试 - -根据实现的特性来安排它们。将解析器测试放置在`erg_parser/tests`下,将编译器(类型检查器等)测试放置在`erg_compiler/tests`下,将用户可以直接使用的语言特性测试放置在`erg/tests`下(然而,这些测试目前正在开发中,不一定按照这种惯例安排) - -## 如何编写测试 - -有两种类型的测试。positive测试和negative测试。 -positive测试是检查编译器是否按预期运行的测试,而negative测试是检查编译器是否正确地输出无效输入的错误。 -由于编程语言处理器的性质,在所有软件中,它们特别容易受到无效输入的影响,并且必须始终将错误呈现给用户,因此后者也必须得到照顾。 - -如果你在语言中添加了一个新特性,你至少需要写一个positive测试。另外,如果可能的话,请写同时编写negative测试。 +# 测试 + +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432) + +测试是确保代码质量的重要部分 + +使用以下命令执行测试 + +``` sh +cargo test --features large_thread +``` + +由于cargo需要一个小线程来运行测试,我们使用 `large_thread` 标志来避免堆栈溢出 + +## 放置测试 + +根据实现的特性来安排它们。将解析器测试放置在`erg_parser/tests`下,将编译器(类型检查器等)测试放置在`erg_compiler/tests`下,将用户可以直接使用的语言特性测试放置在`erg/tests`下(然而,这些测试目前正在开发中,不一定按照这种惯例安排) + +## 如何编写测试 + +有两种类型的测试。positive测试和negative测试。 +positive测试是检查编译器是否按预期运行的测试,而negative测试是检查编译器是否正确地输出无效输入的错误。 +由于编程语言处理器的性质,在所有软件中,它们特别容易受到无效输入的影响,并且必须始终将错误呈现给用户,因此后者也必须得到照顾。 + +如果你在语言中添加了一个新特性,你至少需要写一个positive测试。另外,如果可能的话,请写同时编写negative测试。 \ No newline at end of file diff --git a/doc/zh_TW/dev_guide/test.md b/doc/zh_TW/dev_guide/test.md index 59396802c..28dfc9e66 100644 --- a/doc/zh_TW/dev_guide/test.md +++ b/doc/zh_TW/dev_guide/test.md @@ -1,25 +1,25 @@ -# 測試 - -[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432) - -測試是確保代碼質量的重要部分 - -使用以下命令執行測試 - -``` sh -cargo test --features large_thread -``` - -由于cargo需要一個小線程來運行測試,我們使用 `large_thread` 標志來避免堆棧溢出 - -## 放置測試 - -根據實現的特性來安排它們。將解析器測試放置在`erg_parser/tests`下,將編譯器(類型檢查器等)測試放置在`erg_compiler/tests`下,將用戶可以直接使用的語言特性測試放置在`erg/tests`下(然而,這些測試目前正在開發中,不一定按照這種慣例安排) - -## 如何編寫測試 - -有兩種類型的測試。positive測試和negative測試。 -positive測試是檢查編譯器是否按預期運行的測試,而negative測試是檢查編譯器是否正確地輸出無效輸入的錯誤。 -由于編程語言處理器的性質,在所有軟件中,它們特別容易受到無效輸入的影響,并且必須始終將錯誤呈現給用戶,因此后者也必須得到照顧。 - -如果你在語言中添加了一個新特性,你至少需要寫一個positive測試。另外,如果可能的話,請寫同時編寫negative測試。 +# 測試 + +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432) + +測試是確保代碼質量的重要部分 + +使用以下命令執行測試 + +``` sh +cargo test --features large_thread +``` + +由于cargo需要一個小線程來運行測試,我們使用 `large_thread` 標志來避免堆棧溢出 + +## 放置測試 + +根據實現的特性來安排它們。將解析器測試放置在`erg_parser/tests`下,將編譯器(類型檢查器等)測試放置在`erg_compiler/tests`下,將用戶可以直接使用的語言特性測試放置在`erg/tests`下(然而,這些測試目前正在開發中,不一定按照這種慣例安排) + +## 如何編寫測試 + +有兩種類型的測試。positive測試和negative測試。 +positive測試是檢查編譯器是否按預期運行的測試,而negative測試是檢查編譯器是否正確地輸出無效輸入的錯誤。 +由于編程語言處理器的性質,在所有軟件中,它們特別容易受到無效輸入的影響,并且必須始終將錯誤呈現給用戶,因此后者也必須得到照顧。 + +如果你在語言中添加了一個新特性,你至少需要寫一個positive測試。另外,如果可能的話,請寫同時編寫negative測試。 \ No newline at end of file