Use {*} instead of {goog.*} types in externs file
This commit is contained in:
@@ -65,6 +65,14 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function noGoogTypes(typesWithGoog) {
|
||||||
|
typesWithoutGoog = [];
|
||||||
|
typesWithGoog.forEach(function(type) {
|
||||||
|
typesWithoutGoog.push(type.replace(/^goog\..*$/, '*'));
|
||||||
|
});
|
||||||
|
return typesWithoutGoog;
|
||||||
|
}
|
||||||
|
|
||||||
function processSymbol(symbol) {
|
function processSymbol(symbol) {
|
||||||
addNamespaces(symbol.name.split('#')[0]);
|
addNamespaces(symbol.name.split('#')[0]);
|
||||||
|
|
||||||
@@ -88,7 +96,7 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
lines.push(' * @constructor');
|
lines.push(' * @constructor');
|
||||||
}
|
}
|
||||||
if (symbol.types) {
|
if (symbol.types) {
|
||||||
lines.push(' * @type {' + symbol.types.join('|') + '}');
|
lines.push(' * @type {' + noGoogTypes(symbol.types).join('|') + '}');
|
||||||
}
|
}
|
||||||
var args = [];
|
var args = [];
|
||||||
if (symbol.params) {
|
if (symbol.params) {
|
||||||
@@ -96,13 +104,13 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
args.push(param.name);
|
args.push(param.name);
|
||||||
lines.push(' * @param {' +
|
lines.push(' * @param {' +
|
||||||
(param.variable ? '...' : '') +
|
(param.variable ? '...' : '') +
|
||||||
param.types.join('|') +
|
noGoogTypes(param.types).join('|') +
|
||||||
(param.optional ? '=' : '') +
|
(param.optional ? '=' : '') +
|
||||||
'} ' + param.name);
|
'} ' + param.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (symbol.returns) {
|
if (symbol.returns) {
|
||||||
lines.push(' * @return {' + symbol.returns.join('|') + '}');
|
lines.push(' * @return {' + noGoogTypes(symbol.returns).join('|') + '}');
|
||||||
}
|
}
|
||||||
if (symbol.template) {
|
if (symbol.template) {
|
||||||
lines.push(' * @template ' + symbol.template);
|
lines.push(' * @template ' + symbol.template);
|
||||||
@@ -121,7 +129,7 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
typedefs.forEach(function(typedef) {
|
typedefs.forEach(function(typedef) {
|
||||||
addNamespaces(typedef.name);
|
addNamespaces(typedef.name);
|
||||||
lines.push('/**');
|
lines.push('/**');
|
||||||
lines.push(' * @typedef {' + typedef.types.join('|') + '}');
|
lines.push(' * @typedef {' + noGoogTypes(typedef.types).join('|') + '}');
|
||||||
lines.push(' */');
|
lines.push(' */');
|
||||||
lines.push(nameToJS(typedef.name) + ';');
|
lines.push(nameToJS(typedef.name) + ';');
|
||||||
lines.push('\n');
|
lines.push('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user