Commit 293f7a34 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[torque-ls] Fix sort-order of torque files for compilation

This CL moves frames.tq and arguments.tq to the front of the file
list when compiling Torque files.

Note that order independent compilation will most likely be
implemented in the near future, at which point this code becomes
obsolete.

R=tebbi@chromium.org

Bug: v8:8880
Change-Id: I7e32637925c28202f9b017a568bc06ae5bd595b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1561210Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60746}
parent b6e65be9
...@@ -126,24 +126,23 @@ void HandleTorqueFileListNotification(TorqueFileListNotification notification) { ...@@ -126,24 +126,23 @@ void HandleTorqueFileListNotification(TorqueFileListNotification notification) {
// We only consider file URIs (there shouldn't be anything else). // We only consider file URIs (there shouldn't be anything else).
// Internally we store the URI instead of the path, eliminating the need // Internally we store the URI instead of the path, eliminating the need
// to encode it again. // to encode it again.
if (auto maybe_path = FileUriDecode(file_json.ToString())) { files.push_back(file_json.ToString());
files.push_back(file_json.ToString()); Logger::Log(" ", file_json.ToString(), "\n");
Logger::Log(" ", *maybe_path, "\n");
}
} }
// The Torque compiler expects to see some files first, // The Torque compiler expects to see some files first,
// we need to order them in the correct way. // we need to order them in the correct way.
std::sort(files.begin(), files.end(), // TODO(szuend): Remove this, once the compiler doesn't require the input
[](const std::string& a, const std::string& b) { // files to be in a specific order.
if (a.find("base.tq") != std::string::npos) return true; std::vector<std::string> sort_to_front = {"base.tq", "frames.tq",
if (b.find("base.tq") != std::string::npos) return false; "arguments.tq", "array.tq"};
std::sort(files.begin(), files.end(), [&](std::string a, std::string b) {
if (a.find("array.tq") != std::string::npos) return true; for (const std::string& fixed_file : sort_to_front) {
if (b.find("array.tq") != std::string::npos) return false; if (a.find(fixed_file) != std::string::npos) return true;
if (b.find(fixed_file) != std::string::npos) return false;
return false; }
}); return a < b;
});
RecompileTorque(); RecompileTorque();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment