Skip to content

routier-collection


routier-collection / core/src / CodeBuilder

Class: CodeBuilder ​

Defined in: core/src/codegen/blocks.ts:634

Extends ​

Constructors ​

Constructor ​

new CodeBuilder(name?, parentIndent?, parent?): CodeBuilder

Defined in: core/src/codegen/blocks.ts:16

Parameters ​

name? ​

string

parentIndent? ​

string = ""

parent? ​

Block

Returns ​

CodeBuilder

Inherited from ​

ContainerBlock.constructor

Properties ​

name ​

readonly name: string

Defined in: core/src/codegen/blocks.ts:11

Inherited from ​

ContainerBlock.name

Methods ​

indexOf() ​

indexOf(name): number

Defined in: core/src/codegen/blocks.ts:22

Parameters ​

name ​

string

Returns ​

number

Inherited from ​

ContainerBlock.indexOf


getLines() ​

getLines(): Line[]

Defined in: core/src/codegen/blocks.ts:26

Returns ​

Line[]

Inherited from ​

ContainerBlock.getLines


getParent() ​

getParent(): Block

Defined in: core/src/codegen/blocks.ts:30

Returns ​

Block

Inherited from ​

ContainerBlock.getParent


getIndent() ​

getIndent(): string

Defined in: core/src/codegen/blocks.ts:34

Returns ​

string

Inherited from ​

ContainerBlock.getIndent


setLines() ​

setLines(lines): void

Defined in: core/src/codegen/blocks.ts:38

Parameters ​

lines ​

Line[]

Returns ​

void

Inherited from ​

ContainerBlock.setLines


setParent() ​

setParent(block): void

Defined in: core/src/codegen/blocks.ts:42

Parameters ​

block ​

Block

Returns ​

void

Inherited from ​

ContainerBlock.setParent


setIndent() ​

setIndent(indent): void

Defined in: core/src/codegen/blocks.ts:46

Parameters ​

indent ​

string

Returns ​

void

Inherited from ​

ContainerBlock.setIndent


getOrDefault() ​

getOrDefault<T>(name): T

Defined in: core/src/codegen/blocks.ts:50

Type Parameters ​

T ​

T extends Block

Parameters ​

name ​

string

Returns ​

T

Inherited from ​

ContainerBlock.getOrDefault


get() ​

get<T>(name): T

Defined in: core/src/codegen/blocks.ts:79

Type Parameters ​

T ​

T extends Block

Parameters ​

name ​

string

Returns ​

T

Inherited from ​

ContainerBlock.get


has() ​

has(name): boolean

Defined in: core/src/codegen/blocks.ts:89

Parameters ​

name ​

string

Returns ​

boolean

Inherited from ​

ContainerBlock.has


remove() ​

remove(name): void

Defined in: core/src/codegen/blocks.ts:93

Parameters ​

name ​

string

Returns ​

void

Inherited from ​

ContainerBlock.remove


replace() ​

replace(name, line): void

Defined in: core/src/codegen/blocks.ts:97

Parameters ​

name ​

string

line ​

Block

Returns ​

void

Inherited from ​

ContainerBlock.replace


if() ​

if(condition, options?): IfBuilder

Defined in: core/src/codegen/blocks.ts:140

Parameters ​

condition ​

string

options? ​

CreateBlockOptions

Returns ​

IfBuilder

Inherited from ​

ContainerBlock.if


raw() ​

raw(raw, options?): RawBuilder

Defined in: core/src/codegen/blocks.ts:151

Parameters ​

raw ​

string

options? ​

CreateBlockOptions

Returns ​

RawBuilder

Inherited from ​

ContainerBlock.raw


function() ​

function(name?, options?): FunctionBuilder

Defined in: core/src/codegen/blocks.ts:157

Parameters ​

name? ​

string

options? ​

CreateBlockOptions

Returns ​

FunctionBuilder

Inherited from ​

ContainerBlock.function


factory() ​

factory(name?, options?): FunctionFactoryBuilder

Defined in: core/src/codegen/blocks.ts:163

Parameters ​

name? ​

string

options? ​

CreateBlockOptions

Returns ​

FunctionFactoryBuilder

Inherited from ​

ContainerBlock.factory


variable() ​

variable(declaration, options?): VariableBuilder

Defined in: core/src/codegen/blocks.ts:169

Parameters ​

declaration ​

string

options? ​

CreateBlockOptions

Returns ​

VariableBuilder

Inherited from ​

ContainerBlock.variable


assign() ​

assign(variableName, options?): AssignmentBuilder

Defined in: core/src/codegen/blocks.ts:175

Parameters ​

variableName ​

string

options? ​

CreateBlockOptions

Returns ​

AssignmentBuilder

Inherited from ​

ContainerBlock.assign


object() ​

object(options?): ObjectBuilder

Defined in: core/src/codegen/blocks.ts:181

Parameters ​

options? ​

CreateBlockOptions

Returns ​

ObjectBuilder

Inherited from ​

ContainerBlock.object


slot() ​

slot(name): SlotBlock

Defined in: core/src/codegen/blocks.ts:187

Parameters ​

name ​

string

Returns ​

SlotBlock

Inherited from ​

ContainerBlock.slot


array() ​

array(accessor, options?): ArrayBuilder

Defined in: core/src/codegen/blocks.ts:193

Parameters ​

accessor ​

string

options? ​

CreateBlockOptions

Returns ​

ArrayBuilder

Inherited from ​

ContainerBlock.array


bind() ​

bind(value, name): string

Defined in: core/src/codegen/blocks.ts:646

Makes value available to the generated function under the returned name.

Generated code must never reach a runtime value by its source name or by pasting its source text: a minifier renames the declaration and cannot see inside the generated string, and pasted source loses the scope it closed over (#40, #46). A binding is passed in as a real value when the function is compiled, so it survives any bundler.

Parameters ​

value ​

unknown

name ​

string = ...

Returns ​

string


getBindings() ​

getBindings(): Param[]

Defined in: core/src/codegen/blocks.ts:651

Returns ​

Param[]


toString() ​

toString(): string

Defined in: core/src/codegen/blocks.ts:655

Returns ​

string

Overrides ​

ContainerBlock.toString

Released under the MIT License.