Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

303 improve super type declaration performance lookup #304

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,25 @@ trait ApexClassDeclaration extends ApexDeclaration with DependencyHolder {
/** Override to handle request to flush the type to passed cache if dirty */
def flush(pc: ParsedCache, context: PackageContext): Unit

override def superClassDeclaration: Option[TypeDeclaration] =
superClass.flatMap(sc => TypeResolver(sc, this).toOption)
private var _superClassDeclaration: Option[TypeDeclaration] = None

override def interfaceDeclarations: ArraySeq[TypeDeclaration] =
interfaces.flatMap(i => TypeResolver(i, this).toOption)
override def superClassDeclaration: Option[TypeDeclaration] = {
// Don't cache empty as maybe currently missing
if (_superClassDeclaration.isEmpty) {
_superClassDeclaration = superClass.flatMap(sc => TypeResolver(sc, this).toOption)
}
_superClassDeclaration
}

private var _interfaceDeclarations: ArraySeq[TypeDeclaration] = ArraySeq.empty

override def interfaceDeclarations: ArraySeq[TypeDeclaration] = {
// Don't cache empty as maybe currently missing
if (_interfaceDeclarations.size != interfaces.size) {
_interfaceDeclarations = interfaces.flatMap(i => TypeResolver(i, this).toOption)
}
_interfaceDeclarations
}

/** Obtain a source hash for this class and all it's ancestors */
def deepHash: Int = {
Expand Down
Loading