Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/typedObjects/utils.js

Issue 5656302898380800: Issue 260 - [Typed objects] Implement type inheritance (Closed)
Patch Set: Renamed isinstance to isInstance Created May 2, 2014, 7:13 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/typedObjects/references.js ('k') | test/tests/typedObjects.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = {};
« no previous file with comments | « lib/typedObjects/references.js ('k') | test/tests/typedObjects.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld