simplifying some unecessary interpolated expressions into interpolated values.

This commit is contained in:
Jeremy Ashkenas 2010-04-11 16:57:53 -04:00
parent c3bbb48041
commit 835ecac8db
10 changed files with 10 additions and 10 deletions

View File

@ -91,7 +91,7 @@
}
return _b;
})().join('') : '';
desc = task.description ? ("# " + (task.description)) : '';
desc = task.description ? ("# " + task.description) : '';
puts(("cake " + name + spaces + " " + desc));
}}
if (switches.length) {

View File

@ -34,7 +34,7 @@
return (parser.parse(lexer.tokenize(code))).compile(options);
} catch (err) {
if (options.source) {
err.message = ("In " + (options.source) + ", " + (err.message));
err.message = ("In " + options.source + ", " + err.message);
}
throw err;
}

View File

@ -226,7 +226,7 @@
};
// Print the `--version` message and exit.
version = function version() {
puts(("CoffeeScript version " + (CoffeeScript.VERSION)));
puts(("CoffeeScript version " + CoffeeScript.VERSION));
return process.exit(0);
};
})();

View File

@ -65,7 +65,7 @@
return _d;
})().join('') : '';
let_part = rule.short_flag ? rule.short_flag + ', ' : ' ';
lines.push((" " + let_part + (rule.long_flag) + spaces + (rule.description)));
lines.push((" " + let_part + rule.long_flag + spaces + rule.description));
}
return "\n" + (lines.join('\n')) + "\n";
};

View File

@ -120,7 +120,7 @@
_a = []; _b = this.variables;
for (key in _b) { if (__hasProp.call(_b, key)) {
val = _b[key];
val.assigned ? _a.push(("" + key + " = " + (val.value))) : null;
val.assigned ? _a.push(("" + key + " = " + val.value)) : null;
}}
return _a;
};

View File

@ -60,7 +60,7 @@ print_tasks: ->
for name, task of tasks
spaces: 20 - name.length
spaces: if spaces > 0 then (' ' for i in [0..spaces]).join('') else ''
desc: if task.description then "# ${task.description}" else ''
desc: if task.description then "# $task.description" else ''
puts "cake $name$spaces $desc"
puts oparse.help() if switches.length

View File

@ -34,7 +34,7 @@ exports.compile: compile: (code, options) ->
try
(parser.parse lexer.tokenize code).compile options
catch err
err.message: "In ${options.source}, ${err.message}" if options.source
err.message: "In $options.source, $err.message" if options.source
throw err
# Tokenize a string of CoffeeScript code, and return the array of tokens.

View File

@ -159,5 +159,5 @@ usage: ->
# Print the `--version` message and exit.
version: ->
puts "CoffeeScript version ${CoffeeScript.VERSION}"
puts "CoffeeScript version $CoffeeScript.VERSION"
process.exit 0

View File

@ -43,7 +43,7 @@ exports.OptionParser: class OptionParser
spaces: 15 - rule.long_flag.length
spaces: if spaces > 0 then (' ' for i in [0..spaces]).join('') else ''
let_part: if rule.short_flag then rule.short_flag + ', ' else ' '
lines.push " $let_part${rule.long_flag}$spaces${rule.description}"
lines.push " $let_part$rule.long_flag$spaces$rule.description"
"\n${ lines.join('\n') }\n"
# Helpers

View File

@ -80,7 +80,7 @@ exports.Scope: class Scope
# Return the list of assignments that are supposed to be made at the top
# of this scope.
assigned_variables: ->
"$key = ${val.value}" for key, val of @variables when val.assigned
"$key = $val.value" for key, val of @variables when val.assigned
# Compile the JavaScript for all of the variable declarations in this scope.
compiled_declarations: ->