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:
Bob Nystrom
2015-11-23 07:08:14 -08:00
parent fb72e0fff7
commit 5bde04db4c
3 changed files with 14 additions and 40 deletions
-13
View File
@@ -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"