blob: 5ec074f7f0b5ad866b7d8d887c29b713f45b5dc3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package dotty.tools.backend.sjs
import dotty.tools.dotc.core._
import Contexts._
import Flags._
import Symbols._
import NameOps._
import StdNames._
import JSDefinitions._
/** Management of the interoperability with JavaScript. */
object JSInterop {
/** Is this symbol a JavaScript type? */
def isJSType(sym: Symbol)(implicit ctx: Context): Boolean = {
//sym.hasAnnotation(jsdefn.RawJSTypeAnnot)
ctx.atPhase(ctx.erasurePhase) { implicit ctx =>
sym.derivesFrom(jsdefn.JSAnyClass)
}
}
/** Is this symbol a Scala.js-defined JS class, i.e., a non-native JS class? */
def isScalaJSDefinedJSClass(sym: Symbol)(implicit ctx: Context): Boolean =
isJSType(sym) && !sym.hasAnnotation(jsdefn.JSNativeAnnot)
}
|