Skip to content

Commit 36bf6fb

Browse files
authored
fix some template only args references (#287)
1 parent cb47f52 commit 36bf6fb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/kotlin/com/emberjs/utils/EmberUtils.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class EmberUtils {
307307
if (cls is TypeScriptVariable) {
308308
if (cls.jsType.toString().startsWith("TOC<") || cls.jsType.toString().startsWith("TemplateOnlyComponent<")) {
309309
val arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
310-
return arg.asRecordType().properties.find { it.memberName == "Args" }?.jsType?.asRecordType()
310+
return arg.asRecordType().properties.find { it.memberName == "Args" }?.jsType?.asRecordType() ?: arg.asRecordType()
311311
}
312312
return cls.jsType?.asRecordType()?.callSignatures?.firstOrNull()?.returnType?.asRecordType()?.properties?.find { it.memberName == "Context" }?.jsType?.asRecordType()?.properties?.find { it.memberName == "args" }?.jsType?.asRecordType()
313313
}
@@ -958,8 +958,9 @@ class EmberUtils {
958958
}
959959
}
960960
val tsClass = (cls as? JSClass)
961-
var blocks: JSRecordType. PropertySignature? = null
962-
var args: JSRecordType. PropertySignature? = null
961+
var blocks: JSRecordType.PropertySignature? = null
962+
var args: JSRecordType.PropertySignature? = null
963+
var arg: JSType? = null
963964
val supers = tsClass?.superClasses?.asList()?.toTypedArray<JSClass>()
964965
val classes = mutableListOf<JSClass?>()
965966
classes.add(tsClass)
@@ -974,7 +975,7 @@ class EmberUtils {
974975
}
975976
if (cls is TypeScriptVariable) {
976977
if (cls.jsType.toString().startsWith("TOC<") || cls.jsType.toString().startsWith("TemplateOnlyComponent<")) {
977-
val arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
978+
arg = (cls.jsType as JSGenericTypeImpl).arguments[0]
978979
blocks = arg.asRecordType().properties.find { it.memberName == "Blocks" }
979980
args = arg.asRecordType().properties.find { it.memberName == "Args" }
980981
}
@@ -985,8 +986,8 @@ class EmberUtils {
985986
it.memberSource.singleElement?.let { tplYields.add(EmberXmlElementDescriptor.YieldReference(it)) }
986987
}
987988
}
988-
if (args != null) {
989-
val arguments = args?.jsType?.asRecordType()?.properties
989+
if (args != null || arg != null) {
990+
val arguments = args?.jsType?.asRecordType()?.properties ?: args?.jsType?.asRecordType()?.properties
990991
arguments?.forEach {
991992
if (it.memberSource.singleElement != null) {
992993
tplArgs.add(ArgData(it.memberName, "", AttrPsiReference(it.memberSource.singleElement!!)))

0 commit comments

Comments
 (0)