Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1014 from maheeka/master
Browse files Browse the repository at this point in the history
fix right hand trim issue in variable definition when value contains …
  • Loading branch information
sumuditha-viraj authored Feb 20, 2017
2 parents cff55cb + fe5a8dd commit 219ba46
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/web/js/ballerina/ast/variable-definition-statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ define(['lodash', './statement', '../utils/common-utils', './variable-declaratio
* @param {string} variableDefinitionStatementString - variable definition expression string
*/
VariableDefinitionStatement.prototype.setStatementString = function (variableDefinitionStatementString) {
var tokens = variableDefinitionStatementString.split("=");
this.setLeftExpression(!_.isNil(tokens[0]) ? tokens[0].trim() : "");
this.setRightExpression(!_.isNil(tokens[1]) ? tokens[1].trim() : "");
var equalIndex = _.indexOf(variableDefinitionStatementString, '=');
var leftOperand = variableDefinitionStatementString.substring(0, equalIndex);
var rightOperand = variableDefinitionStatementString.substring(equalIndex + 1);
this.setLeftExpression(!_.isNil(leftOperand) ? leftOperand.trim() : "");
this.setRightExpression(!_.isNil(rightOperand) ? rightOperand.trim() : "");
};

/**
Expand Down

0 comments on commit 219ba46

Please sign in to comment.