UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,424 lines (1,423 loc) 194 kB
{ "type": "File", "start": 0, "end": 1200, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1200, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 65, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 49, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } }, "local": { "type": "Identifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 }, "identifierName": "Asset" }, "name": "Asset" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 48, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 48 } }, "extra": { "rawValue": "../systems/AssetSystem/Asset", "raw": "'../systems/AssetSystem/Asset'" }, "value": "../systems/AssetSystem/Asset" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Assembly (WASM) asset loader.\r\n ", "start": 53, "end": 95, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 97, "end": 1198, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 64, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 112, "end": 1198, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 64, "column": 1 } }, "id": { "type": "Identifier", "start": 118, "end": 131, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 34 }, "identifierName": "AssemblyAsset" }, "name": "AssemblyAsset", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 140, "end": 145, "loc": { "start": { "line": 6, "column": 43 }, "end": { "line": 6, "column": 48 }, "identifierName": "Asset" }, "name": "Asset" }, "body": { "type": "ClassBody", "start": 146, "end": 1198, "loc": { "start": { "line": 6, "column": 49 }, "end": { "line": 64, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 373, "end": 443, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 380, "end": 387, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 388, "end": 395, "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 24 } }, "argument": { "type": "Identifier", "start": 391, "end": 395, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 24 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 397, "end": 443, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 404, "end": 438, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 38 } }, "argument": { "type": "NewExpression", "start": 411, "end": 437, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 37 } }, "callee": { "type": "Identifier", "start": 415, "end": 428, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 28 }, "identifierName": "AssemblyAsset" }, "name": "AssemblyAsset" }, "arguments": [ { "type": "SpreadElement", "start": 429, "end": 436, "loc": { "start": { "line": 19, "column": 29 }, "end": { "line": 19, "column": 36 } }, "argument": { "type": "Identifier", "start": 432, "end": 436, "loc": { "start": { "line": 19, "column": 32 }, "end": { "line": 19, "column": 36 }, "identifierName": "args" }, "name": "args" } } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {AssemblyAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('wasm', AssemblyAsset.factory);\r\n ", "start": 153, "end": 369, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 17, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 449, "end": 475, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 479, "end": 586, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 30, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 479, "end": 490, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 25, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 491, "end": 498, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 21 } }, "argument": { "type": "Identifier", "start": 494, "end": 498, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 21 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 500, "end": 586, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 30, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 507, "end": 522, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 19 } }, "expression": { "type": "CallExpression", "start": 507, "end": 521, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 18 } }, "callee": { "type": "Super", "start": 507, "end": 512, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 9 } } }, "arguments": [ { "type": "SpreadElement", "start": 513, "end": 520, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 17 } }, "argument": { "type": "Identifier", "start": 516, "end": 520, "loc": { "start": { "line": 26, "column": 13 }, "end": { "line": 26, "column": 17 }, "identifierName": "args" }, "name": "args" } } ] } }, { "type": "ExpressionStatement", "start": 530, "end": 555, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 530, "end": 554, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 530, "end": 547, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 21 } }, "object": { "type": "ThisExpression", "start": 530, "end": 534, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 8 } } }, "property": { "type": "Identifier", "start": 535, "end": 547, "loc": { "start": { "line": 28, "column": 9 }, "end": { "line": 28, "column": 21 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 550, "end": 554, "loc": { "start": { "line": 28, "column": 24 }, "end": { "line": 28, "column": 28 } } } } }, { "type": "ExpressionStatement", "start": 561, "end": 581, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 561, "end": 580, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 561, "end": 573, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 } }, "object": { "type": "ThisExpression", "start": 561, "end": 565, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 8 } } }, "property": { "type": "Identifier", "start": 566, "end": 573, "loc": { "start": { "line": 29, "column": 9 }, "end": { "line": 29, "column": 16 }, "identifierName": "_module" }, "name": "_module" }, "computed": false }, "right": { "type": "NullLiteral", "start": 576, "end": 580, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 23 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 449, "end": 475, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 592, "end": 618, "loc": { "start": { "line": 32, "column": 2 }, "end": { "line": 34, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 622, "end": 833, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 46, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 622, "end": 629, "loc": { "start": { "line": 35, "column": 2 }, "end": { "line": 35, "column": 9 }, "identifierName": "dispose" }, "name": "dispose", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 632, "end": 833, "loc": { "start": { "line": 35, "column": 12 }, "end": { "line": 46, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 639, "end": 655, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 20 } }, "expression": { "type": "CallExpression", "start": 639, "end": 654, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 19 } }, "callee": { "type": "MemberExpression", "start": 639, "end": 652, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 17 } }, "object": { "type": "Super", "start": 639, "end": 644, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 9 } } }, "property": { "type": "Identifier", "start": 645, "end": 652, "loc": { "start": { "line": 36, "column": 10 }, "end": { "line": 36, "column": 17 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } }, { "type": "VariableDeclaration", "start": 663, "end": 702, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 38, "column": 43 } }, "declarations": [ { "type": "VariableDeclarator", "start": 669, "end": 701, "loc": { "start": { "line": 38, "column": 10 }, "end": { "line": 38, "column": 42 } }, "id": { "type": "ObjectPattern", "start": 669, "end": 694, "loc": { "start": { "line": 38, "column": 10 }, "end": { "line": 38, "column": 35 } }, "properties": [ { "type": "ObjectProperty", "start": 671, "end": 683, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 24 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 671, "end": 683, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 24 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "value": { "type": "Identifier", "start": 671, "end": 683, "loc": { "start": { "line": 38, "column": 12 }, "end": { "line": 38, "column": 24 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 685, "end": 692, "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 33 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 685, "end": 692, "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 33 }, "identifierName": "_module" }, "name": "_module" }, "value": { "type": "Identifier", "start": 685, "end": 692, "loc": { "start": { "line": 38, "column": 26 }, "end": { "line": 38, "column": 33 }, "identifierName": "_module" }, "name": "_module" }, "extra": { "shorthand": true } } ] }, "init": { "type": "ThisExpression", "start": 697, "end": 701, "loc": { "start": { "line": 38, "column": 38 }, "end": { "line": 38, "column": 42 } } } } ], "kind": "const" }, { "type": "IfStatement", "start": 710, "end": 769, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 714, "end": 728, "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 22 } }, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", "start": 715, "end": 728, "loc": { "start": { "line": 40, "column": 9 }, "end": { "line": 40, "column": 22 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 716, "end": 728, "loc": { "start": { "line": 40, "column": 10 }, "end": { "line": 40, "column": 22 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "extra": { "parenthesizedArgument": false } }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 730, "end": 769, "loc": { "start": { "line": 40, "column": 24 }, "end": { "line": 42, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 739, "end": 762, "loc": { "start": { "line": 41, "column": 6 }, "end": { "line": 41, "column": 29 } }, "expression": { "type": "CallExpression", "start": 739, "end": 761, "loc": { "start": { "line": 41, "column": 6 }, "end": { "line": 41, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 739, "end": 759, "loc": { "start": { "line": 41, "column": 6 }, "end": { "line": 41, "column": 26 } }, "object": { "type": "Identifier", "start": 739, "end": 751, "loc": { "start": { "line": 41, "column": 6 }, "end": { "line": 41, "column": 18 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "property": { "type": "Identifier", "start": 752, "end": 759, "loc": { "start": { "line": 41, "column": 19 }, "end": { "line": 41, "column": 26 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 777, "end": 802, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 777, "end": 801, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 777, "end": 794, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 21 } }, "object": { "type": "ThisExpression", "start": 777, "end": 781, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 8 } } }, "property": { "type": "Identifier", "start": 782, "end": 794, "loc": { "start": { "line": 44, "column": 9 }, "end": { "line": 44, "column": 21 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 797, "end": 801, "loc": { "start": { "line": 44, "column": 24 }, "end": { "line": 44, "column": 28 } } } } }, { "type": "ExpressionStatement", "start": 808, "end": 828, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 808, "end": 827, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 808, "end": 820, "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 16 } }, "object": { "type": "ThisExpression", "start": 808, "end": 812, "loc": {