apache / apache/royale-compiler

ASDoc comments should be ignored (as if they were regular comments) when they appear in unexpected places

Open
#189 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
113
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Example:

```as3
package
{
public class CommentInsideFunctionParameters
{
public function CommentInsideFunctionParameters(param:Object=null /** asdoc comment is bad? **/)
{
}
}
}
```

The Royale compiler gives the following error, but the Flex SDK compiler treated it as a normal comment:

> ')' is not allowed here

But this code gives no errors:

```as3
package
{
public class CommentInsideFunctionParameters
{
public function CommentInsideFunctionParameters(param:Object=null /* regular comment is okay! */)
{
}
}
}
```

RawASTokenizer.lex creates a TOKEN_ASDOC_COMMENT for asdic comments, but it doesn't create a token for regular comments (unless a particular flag is enabled). ASParser.g can handle this token in a few places, but if it encounters the token somewhere it doesn't expect, it results in the error above.

In the case above, `formalParameters` or `formal` in ASParser.g is where the ASDoc comment is unexpected, and that might be easy enough to work around, but there are many other places where you could try to add an ASDoc comment, and it would also result in errors.

A real fix may involve adding a new flag to ignore ASDoc comments (in the same way that regular comments are ignored or parsed), except when they are actually needed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.