镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,8 +2437,9 @@ def make_bin_override():

print_verbose(output)

# Dump as JSON to allow js2c.cc read it as a simple json file.
write('config.gypi', do_not_edit +
pprint.pformat(output, indent=2, width=128) + '\n')
json.dumps(output, indent=2) + '\n')

write('config.status', '#!/bin/sh\nset -x\nexec ./configure ' +
' '.join([shlex.quote(arg) for arg in original_argv]) + '\n')
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-process-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ let config = fs.readFileSync(configPath, 'utf8');

// Clean up comment at the first line.
config = config.split('\n').slice(1).join('\n');
config = config.replace(/"/g, '\\"');
config = config.replace(/'/g, '"');
// Turn pseudo-booleans strings into booleans.
config = JSON.parse(config, (key, value) => {
if (value === 'true') return true;
if (value === 'false') return false;
Expand Down
18 changes: 4 additions & 14 deletions tools/js2c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -796,21 +796,11 @@ std::vector<char> JSONify(const std::vector<char>& code) {
// 1. Remove string comments
std::vector<char> stripped = StripComments(code);

// 2. join multiline strings
std::vector<char> joined = JoinMultilineString(stripped);
// 2. turn pseudo-booleans strings into Booleans
std::vector<char> result1 = ReplaceAll(stripped, R"("true")", "true");
std::vector<char> result2 = ReplaceAll(result1, R"("false")", "false");

// 3. normalize string literals from ' into "
for (size_t i = 0; i < joined.size(); ++i) {
if (joined[i] == '\'') {
joined[i] = '"';
}
}

// 4. turn pseudo-booleans strings into Booleans
std::vector<char> result3 = ReplaceAll(joined, R"("true")", "true");
std::vector<char> result4 = ReplaceAll(result3, R"("false")", "false");

return result4;
return result2;
}

int AddGypi(const std::string& var,
Expand Down
Loading