John Barton (2014-03-08T17:10:22.000Z)
You may like to take a look at how the traceur compiler (
https://github.com/google/traceur-compiler) works. It allows one to write
code like
    var statement = parseStatement `${result}[${index}++] = ${expression};`;
where the ${} syntax surrounds variables from the caller that are
substituted into the string.  In our case the result 'statement' is an AST
but it could source code just as well. And source maps work fine for our
code. Well as fine a source maps ever work ;-)



jjb


On Sat, Mar 8, 2014 at 3:41 AM, Florian Bösch <pyalot at gmail.com> wrote:

> On Fri, Mar 7, 2014 at 8:52 PM, Peter van der Zee <ecma at qfox.nl> wrote:
>
>> I think you want to take a look at "source maps". They're specifically
>> designed to deal with this problem.
>>
>
> The problem is that a function like compileShader would look like this:
>
> var compileShader(source){
>    var shader = gl.createShader(gl.VERTEX_SHADER);
>    gl.shaderSource(shader, source);
>    gl.compileShader(shader);
>    if(!gl.getShaderParameter(GL_COMPILE_STATUS)){
>      var error = glGetShaderInfoLog(shader);
>      // now what?
>
>      // need file of source
>
>      // need lines # of source
>
>    }
> }
>
> And you'd do things like:
>
> var source = """
>    void main(){
>       #{someSnippet}
>       gl_FragColor = whatever;
>    }
> """
> compileShader(source);
>
> I don't see how source maps help either.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140308/9adc3620/attachment-0001.html>
domenic at domenicdenicola.com (2014-03-20T16:23:26.806Z)
You may like to take a look at how the traceur compiler (
https://github.com/google/traceur-compiler) works. It allows one to write
code like

    var statement = parseStatement `${result}[${index}++] = ${expression};`;

where the ${} syntax surrounds variables from the caller that are
substituted into the string.  In our case the result 'statement' is an AST
but it could source code just as well. And source maps work fine for our
code. Well as fine a source maps ever work ;-)