Commit graph

11 commits

Author SHA1 Message Date
Olivier Goffart
d7d9badc93 Fix panic when using some value from an invalid component in a imported file 2021-05-07 18:28:23 +02:00
Olivier Goffart
1e730eb845 Fix panic when parsing wrong import statement
Have to be several tests because the parser bails out at the first error.
The error message is not optimal but better than a panic
2021-04-14 12:47:26 +02:00
Simon Hausmann
aa599e5a98 Fix missing license header 2021-04-14 10:02:22 +02:00
Simon Hausmann
c301cc22b5 Collect foreign imports and filter out true type fonts/collections
Resolve them early enough to produce good diagnostics. Permit true type
fonts & collections.
2021-04-14 09:17:23 +02:00
Simon Hausmann
cbf2b51670 Allow empty imports
Allow import "blah.60" or, more likely in the future, import "foo.ttf".
2021-04-14 09:01:49 +02:00
Olivier Goffart
c3ab89dd3e Refactor import opening and its hook
This way the hook is called regardless if the file exist in the import path or not
2021-04-06 12:27:59 +02:00
Olivier Goffart
decbe0ade5 Fix panic when exporting invalid types
And also still allow to export builtin component
2020-11-02 17:18:42 +01:00
Olivier Goffart
2d55b2a51a Don't load document twice if they are imported twice
Also protect against cyclic imports
2020-10-30 10:14:27 +01:00
Simon Hausmann
ed714bd332 Fix type leak across imports
Given the test case

    import { SomeType } from "somewhere.60";
    import { Blah } from "foo.60";

and foo.60 trying to use "SomeType":

    export Blah := SomeType {}

then the lookup for "SomeType" in foo.60 should fail. Instead it leaked
through the populated type registry when processing the dependencies for
the outer file.

This is fixed by ensuring that the type registry for a file only has the
global type registry as parent. To ensure that the test reliably covers
this, the import dependencies are now processed in declaration order
(hence the switch to IndexMap that preserves insertion order).
2020-10-29 12:55:00 +01:00
Simon Hausmann
7eb3d48f42 Prospective fix for test failure on Windows
Remove the leading path separator as that differs between Unix and Windows.
2020-10-29 10:57:54 +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