aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/backend/sjs/JSInterop.scala
diff options
context:
space:
mode:
authorSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-07 14:46:45 +0100
committerSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-10 18:01:45 +0100
commitd0dd7001f0b59ed53f0778530328b3bf413587a2 (patch)
tree4a3ad96313026973543edcb7e3d2e15751580b0d /src/dotty/tools/backend/sjs/JSInterop.scala
parentc14c9c096d09d9e21f1fd4ec27e6b416db01512f (diff)
downloaddotty-d0dd7001f0b59ed53f0778530328b3bf413587a2.tar.gz
dotty-d0dd7001f0b59ed53f0778530328b3bf413587a2.tar.bz2
dotty-d0dd7001f0b59ed53f0778530328b3bf413587a2.zip
Implement most of the Scala.js IR code generator.
Notable things that are missing at this point: * Pattern matching * Try * Most of the JavaScript interop
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)
+
+}