UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,390 lines (1,389 loc) 293 kB
{ "type": "File", "start": 0, "end": 1476, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 73, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1476, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 73, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 58, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 58 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 } }, "local": { "type": "Identifier", "start": 7, "end": 16, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 16 }, "identifierName": "Component" }, "name": "Component" } } ], "source": { "type": "StringLiteral", "start": 22, "end": 57, "loc": { "start": { "line": 1, "column": 22 }, "end": { "line": 1, "column": 57 } }, "extra": { "rawValue": "../systems/EntitySystem/Component", "raw": "'../systems/EntitySystem/Component'" }, "value": "../systems/EntitySystem/Component" } }, { "type": "ExportDefaultDeclaration", "start": 62, "end": 1474, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 72, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 77, "end": 1474, "loc": { "start": { "line": 3, "column": 15 }, "end": { "line": 72, "column": 1 } }, "id": { "type": "Identifier", "start": 83, "end": 88, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 26 }, "identifierName": "Shape" }, "name": "Shape" }, "superClass": { "type": "Identifier", "start": 97, "end": 106, "loc": { "start": { "line": 3, "column": 35 }, "end": { "line": 3, "column": 44 }, "identifierName": "Component" }, "name": "Component" }, "body": { "type": "ClassBody", "start": 107, "end": 1474, "loc": { "start": { "line": 3, "column": 45 }, "end": { "line": 72, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 114, "end": 162, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 7, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 121, "end": 128, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 131, "end": 162, "loc": { "start": { "line": 5, "column": 19 }, "end": { "line": 7, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 138, "end": 157, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 23 } }, "argument": { "type": "NewExpression", "start": 145, "end": 156, "loc": { "start": { "line": 6, "column": 11 }, "end": { "line": 6, "column": 22 } }, "callee": { "type": "Identifier", "start": 149, "end": 154, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 6, "column": 20 }, "identifierName": "Shape" }, "name": "Shape" }, "arguments": [] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 168, "end": 251, "loc": { "start": { "line": 9, "column": 2 }, "end": { "line": 13, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 179, "end": 189, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 23 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 192, "end": 251, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 13, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 199, "end": 246, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 206, "end": 245, "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 12, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 215, "end": 238, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 29 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 215, "end": 221, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 12 }, "identifierName": "layers" }, "name": "layers" }, "value": { "type": "StringLiteral", "start": 223, "end": 238, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 29 } }, "extra": { "rawValue": "array(string)", "raw": "'array(string)'" }, "value": "array(string)" } } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 257, "end": 309, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 17, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 261, "end": 267, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 12 }, "identifierName": "layers" }, "name": "layers" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 270, "end": 309, "loc": { "start": { "line": 15, "column": 15 }, "end": { "line": 17, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 277, "end": 304, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 31 } }, "argument": { "type": "ArrayExpression", "start": 284, "end": 303, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 16, "column": 30 } }, "elements": [ { "type": "SpreadElement", "start": 286, "end": 301, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 28 } }, "argument": { "type": "MemberExpression", "start": 289, "end": 301, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 28 } }, "object": { "type": "ThisExpression", "start": 289, "end": 293, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 20 } } }, "property": { "type": "Identifier", "start": 294, "end": 301, "loc": { "start": { "line": 16, "column": 21 }, "end": { "line": 16, "column": 28 }, "identifierName": "_layers" }, "name": "_layers" }, "computed": false } } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 315, "end": 733, "loc": { "start": { "line": 19, "column": 2 }, "end": { "line": 35, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 319, "end": 325, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 12 }, "identifierName": "layers" }, "name": "layers" }, "kind": "set", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 326, "end": 331, "loc": { "start": { "line": 19, "column": 13 }, "end": { "line": 19, "column": 18 }, "identifierName": "value" }, "name": "value" } ], "body": { "type": "BlockStatement", "start": 333, "end": 733, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 35, "column": 3 } }, "body": [ { "type": "IfStatement", "start": 340, "end": 403, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 23, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 344, "end": 350, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 14 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 345, "end": 350, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 14 }, "identifierName": "value" }, "name": "value" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 352, "end": 403, "loc": { "start": { "line": 20, "column": 16 }, "end": { "line": 23, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 361, "end": 381, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 361, "end": 380, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 361, "end": 373, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 18 } }, "object": { "type": "ThisExpression", "start": 361, "end": 365, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 10 } } }, "property": { "type": "Identifier", "start": 366, "end": 373, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 18 }, "identifierName": "_layers" }, "name": "_layers" }, "computed": false }, "right": { "type": "NullLiteral", "start": 376, "end": 380, "loc": { "start": { "line": 21, "column": 21 }, "end": { "line": 21, "column": 25 } } } } }, { "type": "ReturnStatement", "start": 389, "end": 396, "loc": { "start": { "line": 22, "column": 6 }, "end": { "line": 22, "column": 13 } }, "argument": null } ], "directives": [] }, "alternate": null }, { "type": "IfStatement", "start": 411, "end": 507, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 27, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 415, "end": 440, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 33 } }, "operator": "!", "prefix": true, "argument": { "type": "BinaryExpression", "start": 417, "end": 439, "loc": { "start": { "line": 25, "column": 10 }, "end": { "line": 25, "column": 32 } }, "left": { "type": "Identifier", "start": 417, "end": 422, "loc": { "start": { "line": 25, "column": 10 }, "end": { "line": 25, "column": 15 }, "identifierName": "value" }, "name": "value" }, "operator": "instanceof", "right": { "type": "Identifier", "start": 434, "end": 439, "loc": { "start": { "line": 25, "column": 27 }, "end": { "line": 25, "column": 32 }, "identifierName": "Array" }, "name": "Array" }, "extra": { "parenthesized": true, "parenStart": 416 } }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 442, "end": 507, "loc": { "start": { "line": 25, "column": 35 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 451, "end": 500, "loc": { "start": { "line": 26, "column": 6 }, "end": { "line": 26, "column": 55 } }, "argument": { "type": "NewExpression", "start": 457, "end": 499, "loc": { "start": { "line": 26, "column": 12 }, "end": { "line": 26, "column": 54 } }, "callee": { "type": "Identifier", "start": 461, "end": 466, "loc": { "start": { "line": 26, "column": 16 }, "end": { "line": 26, "column": 21 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 467, "end": 498, "loc": { "start": { "line": 26, "column": 22 }, "end": { "line": 26, "column": 53 } }, "extra": { "rawValue": "`value` is not type of Array!", "raw": "'`value` is not type of Array!'" }, "value": "`value` is not type of Array!" } ] } } ], "directives": [] }, "alternate": null }, { "type": "ForStatement", "start": 513, "end": 692, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 32, "column": 5 } }, "init": { "type": "VariableDeclaration", "start": 518, "end": 545, "loc": { "start": { "line": 28, "column": 9 }, "end": { "line": 28, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 522, "end": 527, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 18 } }, "id": { "type": "Identifier", "start": 522, "end": 523, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 14 }, "identifierName": "i" }, "name": "i" }, "init": { "type": "NumericLiteral", "start": 526, "end": 527, "loc": { "start": { "line": 28, "column": 17 }, "end": { "line": 28, "column": 18 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, { "type": "VariableDeclarator", "start": 529, "end": 545, "loc": { "start": { "line": 28, "column": 20 }, "end": { "line": 28, "column": 36 } }, "id": { "type": "Identifier", "start": 529, "end": 530, "loc": { "start": { "line": 28, "column": 20 }, "end": { "line": 28, "column": 21 }, "identifierName": "c" }, "name": "c" }, "init": { "type": "MemberExpression", "start": 533, "end": 545, "loc": { "start": { "line": 28, "column": 24 }, "end": { "line": 28, "column": 36 } }, "object": { "type": "Identifier", "start": 533, "end": 538, "loc": { "start": { "line": 28, "column": 24 }, "end": { "line": 28, "column": 29 }, "identifierName": "value" }, "name": "value" }, "property": { "type": "Identifier", "start": 539, "end": 545, "loc": { "start": { "line": 28, "column": 30 }, "end": { "line": 28, "column": 36 }, "identifierName": "length" }, "name": "length" }, "computed": false } } ], "kind": "let" }, "test": { "type": "BinaryExpression", "start": 547, "end": 552, "loc": { "start": { "line": 28, "column": 38 }, "end": { "line": 28, "column": 43 } }, "left": { "type": "Identifier", "start": 547, "end": 548, "loc": { "start": { "line": 28, "column": 38 }, "end": { "line": 28, "column": 39 }, "identifierName": "i" }, "name": "i" }, "operator": "<", "right": { "type": "Identifier", "start": 551, "end": 552, "loc": { "start": { "line": 28, "column": 42 }, "end": { "line": 28, "column": 43 }, "identifierName": "c" }, "name": "c" } }, "update": { "type": "UpdateExpression", "start": 554, "end": 557, "loc": { "start": { "line": 28, "column": 45 }, "end": { "line": 28, "column": 48 } }, "operator": "++", "prefix": true, "argument": { "type": "Identifier", "start": 556, "end": 557, "loc": { "start": { "line": 28, "column": 47 }, "end": { "line": 28, "column": 48 }, "identifierName": "i" }, "name": "i" }, "extra": { "parenthesizedArgument": false } }, "body": { "type": "BlockStatement", "start": 559, "end": 692, "loc": { "start": { "line": 28, "column": 50 }, "end": { "line": 32, "column": 5 } }, "body": [ { "type": "IfStatement", "start": 568, "end": 685, "loc": { "start": { "line": 29, "column": 6 }, "end": { "line": 31, "column": 7 } }, "test": { "type": "BinaryExpression", "start": 572, "end": 600, "loc": { "start": { "line": 29, "column": 10 }, "end": { "line": 29, "column": 38 } }, "left": { "type": "UnaryExpression", "start": 572, "end": 587, "loc": { "start": { "line": 29, "column": 10 }, "end": { "line": 29, "column": 25 } }, "operator": "typeof", "prefix": true, "argument": { "type": "MemberExpression", "start": 579, "end": 587, "loc": { "start": { "line": 29, "column": 17 }, "end": { "line": 29, "column": 25 } }, "object": { "type": "Identifier", "start": 579, "end": 584, "loc": { "start": { "line": 29, "column": 17 }, "end": { "line": 29, "column": 22 }, "identifierName": "value" }, "name": "value" }, "property": { "type": "Identifier", "start": 585, "end": 586, "loc": { "start": { "line": 29, "column": 23 }, "end": { "line": 29, "column": 24 }, "identifierName": "i" }, "name": "i" }, "computed": true }, "extra": { "parenthesizedArgument": false } }, "operator": "!==", "right": { "type": "StringLiteral", "start": 592, "end": 600, "loc": { "start": { "line": 29, "column": 30 }, "end": { "line": 29, "column": 38