added: test case for structure method tags
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 27 Jun 2023 16:49:14 +0000 (11:49 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 27 Jun 2023 16:49:14 +0000 (11:49 -0500)
tests/structure_method_tag [new file with mode: 0644]
tests/structure_method_tag.onyx [new file with mode: 0644]

diff --git a/tests/structure_method_tag b/tests/structure_method_tag
new file mode 100644 (file)
index 0000000..5661a26
--- /dev/null
@@ -0,0 +1,2 @@
+Some tag
+Called the method!
diff --git a/tests/structure_method_tag.onyx b/tests/structure_method_tag.onyx
new file mode 100644 (file)
index 0000000..e6ce607
--- /dev/null
@@ -0,0 +1,18 @@
+use core {*}
+use runtime
+
+Some_Structure :: struct {
+    @"Some tag"
+    some_method :: () {
+        println("Called the method!");
+    }
+}
+
+main :: () {
+    the_type   := Some_Structure;
+    the_method := *cast(&()->void, the_type->info()->as_struct().methods[0].func.data);
+    the_tag    := misc.any_as(runtime.info.get_tags_for_procedure(the_method)[0], str);
+    println(*the_tag);
+
+    the_method();
+}