Generate JavaScript syntax not directly supported by Haxe. Use only at low-level when specific target-specific code-generation is required.

Static methods

staticcode(code:String, args:Rest<Dynamic>):Dynamic

Inject code directly into generated source.

code must be a string constant.

Additional args are supported to provide code interpolation, for example:

Syntax.code("console.log({0}, {1})", "hi", 42);

will generate

console.log("hi", 42);

Emits a compilation error if the count of args does not match the count of placeholders in code.

staticconstruct<T>(cl:Class<T>, args:Rest<Dynamic>):T

staticconstruct(cl:String, args:Rest<Dynamic>):Dynamic

Generate new cl(...args) expression.

staticdelete(o:Dynamic, f:String):Bool

staticdelete(o:Dynamic, f:Int):Bool

Generate delete o[f] expression.

staticfield(o:Dynamic, f:String):Dynamic

Generate o.f expression, if f is a constant string, or o[f] if it's any other expression.

staticinstanceof(v:Dynamic, cl:Class<Dynamic>):Bool

Generate v instanceof cl expression.

staticplainCode(code:String):Dynamic

Inject code directly into generated source. The same as js.Syntax.code except this one does not provide code interpolation.

staticstrictEq(a:Dynamic, b:Dynamic):Bool

Genearte a === b expression.

staticstrictNeq(a:Dynamic, b:Dynamic):Bool

Genearte a !== b expression.

statictypeof(o:Dynamic):String

Generate typeof o expression.