Skip to content

Commit

Permalink
#747 revert appling Stub logic on whole class if all members are Stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Jand42 committed Aug 28, 2017
1 parent 5881b03 commit c9dc95b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compiler/WebSharper.Compiler.FSharp/ProjectReader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ let rec private transformClass (sc: Lazy<_ * StartupCode>) (comp: Compilation) (
a

let stubs = HashSet()
let mutable hasStubMember = false
let mutable hasNonStubMember = false

for meth in cls.MembersFunctionsAndValues do
if meth.IsProperty then () else
Expand All @@ -260,6 +262,7 @@ let rec private transformClass (sc: Lazy<_ * StartupCode>) (comp: Compilation) (

match mAnnot.Kind with
| Some A.MemberKind.Stub ->
hasStubMember <- true
let memdef = sr.ReadMember meth
match memdef with
| Member.Method (isInstance, mdef) ->
Expand Down Expand Up @@ -357,6 +360,7 @@ let rec private transformClass (sc: Lazy<_ * StartupCode>) (comp: Compilation) (
| Some A.MemberKind.Stub
| Some (A.MemberKind.Remote _) -> ()
| Some kind ->
hasNonStubMember <- true
let memdef = sr.ReadMember meth

if stubs.Contains memdef then () else
Expand Down Expand Up @@ -664,7 +668,7 @@ let rec private transformClass (sc: Lazy<_ * StartupCode>) (comp: Compilation) (
if not annot.IsJavaScript && clsMembers.Count = 0 && annot.Macros.IsEmpty then None else

let ckind =
if annot.IsStub
if annot.IsStub || (hasStubMember && not hasNonStubMember)
then NotResolvedClassKind.Stub
elif cls.IsFSharpModule then NotResolvedClassKind.Static
elif (annot.IsJavaScript && (isAbstractClass cls || cls.IsFSharpExceptionDeclaration)) || (annot.Prototype = Some true)
Expand Down

0 comments on commit c9dc95b

Please sign in to comment.