Commit graph

14 commits

Author SHA1 Message Date
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