Skip to content

Commit

Permalink
Fix #197
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime committed Jun 23, 2016
1 parent adf169b commit bac3d43
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/formatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,16 +990,16 @@ class EnforceStringStyle : public Pass {
if (c == '\'') num_single++;
if (c == '"') num_double++;
}
if (num_single > 0 && num_double > 0) return;
char style = opts.stringStyle == 's';
if (num_single > 0 && num_double > 0) return; // Don't change it.
bool use_single = opts.stringStyle == 's';
if (num_single > 0)
style = 'd';
use_single = false;
if (num_double > 0)
style = 's';
use_single = true;

// Change it
lit->value = jsonnet_string_escape(canonical, style == 's');
lit->tokenKind = style ? LiteralString::SINGLE : LiteralString::DOUBLE;
// Change it.
lit->value = jsonnet_string_escape(canonical, use_single);
lit->tokenKind = use_single ? LiteralString::SINGLE : LiteralString::DOUBLE;
}
};

Expand Down

0 comments on commit bac3d43

Please sign in to comment.