Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Make descriptor chaining consistent
Browse files Browse the repository at this point in the history
Summary:
I thought there was a bug here since we have 3 different approaches to chaining and it makes the code confusing.

This just uses a consistent approach to other places in the file

Reviewed By: elboman

Differential Revision: D53574558

fbshipit-source-id: b5f41ce6797daf41d68e6c66b7ea6e20ebeb5e26
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Feb 12, 2024
1 parent 7ec34c7 commit 8afb9ff
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ abstract class ChainedDescriptor<T> : NodeDescriptor<T> {

final override fun getHiddenAttributes(node: T): JsonObject? {

val descriptors = mutableListOf(this)
val descriptors = mutableListOf<ChainedDescriptor<T>>()

var curDescriptor: ChainedDescriptor<T>? = mSuper
var curDescriptor: ChainedDescriptor<T>? = this

while (curDescriptor != null) {
descriptors.add(curDescriptor)
Expand Down Expand Up @@ -116,9 +116,8 @@ abstract class ChainedDescriptor<T> : NodeDescriptor<T> {

final override fun getAttributes(node: T): MaybeDeferred<Map<MetadataId, InspectableObject>> {
val builder = mutableMapOf<MetadataId, InspectableObject>()
onGetAttributes(node, builder)

var curDescriptor: ChainedDescriptor<T>? = mSuper
var curDescriptor: ChainedDescriptor<T>? = this

while (curDescriptor != null) {
curDescriptor.onGetAttributes(node, builder)
Expand All @@ -137,9 +136,8 @@ abstract class ChainedDescriptor<T> : NodeDescriptor<T> {
final override fun getInlineAttributes(node: T): Map<String, String> {

val builder = mutableMapOf<String, String>()
onGetInlineAttributes(node, builder)

var curDescriptor: ChainedDescriptor<T>? = mSuper
var curDescriptor: ChainedDescriptor<T>? = this

while (curDescriptor != null) {
curDescriptor.onGetInlineAttributes(node, builder)
Expand Down

0 comments on commit 8afb9ff

Please sign in to comment.