@@ -24,22 +24,38 @@ object JSInterop {
24
24
def isScalaJSDefinedJSClass (sym : Symbol )(implicit ctx : Context ): Boolean =
25
25
isJSType(sym) && ! sym.hasAnnotation(jsdefn.JSNativeAnnot )
26
26
27
- /** Should this symbol be translated into a JS getter? */
27
+ /** Should this symbol be translated into a JS getter?
28
+ *
29
+ * This is true for any parameterless method, i.e., defined without `()`.
30
+ * Unlike `SymDenotations.isGetter`, it applies to user-defined methods as
31
+ * much as *accessor* methods created for `val`s and `var`s.
32
+ */
28
33
def isJSGetter (sym : Symbol )(implicit ctx : Context ): Boolean = {
29
34
sym.info.firstParamTypes.isEmpty && ctx.atPhase(ctx.erasurePhase) { implicit ctx =>
30
35
sym.info.isParameterless
31
36
}
32
37
}
33
38
34
- /** Should this symbol be translated into a JS setter? */
39
+ /** Should this symbol be translated into a JS setter?
40
+ *
41
+ * This is true for any method whose name ends in `_=`.
42
+ * Unlike `SymDenotations.isGetter`, it applies to user-defined methods as
43
+ * much as *accessor* methods created for `var`s.
44
+ */
35
45
def isJSSetter (sym : Symbol )(implicit ctx : Context ): Boolean =
36
46
sym.name.isSetterName && sym.is(Method )
37
47
38
- /** Should this symbol be translated into a JS bracket access? */
48
+ /** Should this symbol be translated into a JS bracket access?
49
+ *
50
+ * This is true for methods annotated with `@JSBracketAccess`.
51
+ */
39
52
def isJSBracketAccess (sym : Symbol )(implicit ctx : Context ): Boolean =
40
53
sym.hasAnnotation(jsdefn.JSBracketAccessAnnot )
41
54
42
- /** Should this symbol be translated into a JS bracket call? */
55
+ /** Should this symbol be translated into a JS bracket call?
56
+ *
57
+ * This is true for methods annotated with `@JSBracketCall`.
58
+ */
43
59
def isJSBracketCall (sym : Symbol )(implicit ctx : Context ): Boolean =
44
60
sym.hasAnnotation(jsdefn.JSBracketCallAnnot )
45
61
0 commit comments