Skip to content

Commit

Permalink
Added ToString overloads to CommonObject and Undefined so that …
Browse files Browse the repository at this point in the history
…C# interop will handle these properly during string concatenation and formatting.
  • Loading branch information
otac0n committed Jul 3, 2011
1 parent c87b37d commit eeddf40
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Src/IronJS/Runtime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ and [<AllowNullLiteral>] Undefined() =
static member Instance = instance
static member Boxed = boxed

override x.ToString() : string =
"undefined"

///
and [<AbstractClass>] TypeTag() =

Expand Down Expand Up @@ -553,6 +556,19 @@ and [<AllowNullLiteral>] CommonObject =
else
false

override x.ToString() : string =
let item:Descriptor = x.Find("toString")
if item.HasValue then
let box = item.Value
if box.IsFunction then
let func = box.Func
let ret = func.Call(x)
TC.ToString(ret)
else
base.ToString()
else
base.ToString()

abstract ClassName : string with get
default x.ClassName = "Object"

Expand Down

0 comments on commit eeddf40

Please sign in to comment.