Commit graph

64 commits

Author SHA1 Message Date
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Olivier Goffart
fed73bbd67 syntax_tests: Try to build the object_tree::document even in case of parse error
To make sure it doesn't panic.

Also fix a bunch of errors that were causing panic bacause missing elements in the tree

The goal it to be able to generate a best effort node required for the LSP
2021-04-14 11:46:49 +02:00
Olivier Goffart
cc619fd7d4 Fix reporting error without span
such as error from the interpreter that the file cannot be loaded
2021-03-24 11:12:38 +01:00
Olivier Goffart
455693dbc0 Documentation for the interpreter crate 2021-03-16 11:24:02 +01:00
Olivier Goffart
9676ed398d Fix wasm build 2021-03-15 15:14:15 +01:00
Olivier Goffart
cae88f0823 Create a Diagnostic quen the main .60 file can't be loaded 2021-03-15 11:44:20 +01:00
Olivier Goffart
014e13b05f Make Diagnostic field private 2021-03-15 10:37:24 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
11e0be5130 Add the SourceLocation into the Diagnostic 2021-03-12 12:49:19 +01:00
Olivier Goffart
fc35d101d9 Rename diagnostics::level to DiagnosticLevel 2021-03-11 16:27:40 +01:00
Olivier Goffart
968dfaae87 Put what is the FileDiagnostics into the SourceFile so the SourceFile has the content 2021-03-11 16:23:46 +01:00
Olivier Goffart
7c48bcdd4c Add the source file getter to the Spanned trait, and remove SpannedWithSourceFile 2021-03-11 14:09:55 +01:00
Simon Hausmann
246398fcb3 Issue a warning when accessing deprecated properties through member lookups 2021-02-02 22:42:02 +01:00
Simon Hausmann
e61529976e Issue warnings when creating bindings against deprecated properties 2021-02-02 22:42:02 +01:00
Olivier Goffart
5a21f1bd81 Rename emit_ to call_ for callback
Signal was renamed to Callback, but one does not emit a callback, one calls it
2021-01-25 15:59:10 +01:00
Simon Hausmann
f7ea2a9dce Forward focus() calls on items that have initial-focus defined
This also makes the focus() method available as a member function on any
item, but the resolve_element_reference_in_set_focus_calls() pass will
check if the elements are valid.

The check for `has-focus` to determine a focusable item was replaced
with an annotation on the built-in elements, so that `has-focus` can
later be implemented as a built-in function through the run-time,
without the need for a boolean property.
2021-01-20 14:31:01 +01:00
Simon Hausmann
6143d6c471 Minor cleanup
Turn the internal
 (crate::diagnostics::SourceFile, crate::diagnostics::Span)
tuple into a named SourceFile struct, for re-use later.
2021-01-20 12:07:37 +01:00
Olivier Goffart
7f78bea8b5 Fix a bunch of cargo clippy warnings in the compiler 2020-12-07 12:54:38 +01:00
Olivier Goffart
2d016dffda Print the diagnostics in stderr for files which do not have span information 2020-12-01 12:10:43 +01:00
Olivier Goffart
8b76114083 Recompile if a dependencies changes 2020-11-18 13:23:59 +01:00
Olivier Goffart
ba0ec058ab Make C++ build output more pretty
Avoid empty lines in stderr from the compiler, and make sure
the description from the compile line mention the output target
instead of not the source tomake it consistant with other outputs
2020-11-17 15:17:58 +01:00
Simon Hausmann
c805f9fca4 Add test coverage for errors generated during import processing
This covers all errors except for the one where File::read_to_string() fails.
2020-10-29 10:46:40 +01:00
Olivier Goffart
beb7eea0f2 Fix warning reporting
This actually cause a different compilation error and hides the real compilation error.
It was anyway not working because rustc does not show warning that comes from a macro
2020-10-14 12:33:23 +02:00
Olivier Goffart
ec24a02acf Fix warning
Span::is_valid is not used when not compiled with the
display-diagnostics feature is not used. Mark it as pub
2020-10-12 14:21:06 +02:00
Olivier Goffart
84f0fb7b07 Display a warning when no style is selected 2020-10-12 11:50:39 +02:00
Olivier Goffart
1f50e8c85e Highlight the error in the online editor 2020-10-06 11:33:44 +02:00
Simon Hausmann
41463cb14c Remove trailing whitespace 2020-09-04 21:36:32 +02:00
Simon Hausmann
d8e51dc03d Include warnings in the expected diagnostics of the syntax tests
Since some lines may produce multiple warnings/errors, the regex
supports now multiple carets, which indicates the number of lines to
walk back. This is a bit hacky, but it works :-)
2020-09-04 21:26:21 +02:00
Simon Hausmann
2a9c962b8d Exclude exposure of easing and duration typed properties
We decided that their type mapping is not ready for public API yet. For
example for duration we'd like to replace the opaque i64 with another
opaque type that however has convenient conversions to
std::time::Duration or std::chrono::milliseconds. We can't use either
directly because we need ffi compatibility, in order to create an
instance in C++ and pass it to the Rust run-time.

So this hides such properties and instead produces a warning.
2020-09-04 21:25:11 +02:00
Simon Hausmann
ff9c118e07 Propagate warnings to the end of the compilation step and print them 2020-09-04 20:34:20 +02:00
Simon Hausmann
ec36a50a25 Add support for warning diagnostics
They're emitted via codemap_diagnostics. For the Rust proc-macro we
generate a funny warning symbol until the proper APIs are stable.
2020-09-04 20:28:43 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
2d255380c7 Don't crash when trying to report internal errors 2020-08-04 15:01:42 +02:00
Olivier Goffart
f02512f467 Allow to get the span of a binding 2020-07-28 18:02:23 +02:00
Simon Hausmann
abe6888296 Collect proper per-file diagnostics in the compiler passes
When creating diagnostics in the passes, report them correctly in the
build diagnostics. There's no automated test yet, but it was manually
verified.
2020-07-21 15:27:41 +02:00
Simon Hausmann
26528a8e9c Keep track of the source file in the syntax tree
When going from the plain rowan::SyntaxNode tree to the syntax_nodes::*
elements, attach the source file and keep track of it from that point
on. That'll pave the way for proper multi-file diagnostics generated
later on from the passes, where we store syntax_nodes::* types.
2020-07-21 15:27:41 +02:00
Simon Hausmann
a5eb763c54 Eliminate another span() call site 2020-07-21 15:27:41 +02:00
Simon Hausmann
f8c0eb0bd6 Prepare for passing passing more information from syntax node to diagnostics
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +02:00
Simon Hausmann
31223c4b96 Store the path in the diagnostics as Rc
This string (path) will be shared a lot more often in the future.
2020-07-20 15:35:43 +02:00
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