type

JsNode

abstract class JsNode : Obj

JsNode

constructors

fields

methods

c
checkJsSafety
curType
err
fieldToJs

Get the name that should be used for the generated field in JS code.

isJsType
isPrimitive
js
loc
methodParams

generates (p1, p2, ...pn)

methodToJs

Get the name that should be used for the generated method in JS code.

nameToJs

Return the JS identifier name to use for the given Fantom name.

node
qnameToJs

Get the module-qualified name for this CType.

resolveType
toLoc
uniqName

return a unique id name

warn
write
writeBlock
writeExpr
writeStmt

Slot Details

c

Compiler c()

checkJsSafety

Bool checkJsSafety(CType ctype, Loc? loc)

curType

TypeDef? curType()

err

CompilerErr err(Str msg, Loc? loc := null)

fieldToJs

static Str fieldToJs(Obj name)

Get the name that should be used for the generated field in JS code. A field is always private so we do not need to swizzle its name.

isJsType

Bool isJsType(TypeDef def)

isPrimitive

Bool isPrimitive(CType ctype)

js

JsWriter js()

loc

virtual Loc? loc()

make

new make(CompileEsPlugin plugin, Node? node := null)

methodParams

Str methodParams(CParam[] params)

generates (p1, p2, ...pn)

methodToJs

static Str methodToJs(Str name)

Get the name that should be used for the generated method in JS code. It turns out we don't need to swizzle method names.

nameToJs

Str nameToJs(Str name)

Return the JS identifier name to use for the given Fantom name. This should be used to get names for local variable declarations and method/func parameters.

Note - use fieldJs for generating field names since we have a lot of special handling for fields Note - use methodJs for generating method names

node

virtual Node? node()

plugin

CompileEsPlugin plugin { private set }

pmap

const Str:Bool pmap := ...

qnameToJs

Str qnameToJs(CType ctype)

Get the module-qualified name for this CType. If the type is in the this pod, it does not need to be qualified

resolveType

CType resolveType(CType ctype)

toLoc

static Loc? toLoc(Obj obj)

uniqName

Str uniqName(Str name := "u")

return a unique id name

warn

CompilerErr warn(Str msg, Loc? loc := null)

write

abstract Void write()

writeBlock

Void writeBlock(Block? block)

writeExpr

Void writeExpr(Expr? expr)

writeStmt

Void writeStmt(Stmt? stmt)