apache / apache/royale-asjs

Block comments that start with /** confuse compiler

Open
#368 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

I notice that when using a block comment that begins with `/**`, the compiler spits out some confusing errors. Here's a small example:

```
package {
public class Main {

public function Main () {

console.log("Hi Royale!");
}

public function testSwitch(name:String):Number {
switch(name) {
/**
* IF I REMOVE THIS COMMENT, COMPILATION WORKS
*/
case "why-you-no-like-me-bro?":
break;
default:
return 0;
}
return 1;
}
}
}
```

When I compile this code using `asjsc -debug=true --targets=js src/Main.as`, I get the following compile errors:
```
src/Main.as(14): col: 35 Syntax error: Label must be a simple identifier.

case "why-you-no-like-me-bro?":
^

src/Main.as(15): col: 6 Error: Target of break statement was not found.

break;
^

src/Main.as(16): col: 5 Syntax error: Expected SCOPE_CLOSE but got 'default'

default:
^
```

If I remove the comment in that code, or change from `/**` to `/*`, compilation proceeds as normal.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the example in src/Main.as using `asjsc -debug=true --targets=js src/Main.as`. Compare compilation with the `/**` comment, with the comment removed, and with `/*`; done means the original form compiles without the reported label, break, or scope errors.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.