Fixed bug with string interpolation

This commit is contained in:
NeeEoo
2024-04-25 12:15:23 +02:00
parent aaac98d7b0
commit 50e87c504d
3 changed files with 10 additions and 5 deletions
+3 -5
View File
@@ -2006,11 +2006,9 @@ class Parser {
if(valid) {
if(interpString == null)
interpString = [];
if(interpString.length > 0) { // store the current string
if(b.length > 0)
interpString.push(getTokenList(TConst(CString(b.toString()))));
b = new StringBuf();
}
if(b.length > 0) // store the current string
interpString.push(getTokenList(TConst(CString(b.toString()))));
b = new StringBuf();
interpolation = true;
} else {
b.addChar(c);
+4
View File
@@ -15,6 +15,10 @@ class Util {
return false;
}
if ((a is String) && (b is String)) {
return a == b;
}
if ((a is Array) && (b is Array)) {
var aArray:Array<Dynamic> = cast a;
var bArray:Array<Dynamic> = cast b;
+3
View File
@@ -150,6 +150,9 @@ class StringCase extends TestCase {
assertEq("'$a+5 Hello ${a+5}'", '$a+5 Hello ${a+5}');
//assertEq("'$a+5 Hello ${a+5}'", "" + a + "+5 Hello " + a + 5);
headerCode = '';
assertEq("'hello ${5} world'", 'hello ${5} world');
assertEq("'hello ${5}'", 'hello ${5}');
}
override function teardown() {