Skip to content

Execute class body lambda in outer context#1542

Merged
BCSharp merged 2 commits intoIronLanguages:masterfrom
BCSharp:class_context
Sep 1, 2022
Merged

Execute class body lambda in outer context#1542
BCSharp merged 2 commits intoIronLanguages:masterfrom
BCSharp:class_context

Conversation

@BCSharp
Copy link
Copy Markdown
Member

@BCSharp BCSharp commented Aug 31, 2022

Part of #20.

The "outer context" is basically a local context but created outside of the class lambda. I call it "class context" rather than "local context" because, strictly speaking, the class lambda still creates its own local context inside. The content of both class and local contexts is the same, except that the latter contains the __class__ variable, if present. I kept the creation of the local context like this since the machinery to handle it is in ScopeStatement, which servers all scope-creating constructs: class, function, comprehensions, generators, and AST root, so it was easier to implement it this way. Besides, having a separate context without __class__ may be useful, I remember in the past having to filter __class__ out explicitly on some occasions. Perhaps this can be simplified now.

Incidentally, this PR removed some old and obscure incompatibly with CPython (test_sys_getframe); I take it as a sign that the changes are going in the right direction.

Copy link
Copy Markdown
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@BCSharp BCSharp merged commit 5444c39 into IronLanguages:master Sep 1, 2022
@BCSharp BCSharp deleted the class_context branch September 1, 2022 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants