Simon Hausmann
e40aec1b4e
Silence warning about dead code
2020-07-17 14:51:19 +02:00
Simon Hausmann
a356dc2725
Fix build without display-diagnostics
2020-07-17 14:42:17 +02:00
Simon Hausmann
114b51f32b
Add include paths to CompilerConfiguration
...
We'll try to load .60 files from those paths.
2020-07-17 12:15:03 +02:00
Simon Hausmann
ada5f68908
Add aggregating BuildDiagnostics
...
This type aggregates different per-file diagnostics into a similar interface,
in preparation for reporting diagnostics from multiple source files.
2020-07-17 12:10:25 +02:00
Simon Hausmann
893b5132c8
Further encapsulate Diagnostics
...
Use has_error() and a new convenience function to get the diagnostics as a string vector.
2020-07-17 11:52:29 +02:00
Simon Hausmann
4c65760322
Fold FileLoadError into the diagnostics module
...
The FileDiagnostics now hold a vector of Diagnostic elements, which is an
enum of either a CompilerDiagnostic or a FileLoadError.
2020-07-16 18:28:27 +02:00
Simon Hausmann
e914715d88
Rename Diagnostics to FileDiagnostics
...
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00
Simon Hausmann
4c1e4c4da4
Reduce direct access to CompilerDiagnostic::message
...
Instead use to_string(), to make it easier to change in the future.
2020-07-16 18:22:23 +02:00
Simon Hausmann
23ee925947
Diagnostics refactoring, part 2
...
Remove the need for PartialEq for the Diagnostics. The objective is to
introduce an enum here in the future
that may hold types that do not support
PartialEq. It turns out that we don't really need it though.
2020-07-16 17:49:29 +02:00
Simon Hausmann
a68cf95d98
Diagnostics refactoring
...
Remove the need to clone compiler diagnostics. We can avoid it here it
seems.
2020-07-16 17:44:52 +02:00
Simon Hausmann
c85f2537d3
Fix signature of function to load types from a directory
...
Taking &mut self makes more sense when wanting to populate from a list.
Also we should return a list of diagnostics for each file that we loaded
or an error if we couldn't load the file (for example due to permission
problems, etc.).
This way the caller can choose to show diagnostics, ignore them, etc.
2020-07-16 13:45:45 +02:00
Olivier Goffart
0fbf38f642
Let the compilerlib compile without the codemap dependencies
...
The idea is that we wouldn't need to bring this dependencies
if the interpreter is running on wasm for example
2020-07-15 19:08:00 +02:00
Simon Hausmann
055517dc2c
Remove duplicated code in Diagnostics emission
2020-07-15 17:34:11 +02:00
Simon Hausmann
8e047d3761
Simplify compiler diagnostics API
...
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.
There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Simon Hausmann
107aa63a7c
Add the ability to extend a type registry with a .60 file
2020-07-15 14:30:02 +02:00
Olivier Goffart
250b0a2e5b
Rust macro: get the right span for the diagnostics
...
Merge the features proc_macro_span and proc_macro_diagnostics, they are the same.
2020-05-27 18:37:45 +02:00
Simon Hausmann
e77fe37568
Make it more convenient to deal with diagnostics in the Rust frontend
...
Provide a ToTokens implementation of Diagnostics by moving the code from the macro.
This makes it easier later to re-use the same logic to return
with diagnostics.
2020-05-26 15:17:18 +02:00
Simon Hausmann
96d5165d28
Correctly report type conversion errors in the C++ backend
...
This requires a bit of error propagation, but now the errors are
reported correctly, in the unlikely event that they occur.
2020-05-26 11:45:22 +02:00
Olivier Goffart
ab28828351
Support for img!("foo.png") to make string absolute
...
This is a temporary solution until we get better ressource handling
2020-05-19 16:30:48 +02:00
Olivier Goffart
f88d856990
Put the diagnostic printing in the compiler lib
...
(with an option so we don't drag the codemap dependencies for the proc_macro case)
2020-05-12 17:42:25 +02:00
Olivier Goffart
b9cd725f78
Allow to use proc_macro tokens
...
And report errors
2020-05-11 22:24:28 +02:00
Olivier Goffart
3a541ec1eb
Handle children elements
2020-05-06 16:43:04 +02:00
Olivier Goffart
cd670d6012
Compiler tests
2020-05-05 12:43:42 +02:00
Olivier Goffart
3a6d39bfe9
Generate an object tree
2020-05-05 11:18:13 +02:00