Mistakenly placing ; in the middle of class definition, like this:
let hudObject = {
bbb: {
x: 1
},
updateStep: function(deltaTime) {
};
aaa: function() {
}
};
puts("HUD object loaded");
makes an error
[Exception(EPOCASyntaxError["poca/hud.poca"):8,2]: Bad hash initializer
Can we improve the message, to make it clearer that the syntax is incorrect, ; is unexpected here?
Looking at what JS does in this situation:
-
Firefox JS engine answers
Uncaught SyntaxError: missing } after property list
note: { opened at line 1, column 17
-
https://runjs.app/play answers even better, pointing to the right solution:
SyntaxError: Unexpected token, expected "," (7:3)