UNPKG

swahili-lang

Version:

A new programming language with semantics borrowed from the Swahili language to help teach programming concepts to Swahili speaking students.

27 lines (23 loc) 729 B
const SWString = require('../../../types/string'); const RTResult = require('../../../runtimeResult'); const { RTError } = require('../../../error'); /** * Returns the type of a value * @param {SWBuiltInFunction} inst the instance of the built in function * @param {Context} executionContext the calling context */ function aina(inst, executionContext) { let res = new RTResult(); let kitu = executionContext.symbolTable.get('kitu'); if (!kitu) return res.failure( new RTError( inst.posStart, inst.posEnd, `Parameter 'kitu' is required`, executionContext ) ); return res.success(new SWString(kitu.typeName)); } module.exports = { method: aina, args: ['kitu'] };