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);

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.

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.