1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

fixing object/comment printing

This commit is contained in:
Jeremy Ashkenas 2010-02-13 00:24:26 -05:00
parent c9aeae757b
commit dc9cec2611
4 changed files with 6 additions and 6 deletions

View file

@ -558,7 +558,7 @@
// puts parser.generate()
posix = require('posix');
parser_path = 'lib/coffee_script/parser.js';
posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, 0755).addCallback(function(fd) {
posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback(function(fd) {
return posix.write(fd, js);
});
})();

View file

@ -661,10 +661,10 @@
prop = __e[i];
__d.push((function() {
join = ",\n";
if (prop === last_noncom || prop instanceof CommentNode) {
if ((prop === last_noncom) || (prop instanceof CommentNode)) {
join = "\n";
}
if (i === non_comments.length - 1) {
if (i === this.properties.length - 1) {
join = '';
}
indent = prop instanceof CommentNode ? '' : this.idt(1);

View file

@ -456,5 +456,5 @@ js: parser.generate()
# puts parser.generate()
posix: require 'posix'
parser_path: 'lib/coffee_script/parser.js'
posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, 0755).addCallback (fd) ->
posix.open(parser_path, process.O_CREAT | process.O_WRONLY | process.O_TRUNC, parseInt('0755', 8)).addCallback (fd) ->
posix.write(fd, js)

View file

@ -511,8 +511,8 @@ ObjectNode: exports.ObjectNode: inherit Node, {
last_noncom: non_comments[non_comments.length - 1]
props: for prop, i in @properties
join: ",\n"
join: "\n" if prop is last_noncom or prop instanceof CommentNode
join: '' if i is non_comments.length - 1
join: "\n" if (prop is last_noncom) or (prop instanceof CommentNode)
join: '' if i is @properties.length - 1
indent: if prop instanceof CommentNode then '' else @idt(1)
indent + prop.compile(o) + join
props: props.join('')