src/util.jsx

class Cloner.<T>

static function cloneArray(a : Array.<T>) : Array.<T>

static function cloneNullable(o : T) : T

class Serializer.<T>

static function serializeArray(a : Array.<T>) : variant

static function serializeNullable(v : T) : variant

class Pair.<T, U>

var first : T

var second : U

new Pair(first : T, second : U)

class Triple.<T, U, V>

var first : T

var second : U

var third : V

new Triple(first : T, second : U, third : V)

class TypedMap.<K, V>

Map-like container with specified type of keys.

new TypedMap()

new TypedMap(equalsCallback : function (:K, :K) : boolean)

function clone() : TypedMap.<K, V>

function has(key : K) : boolean

function set(key : K, val : V) : void

function get(key : K) : Nullable.<V>

function delete(key : K) : void

function clear() : void

function forEach(cb : function (:K, :V) : boolean) : boolean

function reversedForEach(cb : function (:K, :V) : boolean) : boolean

class Util

new Util()

static function repeat(c : string, n : number) : string

static function format(fmt : string, args : Array.<string>) : string

Usage: Util.format("%1 %% %2", ["foo", "bar"]) -> "foo % bar"
fmt format template
args parameters which are expanded into fmt

static function isBuiltInContainer(type : Type) : boolean

static function instantiateTemplate(context : AnalysisContext, token : Token, className : string, typeArguments : Array.<Type>) : ClassDefinition

static function analyzeArgs(context : AnalysisContext, args : Array.<Expression>, parentExpr : Expression, expectedTypes : Array.<Array.<Type>>) : Array.<Type>

static function typesAreEqual(x : Array.<Type>, y : Array.<Type>) : boolean

static function forEachStatement(cb : function (:Statement) : boolean, statements : Array.<Statement>) : boolean

static function forEachExpression(cb : function (:Expression) : boolean, exprs : Array.<Expression>) : boolean

static function forEachExpression(cb : function (:Expression, :function (:Expression) : void) : boolean, exprs : Array.<Expression>) : boolean

static function findFunctionInClass(classDef : ClassDefinition, funcName : string, argTypes : Array.<Type>, isStatic : boolean) : MemberFunctionDefinition

static function findVariableInClass(classDef : ClassDefinition, name : string, isStatic : boolean) : MemberVariableDefinition

static function findMemberInClass(classDef : ClassDefinition, name : string, argTypes : Array.<Type>, isStatic : boolean) : MemberDefinition

static function memberRootIsNative(classDef : ClassDefinition, name : string, argTypes : Array.<Type>, isStatic : boolean) : boolean

static function propertyRootIsNative(expr : PropertyExpression) : boolean

static function memberIsExported(classDef : ClassDefinition, name : string, argTypes : Array.<Type>, isStatic : boolean) : boolean

static function isReferringToFunctionDefinition(expr : PropertyExpression) : boolean

static function encodeStringLiteral(str : string) : string

static function decodeStringLiteral(literal : string) : string

static function resolvePath(path : string) : string

Canonicalizes the given path. e.g. "a/x/../b" to "a/b"

static function relativePath(fromPath : string, toPath : string, isFile : boolean) : string

Solves the relative path from from to to. e.g. relativePath("/a/b/c", "/a/d/e") to "../d/e"

static function basename(path : string) : string

static function dirname(path : string) : string

static function toOrdinal(n : number) : string

static function makeErrorMessage(platform : Platform, message : string, filename : Nullable.<string>, lineNumber : number, columnNumber : number, size : number) : string

static function isArrayOf(classDef : ClassDefinition, expectedElementType : Type) : boolean

static function asSet(array : Array.<string>) : Map.<boolean>

static function isECMA262Reserved(word : string) : boolean