Index: lib/typedObjects/references.js |
=================================================================== |
--- a/lib/typedObjects/references.js |
+++ b/lib/typedObjects/references.js |
@@ -16,45 +16,46 @@ |
*/ |
"use strict"; |
let {nextPow2, defineProperties} = require("typedObjects/utils"); |
let {uint16, int16, uint32} = require("typedObjects/primitiveTypes"); |
let {fixedPropertyDescriptor} = require("typedObjects/utils"); |
-function calculateSize(propList) |
+function calculateSize(properties) |
{ |
let result = 0; |
- for (let i = 0, l = propList.length | 0; i < l; i++) |
- result += propList[i][1].referenceLength; |
- return nextPow2(result); |
+ for (let name in properties) |
+ result += properties[name].referenceLength | 0; |
+ return nextPow2(result) | 0; |
} |
-function getViewTypes(propList) |
+function getViewTypes(properties) |
{ |
let result = []; |
- for (let i = 0, l = propList.length | 0; i < l; i++) |
+ for (let name in properties) |
{ |
- let requiredViews = propList[i][1].viewTypes; |
- for (let j = 0, ll = requiredViews.length | 0; j < ll; j++) |
- if (result.indexOf(requiredViews[j]) < 0) |
- result.push(requiredViews[j]); |
+ let requiredViews = properties[name].viewTypes; |
+ for (let i = 0, l = requiredViews.length | 0; i < l; i++) |
+ if (result.indexOf(requiredViews[i]) < 0) |
+ result.push(requiredViews[i]); |
} |
return result; |
} |
-let TypedReference_properties = [ |
- ["targetBufferIndex", int16], |
- ["targetByteOffset", uint32] |
-]; |
+let TypedReference_properties = { |
+ targetBufferIndex: int16, |
+ targetByteOffset: uint32 |
+}; |
-let Reference_properties = [ |
- ["typeId", int16] |
-].concat(TypedReference_properties); |
+let Reference_properties = { |
+ __proto__: TypedReference_properties, |
+ typeId: int16 |
+}; |
/** |
* Helper class to read/write properties referencing other objects. bufferIndex |
* and byteOffset properties of the reference need to be set in order to use it. |
* |
* @param types list of registered object types used to resolve typeId |
* @param views list of views corresponding to Reference.viewTypes |
*/ |