-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Default for enums as well #128
Feature: Default for enums as well #128
Conversation
@@ -267,6 +267,14 @@ export function createBinder(program: Program, options: BinderOptions = {}): Bin | |||
|
|||
function bindEnumStatement(node: EnumStatementNode) { | |||
declareSymbol(getContainingSymbolTable(), node, node.id.sv); | |||
node.locals = createSymbolTable(); | |||
for (const enumMember of node.members) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good first step but if we add enum members dynamically we won't get a symbol for it. You could imagine doing late-bound symbols for this, initializing the bindings in the symbol table when the enum type is instantiated. Think that's worth doing here?
I think this is good. But one issue gives me a bit of pause - in projections, I am currently using There's another thing to think about too - given an enum like I think we should wait on this and make sure we consider the enum and model use cases together and come to an understanding on what |
@bterlson yeah that make sense, should wait until we figure everything out. Created an issue for this so we don't forget. The way I was thinking about it was to point to the member itself not the value but I guess this is also a question for the subtype/supertype relation.
|
Seperating this pr from the unions(include the union change) as it require a change to the binding and reference resolving
@bterlson if you have time to take a look and confirm this is how I should be using the binders and locals.
Azure/cadl-azure#1041