Skip to content

Commit

Permalink
fixed if else indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sauppb committed Aug 2, 2023
1 parent 946735c commit 710e677
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tree2text.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export const tree2text = (blockjson, startIndex, indentation) => {
blockjson.endIndex = startIndex + 2;
var result = '\t'.repeat(indentation) + "if (" ;
var condition = tree2text(blockjson.condition, startIndex + result.length, indentation) + ")\n" ;
var contents = '\t'.repeat(indentation) + tree2text(blockjson.statement, startIndex + result.length + condition.length, indentation + 1)
var contents = tree2text(blockjson.statement, startIndex + result.length + condition.length, indentation + 1)
+ '\t'.repeat(indentation) +'end if\n';
blockjson.end = startIndex + result.length + condition.length + contents.length;
return result + condition + contents;
Expand All @@ -269,7 +269,7 @@ export const tree2text = (blockjson, startIndex, indentation) => {
blockjson.endIndex = startIndex + 2;
var result = '\t'.repeat(indentation) + "if (" ;
var condition = tree2text(blockjson.condition, startIndex + result.length, indentation) + ")\n" ;
var contents = '\t'.repeat(indentation) + tree2text(blockjson.statement, startIndex + result.length + condition.length, indentation + 1);
var contents = tree2text(blockjson.statement, startIndex + result.length + condition.length, indentation + 1);
var alternative = '\t'.repeat(indentation) +'\else\n'
+ '\t'.repeat(indentation) + tree2text(blockjson.alternative, startIndex + result.length + condition.length + contents.length, indentation + 1)
+ '\t'.repeat(indentation) +'end if\n';
Expand Down

0 comments on commit 710e677

Please sign in to comment.