-
-
Notifications
You must be signed in to change notification settings - Fork 102
Prototype Compiler #916
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
Prototype Compiler #916
Conversation
| def initialize(compiler) | ||
| @compiler = compiler | ||
| @mutations = [] | ||
| @in_scope = true |
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 tracks if we may have gone out of scope via a block to an unknown method. Out of scope, we need to use a conditional to check that we’re in scope at runtime. Example
10.times do
if self == component_instance
# compiled code here
else
# original code here
end
end| def visit_def_node(node) | ||
| Phlex::Compiler::MethodCompiler.new(@compiler).compile(node) | ||
| end |
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.
We may need to check the receiver of this method definition. Not sure if this node would be triggered for something like def Foo.bar
| end | ||
|
|
||
| def visit_class_node(node) | ||
| if @compiler.line == node.location.start_line |
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.
It’s possible to define more than one class on a single line, so we should also check the name.
| [ | ||
| node.location.start_offset, | ||
| node.location.length, | ||
| [:buffer, "<h1></h1>"], |
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.
These array allocations aren’t necessary, we should just have a type symbol in the outer array.
No description provided.