diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-02-04 16:11:07 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2016-02-18 10:30:21 -0800 |
commit | 77af5d04b1897baeda2ebd753d138c99afe72c50 (patch) | |
tree | 60a26239352658db80b87262315659c5202e31f6 /src | |
parent | d6a186a8f18c1b14979e0244c0434b5b89c0f8a9 (diff) | |
download | protobuf-77af5d04b1897baeda2ebd753d138c99afe72c50.tar.gz protobuf-77af5d04b1897baeda2ebd753d138c99afe72c50.tar.bz2 protobuf-77af5d04b1897baeda2ebd753d138c99afe72c50.zip |
Fixed nested message scopes for CommonJS.
Diffstat (limited to 'src')
-rwxr-xr-x | src/google/protobuf/compiler/js/js_generator.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc index 2dea60fa..7ebb9b12 100755 --- a/src/google/protobuf/compiler/js/js_generator.cc +++ b/src/google/protobuf/compiler/js/js_generator.cc @@ -1466,13 +1466,6 @@ void Generator::GenerateClass(const GeneratorOptions& options, GenerateClassExtensionFieldInfo(options, printer, desc); } - if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) { - printer->Print( - "exports.$name$ = $fullName$;\n", - "name", desc->name(), - "fullName", GetPath(options, desc)); - } - if (options.import_style != GeneratorOptions:: IMPORT_CLOSURE) { for (int i = 0; i < desc->extension_count(); i++) { GenerateExtension(options, printer, desc->extension(i)); @@ -2552,6 +2545,11 @@ void Generator::GenerateFile(const GeneratorOptions& options, for (int i = 0; i < file->extension_count(); i++) { GenerateExtension(options, printer, file->extension(i)); } + + if (options.import_style == GeneratorOptions::IMPORT_COMMONJS) { + printer->Print("goog.object.extend(exports, $package$);\n", + "package", GetPath(options, file)); + } } bool Generator::GenerateAll(const vector<const FileDescriptor*>& files, |