From 9eee1175d9c3089ba53ebed12171bf57a40e80e3 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 27 Jun 2017 14:22:01 -0700 Subject: Allow "dotted" import paths The code: __import foo.bar; will try to import from a file matching "foo/bar.slang". I also went ahead and allowed a raw string literal in and import: __import "foo/bar"; (In the latter case, an explicit `/` must be used instead of `.`) --- tests/front-end/import-subdir.slang | 7 +++++++ tests/front-end/subdir/import-subdir-a.slang | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 tests/front-end/import-subdir.slang create mode 100644 tests/front-end/subdir/import-subdir-a.slang (limited to 'tests') diff --git a/tests/front-end/import-subdir.slang b/tests/front-end/import-subdir.slang new file mode 100644 index 000000000..0d3931a82 --- /dev/null +++ b/tests/front-end/import-subdir.slang @@ -0,0 +1,7 @@ +//TEST:SIMPLE: + +// Confirming that we can use "dot notation" to import via a subdirectory + +__import subdir.import_subdir_a; + +float bar(float x) { return foo(x); } \ No newline at end of file diff --git a/tests/front-end/subdir/import-subdir-a.slang b/tests/front-end/subdir/import-subdir-a.slang new file mode 100644 index 000000000..3962d4662 --- /dev/null +++ b/tests/front-end/subdir/import-subdir-a.slang @@ -0,0 +1,5 @@ +//TEST_IGNORE_FILE: + +// This is the imported code. + +float foo(float x) { return x; } \ No newline at end of file -- cgit v1.2.3