Index: lib/typedObjects/utils.js |
=================================================================== |
--- a/lib/typedObjects/utils.js |
+++ b/lib/typedObjects/utils.js |
@@ -86,27 +86,30 @@ let getViewsForType = exports.getViewsFo |
} |
return result; |
}; |
/** |
* Defines properties with given name and type on an object. |
* |
* @param obj object to define properties on |
- * @param propList array of properties where each property is represented by |
- * [name, type] |
+ * @param properties object mapping property names to their respective types |
* @param viewTypes see getViewsForType() |
* @param views see getViewsForType() |
* @param [offset] byte array offset at which the properties should start |
* @return new start offset for additional properties |
*/ |
-exports.defineProperties = function defineProperties(obj, propList, viewTypes, views, offset) |
+exports.defineProperties = function defineProperties(obj, properties, viewTypes, views, offset) |
{ |
offset = offset | 0; |
+ let propList = []; |
+ for (let name in properties) |
+ propList.push([name, properties[name]]); |
+ |
// Put larger properties first to make sure alignment requirements are met. |
propList.sort(function(a, b) |
{ |
return b[1].referenceLength - a[1].referenceLength; |
}); |
// Generates getters and setters for each property. |
let descriptors = {}; |