Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add delete check and fix nested class parsing for private fields #589
This PR adds a check to make sure the
This also fixes an issue where private fields fail to be parsed when a method within the class contains a nested class.
Given that private fields can only be used within classes, any code using them must be in a strict mode context. As private fields cannot be deleted, throw an early SyntaxError.
The parsing of private fields checks whether or not it is within a class to determine if it is valid or not. However, the state.inClass property is incorrect as it marks it as outside a class when the inner class is closed. This commit fixes this problem by replacing the state.inClass property with a class nesting counter.