aboutsummaryrefslogtreecommitdiff
path: root/src/embind
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-04-01 17:54:55 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:27:01 +0300
commitde48fdc5b028df627b7070c17d37479654f71a13 (patch)
tree95d965e3a9a94506947e5cc187e5096de49cf72e /src/embind
parente30dd3017a318d1f5862bd3688679c687c66d621 (diff)
Further generalize support for tuple elements, and in the meantime, fix a bug that made it into one variant of the function but not the other...
Diffstat (limited to 'src/embind')
-rwxr-xr-xsrc/embind/embind.js38
1 files changed, 5 insertions, 33 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 845bf98b..3daa4b01 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -388,37 +388,6 @@ function __embind_register_tuple(rawType, name, rawConstructor, rawDestructor) {
function __embind_register_tuple_element(
rawTupleType,
- rawType,
- getter,
- setter,
- context
-) {
- getter = FUNCTION_TABLE[getter];
- setter = FUNCTION_TABLE[setter];
- var tupleType = requireRegisteredType(rawTupleType, 'tuple');
-
- var index = tupleType.elements.length;
- tupleType.elements.push(undefined);
-
- // TODO: test incomplete registration of value tuples
- whenDependentTypesAreResolved([], [rawType], function(type) {
- type = type[0];
- tupleType.elements[index] = {
- read: function(ptr) {
- return type.fromWireType(getter(context, ptr));
- },
- write: function(ptr, o) {
- var destructors = [];
- setter(context, ptr, type.toWireType(destructors, o));
- runDestructors(destructors);
- }
- };
- return [];
- });
-}
-
-function __embind_register_tuple_element_accessor(
- rawTupleType,
getterReturnType,
getter,
getterContext,
@@ -430,11 +399,14 @@ function __embind_register_tuple_element_accessor(
getter = FUNCTION_TABLE[getter];
setter = FUNCTION_TABLE[setter];
+ var index = tupleType.elements.length;
+ tupleType.elements.push(undefined);
+
// TODO: test incomplete registration of value tuples
whenDependentTypesAreResolved([], [getterReturnType, setterArgumentType], function(types) {
var getterReturnType = types[0];
var setterArgumentType = types[1];
- tupleType.elements.push({
+ tupleType.elements[index] = {
read: function(ptr) {
return getterReturnType.fromWireType(
getter(
@@ -449,7 +421,7 @@ function __embind_register_tuple_element_accessor(
setterArgumentType.toWireType(destructors, o));
runDestructors(destructors);
}
- });
+ };
return [];
});
}