Skip to content

Commit

Permalink
Other: Retain alias order in static code for what it's worth, see #712
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Mar 22, 2017
1 parent 2a74fbf commit 88ca8f0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ static_target.description = "Static code without reflection (non-functional on i
function static_target(root, options, callback) {
config = options;
try {
if (config.comments)
push("// Common aliases");
var aliases = ["util"];
if (config.encode)
aliases.push("Writer");
var aliases = [];
if (config.decode)
aliases.push("Reader");
push((config.es6 ? "const " : "var ") + aliases.map(function(name) { return "$" + name + " = $protobuf." + name; }).join(", "));
push("");
if (config.encode)
aliases.push("Writer");
aliases.push("util");
if (aliases.length) {
if (config.comments)
push("// Common aliases");
push((config.es6 ? "const " : "var ") + aliases.map(function(name) { return "$" + name + " = $protobuf." + name; }).join(", ") + ";");
push("");
}
if (config.comments)
push("// Lazily resolved type references");
push((config.es6 ? "const" : "var") + " $lazyTypes = [];");
Expand Down

0 comments on commit 88ca8f0

Please sign in to comment.