kcl
kcl copied to clipboard
Feat(Compiler-Base): Add diagnostic handler.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
- [ ] N
- [x] Y
issue #115
2. What is the scope of this PR (e.g. component or file name):
add diagnostic handler in compiler_base/error/lib.rs.
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [x] Contains experimental features
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Other
Turn TemplateLoader completely into a private crate for DiagnosticHandler.
Move some comments from TemplateLoader to DiagnosticHandler.
Move MessageArgs form 'compiler_base/error/diagnostic_message.rs' to 'compiler_base/error/lib.rs'.
Add DiagnosticHandler in 'compiler_base/error/lib.rs'.
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
- [x] N
- [ ] Y
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
- [x] Unit test
- [ ] Integration test
- [ ] Benchmark (add benchmark stats below)
- [ ] Manual test (add detailed scripts or steps below)
- [ ] Other
test cases in 'compiler_base/error/tests.rs'.
6. Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
None
Pull Request Test Coverage Report for Build 2968688349
- 0 of 0 changed or added relevant lines in 0 files are covered.
- 340 unchanged lines in 3 files lost coverage.
- Overall coverage increased (+0.3%) to 60.42%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| kclvm/tools/src/printer/tests.rs | 1 | 95.24% |
| kclvm/runtime/src/api/kclvm.rs | 25 | 44.44% |
| kclvm/runtime/src/value/api.rs | 314 | 0% |
| <!-- | Total: | 340 |
| Totals | |
|---|---|
| Change from base Build 2949877482: | 0.3% |
| Covered Lines: | 23789 |
| Relevant Lines: | 39373 |
💛 - Coveralls
Two important things:
DiagnosticHandlerpreferably has adefaultmethod, which loads the default template- It is necessary to write clearly how to write
*.ftltemplate in thelib.rsandnew_with_template_dirmethods, you can link the*.ftlofficial documentation.