[Resolved]: I2HW: Nested methods

I’m converting an Imba 1 project to Imba 2, and I’m realizing that I used to nest methods, but now it doesn’t work. It will say “(name of method) is not defined” when I run a nested method.

In the example below when I run indirectMethod, I will get an error saying “nestedMethod” is not defined.

Is this proper behavior, or is it a bug?

tag app-root
	@score = 0
	def directMethod
		@score++
	def indirectMethod
		nestedMethod
	def nestedMethod
		@score++
	def reset
		@score = 0
	def render
		<self>
			<button :click.reset> "reset"
			<button :click.directMethod> "direct"
			<button :click.indirectMethod> "indirect"
			<h1> @score
### css
button, h1 {
	margin: 1rem;
}

###

SCRIMBA: https://scrimba.com/c/c8rQ8QcZ
@somebee

Implicit self is no longer the default behaviour so you need to add self. prefix on the method call.

	def indirectMethod
		self.nestedMethod()

ahh. gotcha. i failed to understand that.