Prohibit the use of --newlinesoff with targets that do not support putting a whole script on one line
This commit is contained in:
parent
96bd6bf708
commit
26421597f2
|
@ -15,6 +15,7 @@ class Target {
|
|||
constexpr static const char* const interpolationString = "${";
|
||||
constexpr static const char* const interpolationCloseString = "}";
|
||||
protected:
|
||||
virtual constexpr bool supportsOneLine() { return true; };
|
||||
std::stringstream output;
|
||||
INCLUDECOMPONENT(StandardComponents::Define);
|
||||
INCLUDECOMPONENT(StandardComponents::types::String);
|
||||
|
@ -102,7 +103,7 @@ shared_ptr<Target> Target::forName(string_view name, const bool newLines = true)
|
|||
}
|
||||
}
|
||||
shared_ptr<Target> target;
|
||||
#define ADDTARGET(X) target = shared_ptr<X>(new X(newLines));
|
||||
#define ADDTARGET(X) target = shared_ptr<X>(new X(newLines))
|
||||
switch (selected) {
|
||||
#ifdef LUA_HPP
|
||||
case LUA: ADDTARGET(LUA_HPP); break;
|
||||
|
@ -123,6 +124,10 @@ shared_ptr<Target> Target::forName(string_view name, const bool newLines = true)
|
|||
}
|
||||
}
|
||||
#undef ADDTARGET
|
||||
if (not newLines and not target->supportsOneLine()) {
|
||||
cout << "--newlinesoff cannot be used with --target=" << name.substr(1) << endl;
|
||||
exit(0);
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define PY_HPP PyTarget
|
||||
|
||||
struct PyTarget: Target {
|
||||
bool supportsOneLine() final { return false; }
|
||||
void on(const StandardComponents::Define &parseComponent) override {
|
||||
output << parseComponent.name << " = ";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue