5

に私はrefchecks相のためのScalaコンパイラプラグインを書いているを参照するシンボルを取得します。「スーパー」コールがScalaの

は、どのように私は、「スーパー」コールが呼び出し場所の象徴与えられた、を意味していることsymbolアクセスできますか?例えば

、呼び出し場所super.m()のシンボルを知る

trait A { 
    def m() {} 
} 

trait B extends A { 
    def m() { super.m() } 
} 

に、私は、形質Aのシンボルを取得したいと思います。

+0

は、あなたがその段階では利用できない場合、またはどのような具体的なインスタンスとクラス/タイプ用)のgetClass()とclassOf(ないのですか? –

答えて

1

私は自己型注釈を使用して、複数の継承はあなたを提供すると思います:

trait HelperTrait { 
    def helperMethod {println("calling helperMethod of HelperTrait")} 
} 

trait PublicInterface { this: HelperTrait => 
    def useHelperMethod 
    { 
    println("calling useHelperMethod of PublicInterface") 
    helperMethod 
    } 
} 

class ImplementationClass extends PublicInterface with HelperTrait 

var obj = new ImplementationClass() 
obj.useHelperMethod 
obj.helperMethod