3 ms·
If you allow arbitrary JavaScript, then I'm sure you realize that you can't "just walk the AST" ;) At compile time, you have no idea which identifiers are inco
by jashkenas 13y ago
If you allow arbitrary JavaScript, then I'm sure you realize that you can't "just walk the AST" ;)
At compile time, you have no idea which identifiers are incoming data values — to be supplied by the caller of the template function — and which identifiers already exist in scope.
- esailija 13y agoLet me put it in code terms. In the following template script: <div>@hello</div> The generated code can be like (not including runtime lib): var ___html = ""; var hello = hasown.call(data, "hello") ? data.hello : ""; ___html += '<div>' + safeString(hello, HTML_GENERIC) + '</div>'; return ___html; Which gives same effect as `with`.