Skip to content

Commit

Permalink
isDotty removed from stubs #SCL-14463
Browse files Browse the repository at this point in the history
  • Loading branch information
adkozlov committed Oct 17, 2018
1 parent 037f823 commit cf26384
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 69 deletions.
Expand Up @@ -4,7 +4,6 @@ import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import com.intellij.psi.tree.{IElementType, TokenSet}
import org.jetbrains.plugins.dotty.lang.psi.impl.base.types._
import org.jetbrains.plugins.dotty.lang.psi.impl.toplevel.typedef.DottyTraitImpl
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes._
import org.jetbrains.plugins.scala.lang.parser.ScalaPsiCreator
Expand All @@ -16,7 +15,6 @@ object DottyPsiCreator extends ScalaPsiCreator {
private val idTokenSet = TokenSet.create(REFERENCE, ScalaTokenTypes.tAND, ScalaTokenTypes.tOR)

override protected def createElement(node: ASTNode, elementType: IElementType): PsiElement = elementType match {
case TRAIT_DEFINITION => new DottyTraitImpl(node)
case _ => super.createElement(node, elementType)
}

Expand Down

This file was deleted.

Expand Up @@ -13,9 +13,10 @@ import com.intellij.reference.SoftReference
* @author ilyas
*/
object DecompilerUtil {

protected val LOG: Logger = Logger.getInstance("#org.jetbrains.plugins.scala.decompiler.DecompilerUtil")

val DECOMPILER_VERSION = 295
val DECOMPILER_VERSION = 296
private val SCALA_DECOMPILER_FILE_ATTRIBUTE = new FileAttribute("_is_scala_compiled_new_key_", DECOMPILER_VERSION, true)
private val SCALA_DECOMPILER_KEY = new Key[SoftReference[DecompilationResult]]("Is Scala File Key")

Expand Down
Expand Up @@ -12,8 +12,6 @@ import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTemplateDefin
trait ScTemplateDefinitionStub extends PsiClassStub[ScTemplateDefinition] with ScMemberOrLocal {
def javaQualifiedName: String

def isDotty: Boolean

def isPackageObject: Boolean

def isVisibleInJava: Boolean
Expand Down
Expand Up @@ -12,7 +12,8 @@ import org.jetbrains.plugins.scala.lang.psi.impl.toplevel.typedef.ScClassImpl
* @author ilyas
*/
class ScClassDefinitionElementType extends ScTemplateDefinitionElementType[ScClass]("class definition") {
override def createElement(node: ASTNode): ScClass = new ScClassImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub): ScClass = new ScClassImpl(stub)
override def createElement(node: ASTNode) = new ScClassImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub) = new ScClassImpl(stub)
}
@@ -1,17 +1,20 @@
package org.jetbrains.plugins.scala.lang.psi.stubs.elements
package org.jetbrains.plugins.scala
package lang
package psi
package stubs
package elements

import com.intellij.lang.ASTNode
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScNewTemplateDefinition
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTemplateDefinition
import org.jetbrains.plugins.scala.lang.psi.impl.expr.ScNewTemplateDefinitionImpl
import org.jetbrains.plugins.scala.lang.psi.stubs.ScTemplateDefinitionStub

/**
* User: Alexander Podkhalyuzin
* Date: 21.12.2009
*/
class ScNewTemplateDefinitionStubElementType extends ScTemplateDefinitionElementType[ScNewTemplateDefinition]("new template definition stub") {
override def createElement(node: ASTNode): ScTemplateDefinition = new ScNewTemplateDefinitionImpl(node)
final class ScNewTemplateDefinitionStubElementType extends ScTemplateDefinitionElementType[ScNewTemplateDefinition]("new template definition stub") {

override def createPsi(stub: ScTemplateDefinitionStub): ScTemplateDefinition = new ScNewTemplateDefinitionImpl(stub)
override def createElement(node: ASTNode) = new ScNewTemplateDefinitionImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub) = new ScNewTemplateDefinitionImpl(stub)
}
Expand Up @@ -12,7 +12,8 @@ import org.jetbrains.plugins.scala.lang.psi.impl.toplevel.typedef.ScObjectImpl
* @author ilyas
*/
class ScObjectDefinitionElementType extends ScTemplateDefinitionElementType[ScObject]("object definition") {
override def createElement(node: ASTNode): ScObject = new ScObjectImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub): ScObject = new ScObjectImpl(stub)
override def createElement(node: ASTNode) = new ScObjectImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub) = new ScObjectImpl(stub)
}
Expand Up @@ -15,7 +15,6 @@ import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScClass, ScObj
import org.jetbrains.plugins.scala.lang.psi.stubs.impl.ScTemplateDefinitionStubImpl
import org.jetbrains.plugins.scala.lang.psi.stubs.index.ScalaIndexKeys
import org.jetbrains.plugins.scala.lang.refactoring.util.ScalaNamesUtil
import org.jetbrains.plugins.scala.project.ProjectExt

/**
* @author ilyas, alefas
Expand All @@ -27,7 +26,6 @@ abstract class ScTemplateDefinitionElementType[TypeDef <: ScTemplateDefinition](
dataStream.writeName(stub.getName)
dataStream.writeName(stub.getQualifiedName)
dataStream.writeName(stub.javaQualifiedName)
dataStream.writeBoolean(stub.isDotty)
dataStream.writeBoolean(stub.isPackageObject)
dataStream.writeBoolean(stub.isScriptFileClass)
dataStream.writeName(stub.getSourceFileName)
Expand All @@ -47,7 +45,6 @@ abstract class ScTemplateDefinitionElementType[TypeDef <: ScTemplateDefinition](
nameRef = dataStream.readName,
qualifiedNameRef = dataStream.readName,
javaQualifiedNameRef = dataStream.readName,
isDotty = dataStream.readBoolean,
isPackageObject = dataStream.readBoolean,
isScriptFileClass = dataStream.readBoolean,
sourceFileNameRef = dataStream.readName,
Expand Down Expand Up @@ -106,7 +103,6 @@ abstract class ScTemplateDefinitionElementType[TypeDef <: ScTemplateDefinition](
nameRef = fromString(definition.name),
qualifiedNameRef = fromString(definition.qualifiedName),
javaQualifiedNameRef = fromString(definition.getQualifiedName),
isDotty = definition.getProject.hasDotty,
isPackageObject = isPackageObject,
isScriptFileClass = definition.isScriptFileClass,
sourceFileNameRef = fromString(fileName),
Expand Down
Expand Up @@ -5,16 +5,15 @@ package stubs
package elements

import com.intellij.lang.ASTNode
import org.jetbrains.plugins.dotty.lang.psi.impl.toplevel.typedef.DottyTraitImpl
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTrait
import org.jetbrains.plugins.scala.lang.psi.impl.toplevel.typedef.ScTraitImpl

/**
* @author ilyas
*/
class ScTraitDefinitionElementType extends ScTemplateDefinitionElementType[ScTrait]("trait definition") {
override def createElement(node: ASTNode): ScTrait = new ScTraitImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub): ScTrait =
if (stub.isDotty) new DottyTraitImpl(stub) else new ScTraitImpl(stub)
override def createElement(node: ASTNode) = new ScTraitImpl(node)

override def createPsi(stub: ScTemplateDefinitionStub) = new ScTraitImpl(stub)
}
Expand Up @@ -14,22 +14,21 @@ import org.jetbrains.plugins.scala.lang.psi.stubs.elements.MaybeStringRefExt
/**
* @author ilyas
*/
class ScTemplateDefinitionStubImpl(parent: StubElement[_ <: PsiElement],
elementType: IStubElementType[_ <: StubElement[_ <: PsiElement], _ <: PsiElement],
nameRef: StringRef,
private val qualifiedNameRef: StringRef,
private val javaQualifiedNameRef: StringRef,
val isDotty: Boolean,
val isPackageObject: Boolean,
val isScriptFileClass: Boolean,
private val sourceFileNameRef: StringRef,
val isDeprecated: Boolean,
val isImplicitObject: Boolean,
val isImplicitClass: Boolean,
private val javaNameRef: StringRef,
private val additionalJavaNameRef: Option[StringRef],
val isLocal: Boolean,
val isVisibleInJava: Boolean)
final class ScTemplateDefinitionStubImpl(parent: StubElement[_ <: PsiElement],
elementType: IStubElementType[_ <: StubElement[_ <: PsiElement], _ <: PsiElement],
nameRef: StringRef,
private val qualifiedNameRef: StringRef,
private val javaQualifiedNameRef: StringRef,
val isPackageObject: Boolean,
val isScriptFileClass: Boolean,
private val sourceFileNameRef: StringRef,
val isDeprecated: Boolean,
val isImplicitObject: Boolean,
val isImplicitClass: Boolean,
private val javaNameRef: StringRef,
private val additionalJavaNameRef: Option[StringRef],
val isLocal: Boolean,
val isVisibleInJava: Boolean)
extends ScNamedStubBase[ScTemplateDefinition](parent, elementType, nameRef) with ScTemplateDefinitionStub {

override def getQualifiedName: String = StringRef.toString(qualifiedNameRef)
Expand Down

0 comments on commit cf26384

Please sign in to comment.