UNPKG

sai-language

Version:

An object-oriented language designed to afford code comprehension and maintenance. Transpiles in-place to Javascript.

106 lines (102 loc) 3.22 kB
#!/usr/bin/env node // Javascript source for via transipled by SAI // "use strict"; var prototype=new function(){ this.Constructor=function(){}; this.__tobelocked=[]; this.__tobefrozen=[]; this.__contracts=[]; this.__unverified=true; this.isof={}; return this; }(); var $AI=require("sai-library"); // Generated code follows var __context={"name":"via","loader":"SAI.GetSourceFromPaths","path":"via.sai","mtime":"2018-02-20T00:37:10.599Z","fetched":"2018-02-20T00:39:10.359Z"}; var _env = process.env; var _SEQ = 0; var isa = prototype.isa = 'Via'; prototype.isof['Via'] = { version: '0.0.0-unspecified', isa: isa, context: __context, type: "main" }; prototype.__tobelocked = prototype.__tobelocked.concat(["'Instantiate'", "'CheckPlate'", "'PlateResults'", "'LookupPlate'", "'WhoAmI'", "'Crap'", "isa"]); prototype.__tobefrozen = prototype.__tobefrozen.concat(["isof"]); var $1g = function() { var $ = this; return { apos: undefined, seq: undefined, plate: '876 ACET' }; } for (var i in $1g()) { prototype[i] = undefined; }; var $2g = prototype.Constructor || function() {}; prototype.Constructor = function() { $2g.call(this); var t = $1g(); for (var i in t) if (t[i] !== undefined) this[i] = t[i]; }; var $3g = prototype['Instantiate'] || function() {}; prototype['Instantiate'] = function(p) { var $_d, $_c, $ = this; { $.CheckPlate(); } }; var $4g = prototype['CheckPlate'] || function() {}; prototype['CheckPlate'] = function(p) { var $_d, $_c, $0, $ = this; { $.LookupPlate($.plate, function() { return ($.PlateResults).apply($, arguments); }); } }; var $5g = prototype['PlateResults'] || function() {}; prototype['PlateResults'] = function(p) { var $_d, $_c, $1, _status = p, $ = this; { $AI.debug_op('Status for ' + $.plate + ': ' + _status); } }; var $6g = prototype['LookupPlate'] || function() {}; prototype['LookupPlate'] = function(p, _cb) { var $_d, $_c, $2, _p = p, $ = this; { $AI.debug_op('Looking up ' + _p); _cb('Valid'); } }; var $7g = prototype['WhoAmI'] || function() {}; prototype['WhoAmI'] = function(p) { var $_d, $_c, $3, $ = this; { $AI.debug_op('I am ' + $.seq); } }; var $8g = prototype['Crap'] || function() {}; prototype['Crap'] = function(p) { var $_d, $_c, $_b, $5, _uri, $4, _options = p, $ = this; { _uri = ((undefined !== ($_b = _env.APOS_MONGODB_URI)) ? $_b : ((undefined !== ($_b = _options.uri)) ? $_b : function(p) { { var $6 = _options; let _uri = 'mongodb://'; if (undefined !== ($5 = ($6.user))) { _uri += '' + $5.user + ':' + $5.password + '@\'';; } _uri += '' + ((undefined !== ($_b = $6.host)) ? $_b : 'localhost') + ':' + ((undefined !== ($_b = $6.port)) ? $_b : 27017) + '/' + ((undefined !== ($_b = $6.name)) ? $_b : $.apos.shortname); return _uri; } }())); } }; $AI.finalizePrototype(prototype); if (prototype.isof[prototype.isa].type === "singleton") { prototype.Constructor(); prototype.Instantiate(); } var result=prototype.isof[prototype.isa].type === "main" ? prototype.constructor() : prototype; exports=result; try { module.exports=result; } catch(e) {}; return result;