munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.79k stars 1.03k forks source link

clox: The `name` field of `ClassCompiler` is never used #943

Closed ceronman closed 3 years ago

ceronman commented 3 years ago

When defining the ClassCompiler struct in chapter 28, there is a name field.

typedef struct ClassCompiler {
  struct ClassCompiler* enclosing;
  Token name;
} ClassCompiler;

I have not found any use of this name field anywhere. Perhaps just remove it completely? Or perhaps it could be used to provide some better error messages in some places.

munificent commented 3 years ago

Oh, wow. How did I never notice this? That field must have come along when I ported the VM from Wren and I never noticed that I wasn't using the name in error messages anymore.