jbeard4 / SCION

SCXML/Statecharts in JavaScript, moved to gitlab: https://gitlab.com/scion-scxml/scion
https://scion.scxml.io
Apache License 2.0
149 stars 29 forks source link

validate send *expr attributes at parse time #387

Open mattoshry opened 7 years ago

mattoshry commented 7 years ago

https://www.w3.org/TR/scxml/#send The following should be ECMA-validated at parse time: 'delayexpr', 'eventexpr', 'targetexpr', 'typeexpr'

If they are not valid ECMAScript expressions, the document should be rejected.

Unclear what validation the code at [1] is performing. Won't node will always have a $type ('send')? Is 'expr' a valid attribute of send?

            'send': function (node) {
                if(node.$type) {
                    return validateJavascriptExpression(node.expr);
                }

                return [];

[1] https://github.com/jbeard4/SCION/blob/cbdf5ddfec5583277dc69e5cf80fd2d8d8bf0be6/lib/compiler/static-analysis/scjson-analyzer.js#L153