From 5a7cacbb37f8f1edfded03a095eb45c04a883185 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 3 Jun 2016 15:00:10 +0200 Subject: Add scala.Dynamic language feature check. --- src/dotty/tools/dotc/core/TypeOps.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/TypeOps.scala') diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 1288c0b23..3da119a9c 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -455,7 +455,8 @@ trait TypeOps { this: Context => // TODO: Make standalone object. */ def featureEnabled(owner: ClassSymbol, feature: TermName): Boolean = { def toPrefix(sym: Symbol): String = - if (sym eq defn.LanguageModuleClass) "" else toPrefix(sym.owner) + sym.name + "." + if (!sym.exists || (sym eq defn.LanguageModuleClass) || (sym eq defn.Scala2LanguageModuleRef)) "" + else toPrefix(sym.owner) + sym.name + "." def featureName = toPrefix(owner) + feature def hasImport(implicit ctx: Context): Boolean = ( ctx.importInfo != null @@ -477,6 +478,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object. def scala2Mode = featureEnabled(defn.LanguageModuleClass, nme.Scala2) + def dynamicsEnabled = + featureEnabled(defn.Scala2LanguageModuleClass, nme.dynamics) + def testScala2Mode(msg: String, pos: Position) = { if (scala2Mode) migrationWarning(msg, pos) scala2Mode -- cgit v1.2.3