fix: avoid variable shadowing in nested mixin calls with same parameter name
When a mixin calls another mixin passing a variable with the same name as the parameter (e.g., +alert(message) where alert has param message), skip generating redundant const declaration since the variable is already in scope. Also adds missing alert.pug mixin for demo project.
This commit is contained in:
5
examples/demo/views/mixins/alert.pug
Normal file
5
examples/demo/views/mixins/alert.pug
Normal file
@@ -0,0 +1,5 @@
|
||||
mixin alert(message)
|
||||
div.alert(role="alert" class!=attributes.class)
|
||||
svg(xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24")
|
||||
path(stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z")
|
||||
span= message
|
||||
2
examples/demo/views/mixins/alert_error.pug
Normal file
2
examples/demo/views/mixins/alert_error.pug
Normal file
@@ -0,0 +1,2 @@
|
||||
mixin alert_error(message)
|
||||
+alert(message)(class="alert-error")
|
||||
@@ -24,3 +24,5 @@ block content
|
||||
br
|
||||
+input_text("lastName", "Last Name", "last name")
|
||||
submit sumit
|
||||
if error
|
||||
+alert_error(error)
|
||||
|
||||
Reference in New Issue
Block a user