Merge pull request #232 from gkotian/master

Minor Fixes
This commit is contained in:
Brian Schott 2016-02-27 15:40:03 -08:00
commit 1a80fd742a
1 changed files with 8 additions and 5 deletions

View File

@ -73,10 +73,13 @@ struct TokenFormatter(OutputRange)
{ {
/** /**
* Params: * Params:
* rawSource = ?
* tokens = the tokens to format * tokens = the tokens to format
* depths = ?
* output = the output range that the code will be formatted to * output = the output range that the code will be formatted to
* astInformation = information about the AST used to inform formatting * astInformation = information about the AST used to inform formatting
* decisions. * decisions.
* config = ?
*/ */
this(const ubyte[] rawSource, const(Token)[] tokens, immutable short[] depths, this(const ubyte[] rawSource, const(Token)[] tokens, immutable short[] depths,
OutputRange output, ASTInformation* astInformation, Config* config) OutputRange output, ASTInformation* astInformation, Config* config)
@ -89,7 +92,7 @@ struct TokenFormatter(OutputRange)
this.config = config; this.config = config;
} }
/// Runs the foramtting process /// Runs the formatting process
void format() void format()
{ {
while (index < tokens.length) while (index < tokens.length)
@ -122,7 +125,7 @@ private:
/// Information about the AST /// Information about the AST
const ASTInformation* astInformation; const ASTInformation* astInformation;
/// token indicies where line breaks should be placed /// Token indices where line breaks should be placed
size_t[] linebreakHints; size_t[] linebreakHints;
/// Current indentation stack for the file /// Current indentation stack for the file
@ -210,7 +213,7 @@ private:
|| currentIs(tok!"debug")) && peekIs(tok!"(", false)) || currentIs(tok!"debug")) && peekIs(tok!"(", false))
{ {
if (!assumeSorted(astInformation.constraintLocations).equalRange(current.index).empty) if (!assumeSorted(astInformation.constraintLocations).equalRange(current.index).empty)
formatConstrtaint(); formatConstraint();
else else
formatBlockHeader(); formatBlockHeader();
} }
@ -277,7 +280,7 @@ private:
writeToken(); writeToken();
} }
void formatConstrtaint() void formatConstraint()
{ {
with (TemplateConstraintStyle) final switch (config.dfmt_template_constraint_style) with (TemplateConstraintStyle) final switch (config.dfmt_template_constraint_style)
{ {
@ -311,7 +314,7 @@ private:
// if // if
writeToken(); writeToken();
// assume that the parens are present, otherwise the parser would not // assume that the parens are present, otherwise the parser would not
// have told is there was a constraint here // have told us there was a constraint here
write(" "); write(" ");
writeParens(false); writeParens(false);
} }