oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,538 lines (1,537 loc) • 272 kB
JSON
{
"type": "File",
"start": 0,
"end": 2367,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 109,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2367,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 109,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 28
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "AssetSystem"
},
"name": "AssetSystem"
}
}
],
"source": {
"type": "StringLiteral",
"start": 24,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 27
}
},
"extra": {
"rawValue": ".",
"raw": "'.'"
},
"value": "."
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Asset - base of any asset loader.\r\n ",
"start": 32,
"end": 78,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 80,
"end": 2365,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 108,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 95,
"end": 2365,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 108,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 101,
"end": 106,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 26
},
"identifierName": "Asset"
},
"name": "Asset",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 107,
"end": 2365,
"loc": {
"start": {
"line": 6,
"column": 27
},
"end": {
"line": 108,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 144,
"end": 187,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 11,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 148,
"end": 153,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 11
},
"identifierName": "owner"
},
"name": "owner"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 156,
"end": 187,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 11,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 163,
"end": 182,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 23
}
},
"argument": {
"type": "MemberExpression",
"start": 170,
"end": 181,
"loc": {
"start": {
"line": 10,
"column": 11
},
"end": {
"line": 10,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 170,
"end": 174,
"loc": {
"start": {
"line": 10,
"column": 11
},
"end": {
"line": 10,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 175,
"end": 181,
"loc": {
"start": {
"line": 10,
"column": 16
},
"end": {
"line": 10,
"column": 22
},
"identifierName": "_owner"
},
"name": "_owner"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {AssetSystem} ",
"start": 114,
"end": 140,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 28
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {string} ",
"start": 193,
"end": 214,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 218,
"end": 267,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 16,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 222,
"end": 230,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 14
},
"identifierName": "protocol"
},
"name": "protocol"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 233,
"end": 267,
"loc": {
"start": {
"line": 14,
"column": 17
},
"end": {
"line": 16,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 240,
"end": 262,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 26
}
},
"argument": {
"type": "MemberExpression",
"start": 247,
"end": 261,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 247,
"end": 251,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 252,
"end": 261,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 25
},
"identifierName": "_protocol"
},
"name": "_protocol"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {string} ",
"start": 193,
"end": 214,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 23
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {string} ",
"start": 273,
"end": 294,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 23
}
}
}
]
},
{
"type": "ClassMethod",
"start": 298,
"end": 347,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 21,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 302,
"end": 310,
"loc": {
"start": {
"line": 19,
"column": 6
},
"end": {
"line": 19,
"column": 14
},
"identifierName": "filename"
},
"name": "filename"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 313,
"end": 347,
"loc": {
"start": {
"line": 19,
"column": 17
},
"end": {
"line": 21,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 320,
"end": 342,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 26
}
},
"argument": {
"type": "MemberExpression",
"start": 327,
"end": 341,
"loc": {
"start": {
"line": 20,
"column": 11
},
"end": {
"line": 20,
"column": 25
}
},
"object": {
"type": "ThisExpression",
"start": 327,
"end": 331,
"loc": {
"start": {
"line": 20,
"column": 11
},
"end": {
"line": 20,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 332,
"end": 341,
"loc": {
"start": {
"line": 20,
"column": 16
},
"end": {
"line": 20,
"column": 25
},
"identifierName": "_filename"
},
"name": "_filename"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {string} ",
"start": 273,
"end": 294,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 23
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 353,
"end": 369,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 373,
"end": 420,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 26,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 377,
"end": 384,
"loc": {
"start": {
"line": 24,
"column": 6
},
"end": {
"line": 24,
"column": 13
},
"identifierName": "options"
},
"name": "options"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 387,
"end": 420,
"loc": {
"start": {
"line": 24,
"column": 16
},
"end": {
"line": 26,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 394,
"end": 415,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 25
}
},
"argument": {
"type": "MemberExpression",
"start": 401,
"end": 414,
"loc": {
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 24
}
},
"object": {
"type": "ThisExpression",
"start": 401,
"end": 405,
"loc": {
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 406,
"end": 414,
"loc": {
"start": {
"line": 25,
"column": 16
},
"end": {
"line": 25,
"column": 24
},
"identifierName": "_options"
},
"name": "_options"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 353,
"end": 369,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 426,
"end": 442,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 446,
"end": 487,
"loc": {
"start": {
"line": 29,
"column": 2
},
"end": {
"line": 31,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 450,
"end": 454,
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 10
},
"identifierName": "data"
},
"name": "data"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 457,
"end": 487,
"loc": {
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 31,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 464,
"end": 482,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 22
}
},
"argument": {
"type": "MemberExpression",
"start": 471,
"end": 481,
"loc": {
"start": {
"line": 30,
"column": 11
},
"end": {
"line": 30,
"column": 21
}
},
"object": {
"type": "ThisExpression",
"start": 471,
"end": 475,
"loc": {
"start": {
"line": 30,
"column": 11
},
"end": {
"line": 30,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"start": 476,
"end": 481,
"loc": {
"start": {
"line": 30,
"column": 16
},
"end": {
"line": 30,
"column": 21
},
"identifierName": "_data"
},
"name": "_data"
},
"computed": false
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 426,
"end": 442,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 493,
"end": 509,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 33,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 513,
"end": 558,
"loc": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 36,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 517,
"end": 521,
"loc": {
"start": {
"line": 34,
"column": 6
},
"end": {
"line": 34,
"column": 10
},
"identifierName": "data"
},
"name": "data"
},
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 522,
"end": 526,
"loc": {
"start": {
"line": 34,
"column": 11
},
"end": {
"line": 34,
"column": 15
},
"identifierName": "data"
},
"name": "data"
}
],
"body": {
"type": "BlockStatement",
"start": 528,
"end": 558,
"loc": {
"start": {
"line": 34,
"column": 17
},
"end": {
"line": 36,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 535,
"end": 553,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 22
}
},
"expression": {
"type": "AssignmentExpression",
"start": 535,
"end": 552,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 21
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 535,
"end": 545,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 535,
"end": 539,
"loc": {
"start": {
"line": 35,
"column": 4
},
"end": {
"line": 35,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 540,
"end": 545,
"loc": {
"start": {
"line": 35,
"column": 9
},
"end": {
"line": 35,
"column": 14
},
"identifierName": "_data"
},
"name": "_data"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 548,
"end": 552,
"loc": {
"start": {
"line": 35,
"column": 17
},
"end": {
"line": 35,
"column": 21
},
"identifierName": "data"
},
"name": "data"
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 493,
"end": 509,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 33,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Constructor.\r\n *\r\n * @param {AssetSystem}\towner - Asset owner.\r\n * @param {string}\tprotocol - Used protocol name.\r\n * @param {string}\tfilename - File name path.\r\n * @param {*} options - Options.\r\n ",
"start": 564,
"end": 785,
"loc": {
"start": {
"line": 38,
"column": 2
},
"end": {
"line": 45,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 789,
"end": 1328,
"loc": {
"start": {
"line": 46,
"column": 2
},
"end": {
"line": 62,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 789,
"end": 800,
"loc": {
"start": {
"line": 46,
"column": 2
},
"end": {
"line": 46,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 801,
"end": 806,
"loc": {
"start": {
"line": 46,
"column": 14
},
"end": {
"line": 46,
"column": 19
},
"identifierName": "owner"
},
"name": "owner"
},
{
"type": "Identifier",
"start": 808,
"end": 816,
"loc": {
"start": {
"line": 46,
"column": 21
},
"end": {
"line": 46,
"column": 29
},
"identifierName": "protocol"
},
"name": "protocol"
},
{
"type": "Identifier",
"start": 818,
"end": 826,
"loc": {
"start": {
"line": 46,
"column": 31
},
"end": {
"line": 46,
"column": 39
},
"identifierName": "filename"
},
"name": "filename"
},
{
"type": "AssignmentPattern",
"start": 828,
"end": 842,
"loc": {
"start": {
"line": 46,
"column": 41
},
"end": {
"line": 46,
"column": 55
}
},
"left": {
"type": "Identifier",
"start": 828,
"end": 835,
"loc": {
"start": {
"line": 46,
"column": 41
},
"end": {
"line": 46,
"column": 48
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "NullLiteral",
"start": 838,
"end": 842,
"loc": {
"start": {
"line": 46,
"column": 51
},
"end": {
"line": 46,
"column": 55
}
}
}
}
],
"body": {
"type": "BlockStatement",
"start": 844,
"end": 1328,
"loc": {
"start": {
"line": 46,
"column": 57
},
"end": {
"line": 62,
"column": 3
}
},
"body": [
{
"type": "IfStatement",
"start": 851,
"end": 959,
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 49,
"column": 5
}
},
"test": {
"type": "UnaryExpression",
"start": 855,
"end": 886,
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 39
}
},
"operator": "!",
"prefix": true,
"argument": {
"type": "BinaryExpression",
"start": 857,
"end": 885,
"loc": {
"start": {
"line": 47,
"column": 10
},
"end": {
"line": 47,
"column": 38
}
},
"left": {
"type": "Identifier",
"start": 857,
"end": 862,
"loc": {
"start": {
"line": 47,
"column": 10
},
"end": {
"line": 47,
"column": 15
},
"identifierName": "owner"
},
"name": "owner"
},
"operator": "instanceof",
"right": {
"type": "Identifier",
"start": 874,
"end": 885,
"loc": {
"start": {
"line": 47,
"column": 27
},
"end": {
"line": 47,
"column": 38
},
"identifierName": "AssetSystem"
},
"name": "AssetSystem"
},
"extra": {
"parenthesized": true,
"parenStart": 856
}
},
"extra": {
"parenthesizedArgument": false
}
},
"consequent": {
"type": "BlockStatement",
"start": 888,
"end": 959,
"loc": {
"start": {
"line": 47,
"column": 41
},
"end": {
"line": 49,
"column": 5
}
},
"body": [
{
"type": "ThrowStatement",
"start": 897,
"end": 952,
"loc": {
"start": {
"line": 48,
"column": 6
},
"end": {
"line": 48,
"column": 61
}
},
"argument": {
"type": "NewExpression",
"start": 903,
"end": 951,
"loc": {
"start": {
"line": 48,
"column": 12
},
"end": {
"line": 48,
"column": 60
}
},
"callee": {
"type": "Identifier",
"start": 907,
"end": 912,
"loc": {
"start": {
"line": 48,
"column": 16
},
"end": {
"line": 48,
"column": 21
},
"identifierName": "Error"
},
"name": "Error"
},
"arguments": [
{
"type": "StringLiteral",
"start": 913,
"end": 950,
"loc": {
"start": {
"line": 48,
"column": 22
},
"end": {
"line": 48,
"column": 59
}
},
"extra": {
"rawValue": "`owner` is not type of AssetSystem!",
"raw": "'`owner` is not type of AssetSystem!'"
},
"value": "`owner` is not type of AssetSystem!"
}
]
}
}
],
"directives": []
},
"alternate": null
},
{
"type": "IfStatement",
"start": 965,
"end": 1068,
"loc": {
"start": {
"line": 50,
"column": 4
},
"end": {
"line": 52,
"column": 5
}
},
"test": {
"type": "BinaryExpression",
"start": 969,
"end": 997,
"loc": {
"start": {
"line": 50,
"column": 8
},
"end": {
"line": 50,
"column": 36
}
},