Skip to content

달빛약속 / core/mod / DeclareFunction

Class: DeclareFunction

약속 키워드를 통해 함수(약속)를 선언하는 AST 노드입니다.

이 노드는 실행될 때 실제로 함수 코드를 실행하는 것이 아니라, 실행 가능한 FunctionObject를 생성하여 현재 스코프에 등록하는 역할을 합니다. 이때 FunctionObject는 함수가 선언된 시점의 스코프를 기억하며, 이는 클로저(Closure)를 구현하는 핵심입니다.

Extends

Indexable

[key: string]: unknown

Constructors

DeclareFunction()

DeclareFunction(props, tokens): DeclareFunction

Parameters

props

props.body: Block

props.dotReceiverTypeNames?: string[]

props.name: string

props.paramNames?: string[]

tokens: Token[]

Returns

DeclareFunction

Overrides

Executable.constructor

Defined in

core/node/function.ts:32

Properties

body

body: Block

Defined in

core/node/function.ts:28


dotReceiverTypeNames?

optional dotReceiverTypeNames: string[]

Defined in

core/node/function.ts:30


name

name: string

Defined in

core/node/function.ts:27


paramNames?

optional paramNames: string[]

Defined in

core/node/function.ts:29


tokens

tokens: Token[]

Inherited from

Executable.tokens

Defined in

core/node/function.ts:39


friendlyName

static friendlyName: string = '새 약속 만들기'

Overrides

Executable.friendlyName

Defined in

core/node/function.ts:25

Methods

execute()

execute(scope): Promise<void>

함수를 나타내는 FunctionObject를 생성하고 현재 스코프에 추가합니다.

Parameters

scope: Scope

함수가 선언되는 현재의 스코프입니다.

Returns

Promise<void>

Overrides

Executable.execute

Defined in

core/node/function.ts:53


getNodeTypeName()

protected getNodeTypeName(): string

Returns

string

Inherited from

Executable.getNodeTypeName

Defined in

core/node/base.ts:32


onRunChild()

protected onRunChild(__namedParameters): Promise<void>

Parameters

__namedParameters

__namedParameters.childTokens: Token[]

__namedParameters.scope: Scope

__namedParameters.skipReport?: boolean = false

Returns

Promise<void>

Inherited from

Executable.onRunChild

Defined in

core/node/base.ts:48


toJSON()

toJSON(): object

Returns

object

Inherited from

Executable.toJSON

Defined in

core/node/base.ts:21


toPrint()

toPrint(): string

Returns

string

Inherited from

Executable.toPrint

Defined in

core/node/base.ts:44


validate()

validate(scope): YaksokError<unknown>[]

Parameters

scope: Scope

Returns

YaksokError<unknown>[]

Overrides

Executable.validate

Defined in

core/node/function.ts:77