aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/gulpfile.js4
-rw-r--r--js/package.json2
-rwxr-xr-xsrc/google/protobuf/compiler/js/js_generator.cc9
3 files changed, 13 insertions, 2 deletions
diff --git a/js/gulpfile.js b/js/gulpfile.js
index bdc4212b..d8f8ef4a 100644
--- a/js/gulpfile.js
+++ b/js/gulpfile.js
@@ -88,3 +88,7 @@ gulp.task('test_commonjs', ['make_commonjs_out'], function (cb) {
cb(err);
});
});
+
+gulp.task('test', ['test_closure', 'test_commonjs'], function(cb) {
+ cb();
+});
diff --git a/js/package.json b/js/package.json
index d37da1dd..6418e507 100644
--- a/js/package.json
+++ b/js/package.json
@@ -13,7 +13,7 @@
"glob": "~6.0.4"
},
"scripts": {
- "test": "./node_modules/gulp/bin/gulp.js test_closure"
+ "test": "./node_modules/gulp/bin/gulp.js test"
},
"repository": {
"type": "git",
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index 7ebb9b12..351c3966 100755
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -2530,8 +2530,15 @@ void Generator::GenerateFile(const GeneratorOptions& options,
// // Later generated code expects foo.bar = {} to exist:
// foo.bar.Baz = function() { /* ... */ }
std::set<std::string> provided;
+
+ // Cover the case where this file declares extensions but no messages.
+ // This will ensure that the file-level object will be declared to hold
+ // the extensions.
+ for (int i = 0; i < file->extension_count(); i++) {
+ provided.insert(file->extension(i)->full_name());
+ }
+
FindProvidesForFile(options, printer, file, &provided);
- //FindProvidesForFields(options, printer, extensions, &provided);
for (std::set<string>::iterator it = provided.begin();
it != provided.end(); ++it) {
printer->Print("goog.exportSymbol('$name$', null, global);\n",