Skip to content
This repository

Instanceof not working with classes #4

Merged
merged 1 commit into from about 2 years ago

2 participants

Tobiasz Cudnik Tim Disney
Tobiasz Cudnik

Instanceof not working with contracted classes, because Proxy doesn't receive a correct prototype.

Tim Disney disnet merged commit 105ec1b into from March 11, 2012
Tim Disney disnet closed this March 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  src/contracts.coffee
3  src/contracts.coffee
@@ -615,7 +615,8 @@ object = (objContract, options = {}, name) ->
615 615
         new bf()
616 616
       )
617 617
     else
618  
-      op = Proxy.create(handler, Object::)
  618
+      proto = obj?.constructor?.prototype or Object::
  619
+      op = Proxy.create(handler, proto)
619 620
     unproxy.set op, this
620 621
     op
621 622
   )
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.