From 049aac1b80143753b4b3449e529024bafe2250be Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 12 Jul 2022 22:45:05 -0700 Subject: Support `class` types. (#2321) * Support `class` types. * Ignore class-keyword test * Fix codereview comments and warnings. Co-authored-by: Yong He --- tests/cpu-program/class.slang | 23 +++++++++++++++++++++++ tests/cpu-program/class.slang.expected | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/cpu-program/class.slang create mode 100644 tests/cpu-program/class.slang.expected (limited to 'tests/cpu-program') diff --git a/tests/cpu-program/class.slang b/tests/cpu-program/class.slang new file mode 100644 index 000000000..1fc35aed0 --- /dev/null +++ b/tests/cpu-program/class.slang @@ -0,0 +1,23 @@ +//TEST:EXECUTABLE: +__target_intrinsic(cpp, "printf(\"%s\\n\", ($0).getBuffer())") +void writeln(String text); + +class MyClass +{ + int intMember; + __init() + { + intMember = 0; + } + int method() + { + writeln("method"); + return intMember; + } +} + +public __extern_cpp int main() +{ + MyClass obj = new MyClass(); + return obj.method(); +} \ No newline at end of file diff --git a/tests/cpu-program/class.slang.expected b/tests/cpu-program/class.slang.expected new file mode 100644 index 000000000..70274e060 --- /dev/null +++ b/tests/cpu-program/class.slang.expected @@ -0,0 +1,6 @@ +result code = 0 +standard error = { +} +standard output = { +method +} -- cgit v1.2.3