From 9e86e23b430ad1bdab245b1e63c35b7a1ea73e03 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 5 Jul 2020 19:19:24 +0100 Subject: Apply previous fixes for classes to structs too --- slicer/test/preprocessor.cpp | 4 ++-- slicer/test/serializers.cpp | 3 ++- slicer/test/structs.ice | 1 + slicer/tool/parser.cpp | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp index eddeb31..2513f99 100644 --- a/slicer/test/preprocessor.cpp +++ b/slicer/test/preprocessor.cpp @@ -12,7 +12,7 @@ using ComponentsCount = std::map; ComponentsCount COMPONENTS_IN_TEST_ICE = {{"classtype.ice", 2}, {"classes.ice", 3}, {"collections.ice", 5}, {"enums.ice", 2}, {"inheritance.ice", 12}, {"interfaces.ice", 0}, {"json.ice", 2}, {"locals.ice", 7}, - {"optionals.ice", 2}, {"structs.ice", 4}, {"types.ice", 3}, {"xml.ice", 5}}; + {"optionals.ice", 2}, {"structs.ice", 5}, {"types.ice", 3}, {"xml.ice", 5}}; unsigned int total() @@ -21,7 +21,7 @@ total() COMPONENTS_IN_TEST_ICE.begin(), COMPONENTS_IN_TEST_ICE.end(), 0U, [](auto & t, auto && c) { return t += c.second; }); - BOOST_CHECK_EQUAL(47, t); + BOOST_CHECK_EQUAL(48, t); return t; } diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index c8f8390..53c6965 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -694,5 +694,6 @@ BOOST_AUTO_TEST_CASE(enum_lookups) BOOST_AUTO_TEST_CASE(sequence_element_in_same_slice_link_bug) { // Link error when sequence element type defined in same slice. - Slicer::ModelPartForSequence mp(nullptr); + Slicer::ModelPartForSequence mpClasses(nullptr); + Slicer::ModelPartForSequence mpDates(nullptr); } diff --git a/slicer/test/structs.ice b/slicer/test/structs.ice index fcd17fe..8edb585 100644 --- a/slicer/test/structs.ice +++ b/slicer/test/structs.ice @@ -29,6 +29,7 @@ module TestModule { StructType str; int simp; }; + sequence Dates; }; #endif diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index d2288ae..3d0505a 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -31,6 +31,13 @@ namespace Slicer { return false; }; + bool + visitStructStart(const Slice::StructPtr & s) override + { + fprintbf(cpp, "struct ICE_CLASS(JAM_DLL_PUBLIC) %s;\n", s->name()); + return false; + }; + void visitModuleEnd(const Slice::ModulePtr & m) override { -- cgit v1.2.3