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

Support method missing #672

Merged
merged 5 commits into from
May 22, 2018
Merged

Support method missing #672

merged 5 commits into from
May 22, 2018

Conversation

st0012
Copy link
Member

@st0012 st0012 commented May 21, 2018

Not support method_missing's inheritance but support singleton class' method_missing

@st0012 st0012 added this to the version 0.1.10 milestone May 21, 2018
@st0012 st0012 self-assigned this May 21, 2018
@ghost ghost added the in progress label May 21, 2018
// TODO: Improve this
t.Stack.Push(&Pointer{Target: nil})

for i := argCount - 1; i >= 0; i-- {
Copy link
Member Author

Choose a reason for hiding this comment

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

@eliothedeman @saveriomiroddi Because we need to append method's name as first argument, so we have an O(n) operation here. I'd be very happy if anyone can solve this elegantly

@codecov
Copy link

codecov bot commented May 21, 2018

Codecov Report

Merging #672 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #672      +/-   ##
==========================================
+ Coverage   81.82%   81.86%   +0.04%     
==========================================
  Files          57       57              
  Lines        7708     7725      +17     
==========================================
+ Hits         6307     6324      +17     
  Misses       1132     1132              
  Partials      269      269
Impacted Files Coverage Δ
vm/instruction.go 92.6% <100%> (+0.24%) ⬆️
vm/object.go 82% <100%> (+2.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54255dd...bfd36be. Read the comment docs.

@@ -604,39 +625,39 @@ var builtinActions = map[operationType]*action{
},
}

func (vm *VM) InitObjectFromGoType(value interface{}) Object {
switch v := value.(type) {
func (v *VM) InitObjectFromGoType(value interface{}) Object {

Choose a reason for hiding this comment

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

exported method VM.InitObjectFromGoType should have comment or be unexported

@@ -604,39 +625,39 @@ var builtinActions = map[operationType]*action{
},
}

func (vm *VM) InitObjectFromGoType(value interface{}) Object {
switch v := value.(type) {
func (v *VM) InitObjectFromGoType(value interface{}) Object {

Choose a reason for hiding this comment

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

exported method VM.InitObjectFromGoType should have comment or be unexported

@hachi8833
Copy link
Member

I just wonder if __method_missing__ or method_missing__ might be good for avoiding exploitation. How about this?

@@ -604,39 +625,39 @@ var builtinActions = map[operationType]*action{
},
}

func (vm *VM) InitObjectFromGoType(value interface{}) Object {
switch v := value.(type) {
func (v *VM) InitObjectFromGoType(value interface{}) Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

Copy link
Contributor

@eliothedeman eliothedeman left a comment

Choose a reason for hiding this comment

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

Looks fine to me. We can probably clean up the stack rewriting part when we move to option types. Thanks for unblocking me!

@eliothedeman eliothedeman merged commit 53a083b into master May 22, 2018
@ghost ghost removed the in progress label May 22, 2018
@st0012 st0012 deleted the Support-method-missing branch August 15, 2018 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants