sai-language
Version:
An object-oriented language designed to afford code comprehension and maintenance. Transpiles in-place to Javascript.
55 lines (53 loc) • 1.78 kB
JavaScript
var __context={"name":"state","loader":"SAI.GetSourceFromPaths","path":"state.sai","mtime":"2018-02-28T20:22:45.380Z","fetched":"2018-02-28T20:56:33.818Z"};
var isa = prototype.isa = 'State';
var $bindfail = function(m) {
throw new Error("SAI: A call to " + m + " on object " + isa + " has come unbound from any instance of that object. (If this is not in error, mark the declaration of " + m + " as unbound.)");
}
prototype.isof['State'] = {
version: '0.0.0-unspecified',
isa: isa,
context: __context,
type: "main"
};
prototype.__tobelocked = prototype.__tobelocked.concat(["'Instantiate'", "'Timer'", "isa"]);
prototype.__tobefrozen = prototype.__tobefrozen.concat(["isof"]);
var $2g = prototype['Instantiate'] || function() {};
prototype['Instantiate'] = function(p) {
var $_d, $_c, _goto, _o, _a, $ = this['Instantiate'] ? this : $bindfail('Instantiate'); {
_a = 1;
function() {
var _goto;
var $states = {
1: function(p) {
var _o = p; {
$AI.debug_op('1');
$.Timer(500, function(p) {
{
_goto(2);
}
});
}
},
2: function(p) {
{
$AI.debug_op('2');
}
}
}
_goto = function(state) {
var fn = $states[state] ||
throw new Error("SAI runtime: STATE " + state + " does not exist; available states are " + $states.join(','));
var args = Array.prototype.slice.call(arguments, 1);
fn.call($, args);
};
_goto(1);
}();
}
};
var $3g = prototype['Timer'] || function() {};
prototype['Timer'] = function(p, _cb) {
var $_d, $_c, $0, _time = p,
$ = this['Timer'] ? this : $bindfail('Timer'); {
setTimeout(_cb, _time);
}
};