AngelDoReMi / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

generated jsdoc should indicate that parameters are optional #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a soy template.
2. Convert it to a javascript file with --codeStyle=stringbuilder --
shouldGenerateJsdoc --shouldProvideRequireSoyNamespaces
3. Call the generated method from your own javascript but don't pass the 
optional stringbuilder.
4. Compile the resulting file with the Closure Compiler.

What is the expected output? What do you see instead?

Expected output is no warnings. Instead, I see a warning about passing 1 
argument instead of the 2 the function requires. In my case, the warning 
looks like:

fourthwall.js:482: WARNING - Function 
fourthwall.templates.drawButtonToShowPostingForm: called with 1 
argument(s). Function requires at least 2 argument(s) and no more than 2 
argument(s).

The generated JSDoc looks like:

/**
 * @param {Object.<string, *>} opt_data
 * @param {soy.StringBuilder} opt_sb
 * @return {string|undefined}
 */

The type annotations should have a trailing equals-sign to indicate the 
fact that they're optional.

What version of the product are you using? On what operating system?

I'm on windows XP, Eclipse 3.5, building with a custom ant buildfile and 
python 2.6. I don't see a version number on the closure-templates code 
anywhere.

Please provide any additional information below.

I'm a googler (nsanch), so if you want me to submit a patch, just tell me 
how. Thanks!

Original issue reported on code.google.com by nsa...@gmail.com on 25 Jan 2010 at 7:17

GoogleCodeExporter commented 8 years ago

Original comment by kai.hu...@gmail.com on 25 Jan 2010 at 8:49

GoogleCodeExporter commented 8 years ago
Hi Neil! This is really annoying, though as a workaround, you can do the 
following
for now by using the additional command line flag to SoyToJsSrcCompiler.jar:

--codeStyle CONCAT

This will probably improve performance on some browsers, but degrade it on 
others
(like IE6).

Original comment by bolinf...@gmail.com on 7 Apr 2010 at 7:25

GoogleCodeExporter commented 8 years ago

Original comment by kai.hu...@gmail.com on 7 Apr 2010 at 11:22

GoogleCodeExporter commented 8 years ago
Fixed in release 20100422.

Original comment by kai.hu...@gmail.com on 23 Apr 2010 at 9:17