sample-code: Add example "module-hell.cl" demonstrating inter-module imports and path resolution
This commit is contained in:
parent
9566f098ac
commit
71745161c4
17
sample-code/module_hell.cl
Normal file
17
sample-code/module_hell.cl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//! Demonstrates modules
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
use foo::bar::baz; // -> use super::baz::qux as baz: 10 -> fn baz::qux: 12
|
||||||
|
baz()
|
||||||
|
}
|
||||||
|
|
||||||
|
mod foo {
|
||||||
|
mod bar {
|
||||||
|
use super::baz::qux as baz; // -> fn qux: 14
|
||||||
|
}
|
||||||
|
mod baz {
|
||||||
|
fn qux() {
|
||||||
|
print("foo, bar, baz, qux")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user