aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-25 18:21:58 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-25 18:21:58 +0100
commitd01ecb733dc8990d1f5d432e1fb9eb488bb7e3b4 (patch)
treeaec4db023e4b21677077fe10f4aa5859c0fa9d2b /src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
parent13a05d5119e33333000f969817434629443d6bb2 (diff)
downloaddotty-d01ecb733dc8990d1f5d432e1fb9eb488bb7e3b4.tar.gz
dotty-d01ecb733dc8990d1f5d432e1fb9eb488bb7e3b4.tar.bz2
dotty-d01ecb733dc8990d1f5d432e1fb9eb488bb7e3b4.zip
Add companion class methods for files read from scala & java
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/ClassfileParser.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index 3b8daab39..516b47c0a 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -130,10 +130,20 @@ class ClassfileParser(
for (i <- 0 until in.nextChar) parseMember(method = true)
classInfo = parseAttributes(classRoot.symbol, classInfo)
if (isAnnotation) addAnnotationConstructor(classInfo)
+ if (classRoot.exists) syntecizeCompanionMethod(nme.COMPANION_CLASS_METHOD, classRoot, moduleRoot)
+
setClassInfo(classRoot, classInfo)
setClassInfo(moduleRoot, staticInfo)
}
+ def syntecizeCompanionMethod(name: TermName, ret: SymDenotation, owner: SymDenotation)(implicit ctx: Context) = {
+ if(owner.exists) ctx.newSymbol(
+ owner = owner.symbol,
+ name = name,
+ flags = Flags.Synthetic | Flags.Private,
+ info = ExprType(ret.typeRef)).entered
+ }
+
/** Add type parameters of enclosing classes */
def addEnclosingTParams()(implicit ctx: Context): Unit = {
var sym = classRoot.owner