Skip to content

Commit

Permalink
Simplify using multi variable assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Sep 14, 2019
1 parent 2f319f4 commit 9e45f22
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ class VariableDeclaration {
*/
VariableDeclaration(Assignation assignation) {

def declaration = assignation.stringRepresentation
def equalsIndex = declaration.indexOf('=')

name = declaration.substring(0, equalsIndex)
value = declaration.substring(equalsIndex + 1)
(name, value) = assignation.stringRepresentation.split('=')
}

/**
Expand Down

2 comments on commit 9e45f22

@zhanhb
Copy link
Contributor

@zhanhb zhanhb commented on 9e45f22 Dec 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the value contain an equal sign? IMO, it should be able to.

A simple test from my devel branch zhanhb@equal-in-variable-declaration:

Commit:
zhanhb@f70ccdb

@ultraq
Copy link
Owner Author

@ultraq ultraq commented on 9e45f22 Dec 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good point. I agree that values should be able to contain = in them too.

Have raised #222

Please sign in to comment.