aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/backend/sjs/JSInterop.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/backend/sjs/JSInterop.scala')
-rw-r--r--src/dotty/tools/backend/sjs/JSInterop.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dotty/tools/backend/sjs/JSInterop.scala b/src/dotty/tools/backend/sjs/JSInterop.scala
new file mode 100644
index 000000000..5ec074f7f
--- /dev/null
+++ b/src/dotty/tools/backend/sjs/JSInterop.scala
@@ -0,0 +1,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)
+
+}