Skip to content

Commit

Permalink
add a toString() override
Browse files Browse the repository at this point in the history
this was needed for compatability with [email protected] and up,
where Object.create() is used when creating ref types and deref types
  • Loading branch information
TooTallNate committed Jun 1, 2012
1 parent 5c02fd8 commit e52a132
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/struct.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ function Struct () {
constructor.prototype.constructor = constructor

constructor.defineProperty = defineProperty
constructor.toString = toString
constructor.fields = {}

// Setup the ref "type" interface. The constructor doubles as the "type" object
constructor.size = 0
constructor.alignment = 0
Expand Down Expand Up @@ -164,6 +166,10 @@ function set (buffer, offset, value) {
}
}

function toString () {
return 'StructType'
}

/**
* Adds a new field to the struct instance with the given name and type.
* Note that this function will throw an Error if any instances of the struct
Expand Down

0 comments on commit e52a132

Please sign in to comment.