Skip to content

Commit

Permalink
fixes jashkenas#2349: inclusive slicing to numeric strings
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed May 20, 2012
1 parent f938a21 commit b814981
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/coffee-script/lexer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/coffee-script/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/coffee-script/rewriter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/nodes.coffee
Expand Up @@ -787,7 +787,7 @@ exports.Slice = class Slice extends Base
"#{+compiled + 1}"
else
compiled = to.compile o, LEVEL_ACCESS
"#{compiled} + 1 || 9e9"
"+#{compiled}+1 || 9e9"
".slice(#{ fromStr }#{ toStr or '' })"

#### Obj
Expand Down
3 changes: 3 additions & 0 deletions test/slicing_and_splicing.coffee
Expand Up @@ -61,6 +61,9 @@ test "#1722: operator precedence in unbounded slice compilation", ->
arrayEq [0..n], list[..n or 0]
arrayEq [0..n], list[..if n then n else 0]

test "#2349: slicing to numeric strings", ->
arrayEq [0, 1], [0..10][.."1"]


# Splicing

Expand Down

0 comments on commit b814981

Please sign in to comment.