Concatenate strings also on the right-hand side of an expression that cannot be evaluated. Fix #126

E.g. converts:
  a+'Hello'+'World'
to
  a+'HelloWorld'
This commit is contained in:
Dan Wolff
2013-09-19 10:58:50 +02:00
committed by Mihai Bazon
parent 83ba338bd0
commit 8d14efe818
2 changed files with 81 additions and 40 deletions

View File

@@ -0,0 +1,22 @@
concatenate_rhs_strings: {
options = {
evaluate: true,
unsafe: true,
}
input: {
foo(bar() + 123 + "Hello" + "World");
foo(bar() + (123 + "Hello") + "World");
foo((bar() + 123) + "Hello" + "World");
foo(bar() + 123 + "Hello" + "World" + ("Foo" + "Bar"));
foo("Foo" + "Bar" + bar() + 123 + "Hello" + "World" + ("Foo" + "Bar"));
foo("Hello" + bar() + 123 + "World");
}
expect: {
foo(bar() + 123 + "HelloWorld");
foo(bar() + "123HelloWorld");
foo((bar() + 123) + "HelloWorld");
foo(bar() + 123 + "HelloWorldFooBar");
foo("FooBar" + bar() + "123HelloWorldFooBar");
foo("Hello" + bar() + "123World");
}
}