FWIW, it might be possible to teach the compiler to check for types.

FalconJX already knows how to copy the asdoc from the .AS file to the .JS
file.  However, there are currently assumptions about the format of
@params.  Any @param found in the asdoc is renamed to @asparam and the
compiler generates the @param based on the AS type used.

We could add other custom tags like @jsparam that is the format used by
Google Closure Compiler that lists the allowed types of a parameter
{Function|String} and output that instead of the AS type.  Just doing that
should then cause the Google Closure Compiler to output errors at the end
of the cross-compile.

Teaching the SWF compiler to handle @jsparam would be a lot of work.  The
SWF compiler does know about ArrayElementType metadata.  We could define
some other metadata that defines sets of types somehow.  And those could
factor into the @param in the JSDoc.  That would be a medium-sized chunk
of work.

-Alex

On 11/11/15, 10:39 AM, "Alex Harui" <aha...@adobe.com> wrote:

>The compiler sees Qname as having a single constructor with two params of
>type ‘*’.
>
>I don’t know what trick was used to get ASDoc to show two constructors.
>
>HTH,
>-Alex
>
>On 11/11/15, 9:37 AM, "Alex Harui" <aha...@adobe.com> wrote:
>
>>
>>
>>On 11/11/15, 3:02 AM, "Harbs" <harbs.li...@gmail.com> wrote:
>>
>>>IFAIK, ActionScript does not have multiple constructors. I’m wondering
>>>if
>>>there’s any way to simulate multiple constructors when cross-compiling
>>>to
>>>js.
>>>
>>>What prompted my questions is QName. QName has two different
>>>constructors. One takes a QName object, and the other takes uri and a
>>>localName. I was windering if there’s a way to get that effect with
>>>type-checking. The only way I can think of to support that would be to
>>>take a wildcard argument for the first argument (and do runtime
>>>checking)
>>>and make the second one optional.
>>>
>>>Does anyone have better ideas?
>>
>>That’s interesting.  I’m going to spend some time trying to figure out
>>how
>>Qname is defined in PlayerGlobal.
>>
>

Reply via email to