Skip to content

Commit b7485cd

Browse files
author
Samat Gaynutdinov
committed
refactor: better name & move func up hierarchy
1 parent f8e9bb6 commit b7485cd

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

server/src/printers/DefaultMakefilePrinter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ void DefaultMakefilePrinter::declareVariableIfNotDefined(std::string const &vari
2424
ss << "endif\n";
2525
}
2626

27+
void DefaultMakefilePrinter::declareVariableWithPriority(std::string const &variableName,
28+
std::string const &variablePath) {
29+
ss << stringFormat("ifneq (\"$(wildcard %s)\",\"\")\n", variablePath);
30+
ss << TAB;
31+
declareVariable(variableName, variablePath);
32+
ss << "endif\n";
33+
}
34+
2735
void DefaultMakefilePrinter::declareAction(const std::string &name) {
2836
ss << name << "\n";
2937
}

server/src/printers/DefaultMakefilePrinter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class DefaultMakefilePrinter : public Printer {
2121

2222
void declareVariableIfNotDefined(std::string const &variableName, std::string const &ifNotDefinedValue);
2323

24+
void declareVariableWithPriority(std::string const &variableName, std::string const &variablePath);
25+
2426
template<class ContainerD = std::initializer_list<std::string>,
2527
class ContainerA = std::initializer_list<std::string>>
2628
void declareTarget(std::string const &name,

server/src/printers/NativeMakefilePrinter.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -716,23 +716,15 @@ namespace printer {
716716
}
717717

718718
void NativeMakefilePrinter::declareShellVariable(const std::string& variableName, fs::path path,
719-
std::function<void(const std::string&, const std::string&)> declareFunc,
719+
std::function<void(const std::string&, const std::string&)> shellVariableDeclarationFunction,
720720
bool shouldWriteToMap, bool isCanonical) {
721721
const fs::path relativePath = getRelativePath(path, isCanonical);
722722
if (isCanonical) {
723723
path = fs::weakly_canonical(path);
724724
}
725-
declareFunc(variableName, relativePath.string());
725+
shellVariableDeclarationFunction(variableName, relativePath.string());
726726
if (shouldWriteToMap) {
727727
pathToShellVariable[path] = StringUtils::stringFormat("$(%s)", variableName);
728728
}
729729
}
730-
731-
void NativeMakefilePrinter::declareVariableWithPriority(std::string const &variableName,
732-
std::string const &variablePath) {
733-
ss << stringFormat("ifneq (\"$(wildcard %s)\",\"\")\n", variablePath);
734-
ss << TAB;
735-
declareVariable(variableName, variablePath);
736-
ss << "endif\n";
737-
}
738730
}

server/src/printers/NativeMakefilePrinter.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,9 @@ namespace printer {
7070
bool transformExeToLib);
7171

7272
void declareShellVariable(const std::string& variableName, fs::path path,
73-
std::function<void(const std::string&, const std::string&)> declareFunc,
73+
std::function<void(const std::string&, const std::string&)> shellVariableDeclarationFunction,
7474
bool shouldWriteToMap = true, bool isCanonical = true);
7575

76-
void declareVariableWithPriority(std::string const &variableName,
77-
std::string const &variablePath);
78-
7976
fs::path getRelativePath(fs::path source, bool isCanonical) const;
8077

8178
public:

0 commit comments

Comments
 (0)