Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update lib/kyuri/core.js #30

Merged
merged 2 commits into from

2 participants

@marco4net

fixed regression for case when no text is given

@marco4net marco4net Update lib/kyuri/core.js
fixed regression for case when no text is given
7acfe32
@indexzero
Owner

This is close, but wrong. You moved the line inside the if block, but moved it after the delete options.tabspace call so the value of options.tabspace will always be undefined when it is used.

@marco4net marco4net Update lib/kyuri/core.js
fixed premature deletion of tabspace option
1962ab5
@marco4net

Thanks for your review! It's corrected.

@indexzero indexzero merged commit dbf291d into from
@marco4net marco4net deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 7, 2012
  1. @marco4net

    Update lib/kyuri/core.js

    marco4net authored
    fixed regression for case when no text is given
Commits on Dec 19, 2012
  1. @marco4net

    Update lib/kyuri/core.js

    marco4net authored
    fixed premature deletion of tabspace option
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/kyuri/core.js
View
18 lib/kyuri/core.js
@@ -27,14 +27,18 @@ exports.compile = function (code, options) {
options.target = options.target || 'steps'
options.tabspace = options.tabspace || 8;
- // Convert groups of spaces to tabs
- code = code.replace(new RegExp(' {' + options.tabspace + '}', 'g'), '\t');
-
- // we don't need this anymore
- delete options.tabspace;
-
try {
- ast = isText ? parser.parse(lexer.tokenize(code)) : code;
+ if (isText) {
+ // Convert groups of spaces to tabs
+ code = code.replace(new RegExp(' {' + options.tabspace + '}', 'g'), '\t');
+ // we don't need this anymore
+ delete options.tabspace;
+
+ ast = parser.parse(lexer.tokenize(code));
+ } else {
+ ast = code;
+ }
+
var steps = new StepGenerator(ast).compile(options);
if (options.target === 'all') {
Something went wrong with that request. Please try again.