Skip to content

Instantly share code, notes, and snippets.

@Tarmil
Created December 17, 2013 14:40
Show Gist options
  • Save Tarmil/8005892 to your computer and use it in GitHub Desktop.
Save Tarmil/8005892 to your computer and use it in GitHub Desktop.
open IntelliFactory.WebSharper
open Microsoft.FSharp
let hasRefDef (t: System.Type) =
match t.GetMethods() |> Seq.find (fun m -> m.Name = "get_Body") with
| Quotations.DerivedPatterns.MethodWithReflectedDefinition d -> true
| _ -> false
type Foo() =
inherit Web.Control()
[<JavaScript>]
override this.Body = Text ""
let Bar =
{ new Web.Control() with
[<JavaScript>] member this.Body = Text "" }
hasRefDef typeof<Foo> // true
hasRefDef (Bar.GetType()) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment