Skip to content
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

Properly evaluate instance properties #122

Merged
merged 4 commits into from
Oct 18, 2023
Merged

Properly evaluate instance properties #122

merged 4 commits into from
Oct 18, 2023

Conversation

kaidesu
Copy link
Member

@kaidesu kaidesu commented Oct 18, 2023

Properly evaluates class instance properties. You can now assign properties directly within the constructor:

class Circle {
  function constructor(area = 5) {
    this.area = area
  }

  function area() {
    return math.pi * this.area * this.area
  }
}

circle = Circle.new(10)

print(circle.area())

// 314.1592653589793

Closes #119

@kaidesu kaidesu merged commit ba16400 into 1.0 Oct 18, 2023
1 check passed
@kaidesu kaidesu deleted the bug/119 branch October 18, 2023 03:49
pairs := make(map[object.MapKey]object.MapPair)

fmt.Printf("self: %v\n", scope.Self)

Copy link

Choose a reason for hiding this comment

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

This probably doesn't need to remain here..

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching this! This has been cleaned up.

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.

Class with constructor got issue
2 participants