From e294ca186814fe1f180486141cb674ef138be036 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Fri, 8 Aug 2014 18:02:47 +0200 Subject: [PATCH] Keep track of all symbols This avoids that we add parent namespaces of symbols that were already added because they have their own definition in the externs. --- tasks/generate-externs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/generate-externs.js b/tasks/generate-externs.js index 0fbd7bb050..e98cfbf56b 100644 --- a/tasks/generate-externs.js +++ b/tasks/generate-externs.js @@ -36,7 +36,7 @@ function getInfo(callback) { */ function generateExterns(typedefs, symbols, externs) { var lines = []; - var namespaces = {}; + var processedSymbols = {}; var constructors = {}; function addNamespaces(name) { @@ -46,7 +46,7 @@ function generateExterns(typedefs, symbols, externs) { parts.forEach(function(part) { namespace.push(part); var partialNamespace = namespace.join('.'); - if (!(partialNamespace in namespaces || + if (!(partialNamespace in processedSymbols || partialNamespace in constructors)) { lines.push('/**'); lines.push(' * @type {Object}'); @@ -58,8 +58,8 @@ function generateExterns(typedefs, symbols, externs) { } function nameToJS(name) { + processedSymbols[name] = true; if (name.indexOf('.') == -1) { - namespaces[name] = true; name = 'var ' + name; } return name;