Eagerly evaluate interpolated expressions.
If we ever support custom string templates, we'll need to go back to compiling them to functions. But, for now, they can be evaluated eagerly, leading to simpler code.
This commit is contained in:
@@ -133,19 +133,6 @@ static const char* coreModuleSource =
|
||||
"class String is Sequence {\n"
|
||||
" bytes { StringByteSequence.new(this) }\n"
|
||||
" codePoints { StringCodePointSequence.new(this) }\n"
|
||||
"\n"
|
||||
" static interpolate_(parts) {\n"
|
||||
" var result = \"\"\n"
|
||||
" for (part in parts) {\n"
|
||||
" if (part is String) {\n"
|
||||
" result = result + part\n"
|
||||
" } else {\n"
|
||||
" result = result + part.call().toString\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"class StringByteSequence is Sequence {\n"
|
||||
|
||||
Reference in New Issue
Block a user