Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix #2846 #2890

Merged
merged 1 commit into from

3 participants

@vendethiel
Collaborator

(I know I can commit to master, but since I've been appointed to issues, I'll avoid it for now)*

#2846

@vendethiel vendethiel commented on the diff
lib/coffee-script/browser.js
@@ -25,6 +25,7 @@
options = {};
}
options.bare = true;
+ options.shiftLine = true;
@vendethiel Collaborator

this is because the files were not rebuilt in the PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@epidemian

Haha... that change was bugging me when working on other PRs. I didn't want to commit it because it had nothing to do with them =P. I think there was also a change in coffee-script.js that appeared when compiling the latest master; though it may have already been merged.

@michaelficarra
Collaborator

Beautiful. Thanks, @Nami-Doc.

@michaelficarra michaelficarra merged commit cc84d6e into from
@michaelficarra
Collaborator

Also, it's good practice to get at least one other set of eyes on your code except for the most trivial of changes. So thanks for opening a PR.

@vendethiel vendethiel deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 25, 2013
  1. @vendethiel

    fix #2846

    vendethiel authored
This page is out of date. Refresh to see the latest.
View
5 lib/coffee-script/browser.js
@@ -25,6 +25,7 @@
options = {};
}
options.bare = true;
+ options.shiftLine = true;
@vendethiel Collaborator

this is because the files were not rebuilt in the PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
return Function(compile(code, options))();
};
@@ -32,7 +33,7 @@
return;
}
- if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null)) {
+ if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) {
compile = function(code, options) {
var js, v3SourceMap, _ref;
if (options == null) {
@@ -41,7 +42,7 @@
options.sourceMap = true;
options.inline = true;
_ref = CoffeeScript.compile(code, options), js = _ref.js, v3SourceMap = _ref.v3SourceMap;
- return "" + js + "\n//@ sourceMappingURL=data:application/json;base64," + (btoa(v3SourceMap)) + "\n//@ sourceURL=coffeescript";
+ return "" + js + "\n//@ sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//@ sourceURL=coffeescript";
};
}
View
5 lib/coffee-script/coffee-script.js
@@ -34,7 +34,10 @@
}
fragments = (parser.parse(lexer.tokenize(code, options))).compileToFragments(options);
currentLine = 0;
- if (options.header || options.inline) {
+ if (options.header) {
+ currentLine += 1;
+ }
+ if (options.shiftLine) {
currentLine += 1;
}
currentColumn = 0;
View
2  lib/coffee-script/nodes.js
@@ -2125,7 +2125,7 @@
set = '';
body = this.body;
if (body.isEmpty()) {
- body = '';
+ body = this.makeCode('');
} else {
if (this.returns) {
body.makeReturn(rvar = o.scope.freeVariable('results'));
View
2  src/nodes.coffee
@@ -1504,7 +1504,7 @@ exports.While = class While extends Base
set = ''
{body} = this
if body.isEmpty()
- body = ''
+ body = @makeCode ''
else
if @returns
body.makeReturn rvar = o.scope.freeVariable 'results'
View
3  test/compilation.coffee
@@ -76,3 +76,6 @@ test "#1055: invalid keys in real (but not work-product) objects", ->
test "#1066: interpolated strings are not implicit functions", ->
cantCompile '"int#{er}polated" arg'
+
+test "#2846: while with empty body", ->
+ CoffeeScript.compile 'while 1 then', {sourceMap: true}
Something went wrong with that request. Please try again.