Class: KipperSemanticsAsserter
compiler.KipperSemanticsAsserter
Kipper Asserter, which is used to assert certain truths and throw KipperErrors in case that any logical issue is found.
Since
0.7.0
Hierarchy
-
↳
KipperSemanticsAsserter
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• Protected
new KipperSemanticsAsserter(programCtx
)
Parameters
Name | Type |
---|---|
programCtx |
KipperProgramContext |
Overrides
KipperSemanticErrorHandler.constructor
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-asserter.ts:20
Properties
col
• Protected
col: undefined
| number
Inherited from
KipperSemanticErrorHandler.col
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:16
ctx
• Protected
ctx: undefined
| CompilableASTNode
<SemanticData
, TypeData
>
Inherited from
KipperSemanticErrorHandler.ctx
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:17
filePath
• Protected
filePath: undefined
| string
Inherited from
KipperSemanticErrorHandler.filePath
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:18
line
• Protected
line: undefined
| number
Inherited from
KipperSemanticErrorHandler.line
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:15
programCtx
• Readonly
programCtx: KipperProgramContext
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-asserter.ts:18
stream
• Protected
stream: undefined
| KipperFileStream
Inherited from
KipperSemanticErrorHandler.stream
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:19
Methods
assertError
▸ Protected
assertError(error
, overwriteCtx?
): KipperError
Updates the given error and adds the proper traceback data, and returns it.
Parameters
Name | Type | Description |
---|---|---|
error |
KipperError |
The error to update. |
overwriteCtx? |
CompilableASTNode <SemanticData , TypeData > |
The context to overwrite the current context with. This is used when a parent checks children semantics in order to provide the correct traceback data and errors occur in the children. |
Returns
The Kipper error.
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-asserter.ts:33
error
▸ Protected
error(error
): KipperError
Updates the error and adds the proper traceback data, and returns it.
This function also automatically logs the error.
Parameters
Name | Type | Description |
---|---|---|
error |
KipperError |
The error to update. |
Returns
The Kipper error.
Inherited from
KipperSemanticErrorHandler.error
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:52
notImplementedError
▸ notImplementedError(error
): KipperNotImplementedError
Modifies the metadata for a KipperNotImplementedError
Since
0.7.0
Parameters
Name | Type | Description |
---|---|---|
error |
KipperNotImplementedError |
The KipperNotImplementedError instance. |
Returns
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-asserter.ts:54
setTracebackData
▸ setTracebackData(data
): void
Sets the traceback related metadata that will be used to create a traceback for an KipperError instance.
In case that data.ctx is set and other fields are missing, these fields will be filled up using the data in the data.ctx AST node ctx instance.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
data |
Object |
The traceback data that will be used to initialise an KipperError instance. |
data.col? |
number |
- |
data.ctx? |
CompilableASTNode <SemanticData , TypeData > |
- |
data.filePath? |
string |
- |
data.line? |
number |
- |
data.stream? |
KipperFileStream |
- |
Returns
void
Inherited from
KipperSemanticErrorHandler.setTracebackData
Defined in
kipper/core/src/compiler/semantics/analyser/err-handler/semantics-error-handler.ts:29