From 668a3838e26b4e21a8635bd4ea39c3f7da96e2c8 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 26 Feb 2019 00:13:38 +0100 Subject: Generate imports for types defined in separate Swift modules --- cpp/src/Slice/Parser.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'cpp/src/Slice/Parser.cpp') diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index e49c20f1c50..52004688edf 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -19,6 +19,52 @@ using namespace std; using namespace Slice; + +Slice::CompilerException::CompilerException(const char* file, int line, const string& r) : + IceUtil::Exception(file, line), + _reason(r) +{ +} + +#ifndef ICE_CPP11_COMPILER +Slice::CompilerException::~CompilerException() throw() +{ +} +#endif + +string +Slice::CompilerException::ice_id() const +{ + return "::Slice::CompilerException"; +} + +void +Slice::CompilerException::ice_print(ostream& out) const +{ + IceUtil::Exception::ice_print(out); + out << ": " << _reason; +} + +#ifndef ICE_CPP11_MAPPING +Slice::CompilerException* +Slice::CompilerException::ice_clone() const +{ + return new CompilerException(*this); +} +#endif + +void +Slice::CompilerException::ice_throw() const +{ + throw *this; +} + +string +Slice::CompilerException::reason() const +{ + return _reason; +} + extern FILE* slice_in; extern int slice_debug; @@ -227,6 +273,20 @@ Slice::DefinitionContext::warning(WarningCategory category, const string& file, } } +void +Slice::DefinitionContext::error(const string& file, int line, const string& msg) const +{ + emitError(file, line, msg); + throw CompilerException(__FILE__, __LINE__, msg); +} + +void +Slice::DefinitionContext::error(const string& file, const string& line, const string& msg) const +{ + emitError(file, line, msg); + throw CompilerException(__FILE__, __LINE__, msg); +} + bool Slice::DefinitionContext::suppressWarning(WarningCategory category) const { -- cgit v1.2.3