diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-03-08 13:39:40 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-03-08 13:39:40 +0000 |
| commit | 8cfdfc92fcf41f5db6d30015b20457ca64f0c3ce (patch) | |
| tree | 7dfd0d403b6b8add040eb1e09515194ca6b26065 /examples | |
| parent | 2462a913d149fe896134519d95d65c3adfa30e47 (diff) | |
Support method calls from other namespaces (without Wasm support)
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/40-imported-struct-methods/shed-examples.json5 | 9 | ||||
| -rw-r--r-- | examples/40-imported-struct-methods/shed.json5 (renamed from examples/40-struct-method-references/shed.json5) | 0 | ||||
| -rw-r--r-- | examples/40-imported-struct-methods/src/Counting.shed | 11 | ||||
| -rw-r--r-- | examples/40-imported-struct-methods/src/HelloWorld.shed | 7 | ||||
| -rw-r--r-- | examples/41-struct-method-references/shed-examples.json5 (renamed from examples/40-struct-method-references/shed-examples.json5) | 0 | ||||
| -rw-r--r-- | examples/41-struct-method-references/shed.json5 (renamed from examples/41-generic-struct-methods/shed.json5) | 0 | ||||
| -rw-r--r-- | examples/41-struct-method-references/src/HelloWorld.shed (renamed from examples/40-struct-method-references/src/HelloWorld.shed) | 0 | ||||
| -rw-r--r-- | examples/42-generic-struct-methods/shed-examples.json5 (renamed from examples/41-generic-struct-methods/shed-examples.json5) | 0 | ||||
| -rw-r--r-- | examples/42-generic-struct-methods/shed.json5 (renamed from examples/42-generic-struct-methods-this/shed.json5) | 0 | ||||
| -rw-r--r-- | examples/42-generic-struct-methods/src/HelloWorld.shed (renamed from examples/41-generic-struct-methods/src/HelloWorld.shed) | 0 | ||||
| -rw-r--r-- | examples/43-generic-struct-methods-this/shed-examples.json5 (renamed from examples/42-generic-struct-methods-this/shed-examples.json5) | 0 | ||||
| -rw-r--r-- | examples/43-generic-struct-methods-this/shed.json5 | 8 | ||||
| -rw-r--r-- | examples/43-generic-struct-methods-this/src/HelloWorld.shed (renamed from examples/42-generic-struct-methods-this/src/HelloWorld.shed) | 0 | ||||
| -rw-r--r-- | examples/44-native-code/shed-examples.json5 (renamed from examples/43-native-code/shed-examples.json5) | 0 | ||||
| -rw-r--r-- | examples/44-native-code/shed.json5 (renamed from examples/43-native-code/shed.json5) | 0 | ||||
| -rw-r--r-- | examples/44-native-code/src/False.shed (renamed from examples/43-native-code/src/False.shed) | 0 |
16 files changed, 35 insertions, 0 deletions
diff --git a/examples/40-imported-struct-methods/shed-examples.json5 b/examples/40-imported-struct-methods/shed-examples.json5 new file mode 100644 index 00000000..95fb0a97 --- /dev/null +++ b/examples/40-imported-struct-methods/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "one\ntwo\nmany", + }, + ], +} diff --git a/examples/40-struct-method-references/shed.json5 b/examples/40-imported-struct-methods/shed.json5 index a6c8e563..a6c8e563 100644 --- a/examples/40-struct-method-references/shed.json5 +++ b/examples/40-imported-struct-methods/shed.json5 diff --git a/examples/40-imported-struct-methods/src/Counting.shed b/examples/40-imported-struct-methods/src/Counting.shed new file mode 100644 index 00000000..ac97df14 --- /dev/null +++ b/examples/40-imported-struct-methods/src/Counting.shed @@ -0,0 +1,11 @@ +pub struct Count(value: Int) { + fun message(this) -> String { + if (this.value == 1) { + "one\n" + } else if (this.value == 2) { + "two\n" + } else { + "many\n" + } + } +} diff --git a/examples/40-imported-struct-methods/src/HelloWorld.shed b/examples/40-imported-struct-methods/src/HelloWorld.shed new file mode 100644 index 00000000..6d9de22c --- /dev/null +++ b/examples/40-imported-struct-methods/src/HelloWorld.shed @@ -0,0 +1,7 @@ +import Counting; + +pub fun main() ! Io -> Unit { + print!(Counting.Count(1).message()); + print!(Counting.Count(2).message()); + print!(Counting.Count(3).message()); +} diff --git a/examples/40-struct-method-references/shed-examples.json5 b/examples/41-struct-method-references/shed-examples.json5 index a57c4749..a57c4749 100644 --- a/examples/40-struct-method-references/shed-examples.json5 +++ b/examples/41-struct-method-references/shed-examples.json5 diff --git a/examples/41-generic-struct-methods/shed.json5 b/examples/41-struct-method-references/shed.json5 index a6c8e563..a6c8e563 100644 --- a/examples/41-generic-struct-methods/shed.json5 +++ b/examples/41-struct-method-references/shed.json5 diff --git a/examples/40-struct-method-references/src/HelloWorld.shed b/examples/41-struct-method-references/src/HelloWorld.shed index 5bfd3631..5bfd3631 100644 --- a/examples/40-struct-method-references/src/HelloWorld.shed +++ b/examples/41-struct-method-references/src/HelloWorld.shed diff --git a/examples/41-generic-struct-methods/shed-examples.json5 b/examples/42-generic-struct-methods/shed-examples.json5 index 531c665f..531c665f 100644 --- a/examples/41-generic-struct-methods/shed-examples.json5 +++ b/examples/42-generic-struct-methods/shed-examples.json5 diff --git a/examples/42-generic-struct-methods-this/shed.json5 b/examples/42-generic-struct-methods/shed.json5 index a6c8e563..a6c8e563 100644 --- a/examples/42-generic-struct-methods-this/shed.json5 +++ b/examples/42-generic-struct-methods/shed.json5 diff --git a/examples/41-generic-struct-methods/src/HelloWorld.shed b/examples/42-generic-struct-methods/src/HelloWorld.shed index a4e808e1..a4e808e1 100644 --- a/examples/41-generic-struct-methods/src/HelloWorld.shed +++ b/examples/42-generic-struct-methods/src/HelloWorld.shed diff --git a/examples/42-generic-struct-methods-this/shed-examples.json5 b/examples/43-generic-struct-methods-this/shed-examples.json5 index 531c665f..531c665f 100644 --- a/examples/42-generic-struct-methods-this/shed-examples.json5 +++ b/examples/43-generic-struct-methods-this/shed-examples.json5 diff --git a/examples/43-generic-struct-methods-this/shed.json5 b/examples/43-generic-struct-methods-this/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/43-generic-struct-methods-this/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/42-generic-struct-methods-this/src/HelloWorld.shed b/examples/43-generic-struct-methods-this/src/HelloWorld.shed index b114d85a..b114d85a 100644 --- a/examples/42-generic-struct-methods-this/src/HelloWorld.shed +++ b/examples/43-generic-struct-methods-this/src/HelloWorld.shed diff --git a/examples/43-native-code/shed-examples.json5 b/examples/44-native-code/shed-examples.json5 index 1b45c0b5..1b45c0b5 100644 --- a/examples/43-native-code/shed-examples.json5 +++ b/examples/44-native-code/shed-examples.json5 diff --git a/examples/43-native-code/shed.json5 b/examples/44-native-code/shed.json5 index b07dcaed..b07dcaed 100644 --- a/examples/43-native-code/shed.json5 +++ b/examples/44-native-code/shed.json5 diff --git a/examples/43-native-code/src/False.shed b/examples/44-native-code/src/False.shed index 75dc7a89..75dc7a89 100644 --- a/examples/43-native-code/src/False.shed +++ b/examples/44-native-code/src/False.shed |
