Skip to content

Commit 88ca8f0

Browse files
committed
Other: Retain alias order in static code for what it's worth, see #712
1 parent 2a74fbf commit 88ca8f0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Diff for: cli/targets/static.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ static_target.description = "Static code without reflection (non-functional on i
2424
function static_target(root, options, callback) {
2525
config = options;
2626
try {
27-
if (config.comments)
28-
push("// Common aliases");
29-
var aliases = ["util"];
30-
if (config.encode)
31-
aliases.push("Writer");
27+
var aliases = [];
3228
if (config.decode)
3329
aliases.push("Reader");
34-
push((config.es6 ? "const " : "var ") + aliases.map(function(name) { return "$" + name + " = $protobuf." + name; }).join(", "));
35-
push("");
30+
if (config.encode)
31+
aliases.push("Writer");
32+
aliases.push("util");
33+
if (aliases.length) {
34+
if (config.comments)
35+
push("// Common aliases");
36+
push((config.es6 ? "const " : "var ") + aliases.map(function(name) { return "$" + name + " = $protobuf." + name; }).join(", ") + ";");
37+
push("");
38+
}
3639
if (config.comments)
3740
push("// Lazily resolved type references");
3841
push((config.es6 ? "const" : "var") + " $lazyTypes = [];");

0 commit comments

Comments
 (0)