summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Wallace <evan.exe@gmail.com>2015-10-14 21:25:16 -0700
committerEvan Wallace <evan.exe@gmail.com>2015-10-14 23:06:58 -0700
commit79222bf100aed80940efab986a84904e2bdc8e0e (patch)
tree1235e87cc61acd22af41f676dbc7c4777003970f
parentc3bfefca57d44825cd9c7c143b44f0393bfa4b43 (diff)
downloadflatbuffers-79222bf100aed80940efab986a84904e2bdc8e0e.tar.gz
flatbuffers-79222bf100aed80940efab986a84904e2bdc8e0e.tar.bz2
flatbuffers-79222bf100aed80940efab986a84904e2bdc8e0e.zip
Update monster_test_generated.js baseline after rebase
-rw-r--r--src/idl_gen_js.cpp7
-rw-r--r--tests/monster_test.bfbsbin2744 -> 2784 bytes
-rw-r--r--tests/monster_test_generated.js48
3 files changed, 52 insertions, 3 deletions
diff --git a/src/idl_gen_js.cpp b/src/idl_gen_js.cpp
index d46f4117..0e95830d 100644
--- a/src/idl_gen_js.cpp
+++ b/src/idl_gen_js.cpp
@@ -579,8 +579,11 @@ static void GenStruct(const Parser &parser, StructDef &struct_def,
code += " builder.startVector(" + NumToString(elem_size);
code += ", data.length, " + NumToString(alignment) + ");\n";
code += " for (var i = data.length - 1; i >= 0; i--) {\n";
- code += " builder.add" + GenWriteMethod(vector_type);
- code += "(data[i]);\n";
+ code += " builder.add" + GenWriteMethod(vector_type) + "(";
+ if (vector_type.base_type == BASE_TYPE_BOOL) {
+ code += "+";
+ }
+ code += "data[i]);\n";
code += " }\n";
code += " return builder.endVector();\n";
code += "};\n\n";
diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs
index e5f51fac..8d54ead7 100644
--- a/tests/monster_test.bfbs
+++ b/tests/monster_test.bfbs
Binary files differ
diff --git a/tests/monster_test_generated.js b/tests/monster_test_generated.js
index 39cd3d2e..5687308e 100644
--- a/tests/monster_test_generated.js
+++ b/tests/monster_test_generated.js
@@ -632,10 +632,27 @@ MyGame.Example.Monster.prototype.testhashu64Fnv1a = function() {
};
/**
+ * @param {number} index
+ * @returns {boolean}
+ */
+MyGame.Example.Monster.prototype.testarrayofbools = function(index) {
+ var offset = this.bb.__offset(this.bb_pos, 52);
+ return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false;
+};
+
+/**
+ * @returns {number}
+ */
+MyGame.Example.Monster.prototype.testarrayofboolsLength = function() {
+ var offset = this.bb.__offset(this.bb_pos, 52);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+};
+
+/**
* @param {flatbuffers.Builder} builder
*/
MyGame.Example.Monster.startMonster = function(builder) {
- builder.startObject(24);
+ builder.startObject(25);
};
/**
@@ -916,6 +933,35 @@ MyGame.Example.Monster.addTesthashu64Fnv1a = function(builder, testhashu64Fnv1a)
/**
* @param {flatbuffers.Builder} builder
+ * @param {flatbuffers.Offset} testarrayofboolsOffset
+ */
+MyGame.Example.Monster.addTestarrayofbools = function(builder, testarrayofboolsOffset) {
+ builder.addFieldOffset(24, testarrayofboolsOffset, 0);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
+ * @param {Array.<boolean>} data
+ * @returns {flatbuffers.Offset}
+ */
+MyGame.Example.Monster.createTestarrayofboolsVector = function(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (var i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(+data[i]);
+ }
+ return builder.endVector();
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
+ * @param {number} numElems
+ */
+MyGame.Example.Monster.startTestarrayofboolsVector = function(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+};
+
+/**
+ * @param {flatbuffers.Builder} builder
* @returns {flatbuffers.Offset}
*/
MyGame.Example.Monster.endMonster = function(builder) {