Merge pull request #384 from elemoine/optional

Exports fixes
This commit is contained in:
Éric Lemoine
2013-03-15 14:26:05 -07:00
3 changed files with 11 additions and 12 deletions

View File

@@ -52,9 +52,16 @@ class Class(Exportable):
lines.append(' * @param {%s} options Options.\n' % (self.object_literal.extern_name(),))
lines.append(' */\n')
lines.append('%sExport = function(options) {\n' % (self.name,))
lines.append(' goog.base(this, {')
lines.extend(','.join('\n %s: options.%s' % (key, key) for key in sorted(self.object_literal.prop_types.keys())))
lines.append('\n });\n')
lines.append(' /** @type {%s} */\n' % (self.object_literal.name,))
lines.append(' var arg;\n');
lines.append(' if (goog.isDefAndNotNull(options)) {\n')
lines.append(' arg = {')
lines.extend(','.join('\n %s: options.%s' % (key, key) for key in sorted(self.object_literal.prop_types.keys())))
lines.append('\n };\n')
lines.append(' } else {\n')
lines.append(' arg = /** @type {%s} */ (options);\n' % (self.object_literal.name,))
lines.append(' }\n')
lines.append(' goog.base(this, arg);\n')
lines.append('};\n')
lines.append('goog.inherits(%sExport, %s);\n' % (self.name, self.name))
lines.append('goog.exportSymbol(\n')

View File

@@ -129,7 +129,7 @@
@exportObjectLiteral ol.source.SourceOptions
@exportObjectLiteralProperty ol.source.SourceOptions.attributions Array.<ol.Attribution>|undefined
@exportObjectLiteralProperty ol.source.SourceOptions.extent ol.Extent|undefined
@exportObjectLiteralProperty ol.source.SourceOptions.projection ol.Projection|undefined
@exportObjectLiteralProperty ol.source.SourceOptions.projection ol.ProjectionLike
@exportObjectLiteral ol.source.StamenOptions
@exportObjectLiteralProperty ol.source.StamenOptions.layer string

View File

@@ -8,14 +8,6 @@ goog.require('ol.Extent');
goog.require('ol.projection');
/**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* extent: (ol.Extent|undefined),
* projection: ol.ProjectionLike}}
*/
ol.source.SourceOptions;
/**
* @constructor