Skip to content

Conversation

@joeldrapper
Copy link
Collaborator

No description provided.

@joeldrapper
Copy link
Collaborator Author

@willcosgrove let’s open PRs against this going forward.

joeldrapper and others added 16 commits July 8, 2025 15:55
WIP support for source maps. This doesn't include a hook to apply the
source maps to exceptions but that should be relatively easy to do later
on.

Closes #919
Input

```ruby
def view_template
	h1 { "Hello" }
	fragment :name do
		h2 { "World" }
	end
end
```

Output

```ruby
def view_template
	__phlex_state__ = @_state
	__phlex_buffer__ = __phlex_state__.buffer
	__phlex_me__ = self
	__phlex_should_render__ = __phlex_state__.should_render?; nil
	__phlex_buffer__ << "<h1>Hello</h1>" if __phlex_should_render__; nil;
	fragment :name do
		__phlex_original_should_render__ = __phlex_should_render__
		__phlex_should_render__ = __phlex_state__.should_render?;
			__phlex_buffer__ << "<h2>World</h2>" if __phlex_should_render__; nil;
		__phlex_should_render__ = __phlex_original_should_render__
	end
end
```
I didn't think there was really any optimization to be done to `raw` but
it needs to split the buffer when it's encountered.
@joeldrapper joeldrapper marked this pull request as ready for review July 9, 2025 14:35
@joeldrapper joeldrapper merged commit 8a806f8 into main Jul 9, 2025
13 checks passed
@joeldrapper joeldrapper deleted the simple-compiler branch July 9, 2025 14:36
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.

3 participants