mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 09:59:25 +00:00
fix resolving of class type variables
This commit is contained in:
@@ -274,6 +274,8 @@ function resolveTypeOrPackage(ident, type_variables, scope, imports, typemap) {
|
|||||||
types.push(tv.type);
|
types.push(tv.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scope) {
|
||||||
|
|
||||||
if (!types[0] && scope instanceof MethodBase) {
|
if (!types[0] && scope instanceof MethodBase) {
|
||||||
// is it a type variable in the current scope
|
// is it a type variable in the current scope
|
||||||
const tv = scope.typeVariables.find(tv => tv.name === ident);
|
const tv = scope.typeVariables.find(tv => tv.name === ident);
|
||||||
@@ -282,9 +284,9 @@ function resolveTypeOrPackage(ident, type_variables, scope, imports, typemap) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!types[0] && scope) {
|
|
||||||
// is it an enclosed type of the currently scoped type or any outer type
|
|
||||||
const scoped_type = scope instanceof CEIType ? scope : scope.owner;
|
const scoped_type = scope instanceof CEIType ? scope : scope.owner;
|
||||||
|
if (!types[0]) {
|
||||||
|
// is it an enclosed type of the currently scoped type or any outer type
|
||||||
const scopes = scoped_type.shortSignature.split('$');
|
const scopes = scoped_type.shortSignature.split('$');
|
||||||
while (scopes.length) {
|
while (scopes.length) {
|
||||||
const enc_type = typemap.get(`${scopes.join('$')}$${ident}`);
|
const enc_type = typemap.get(`${scopes.join('$')}$${ident}`);
|
||||||
@@ -299,13 +301,14 @@ function resolveTypeOrPackage(ident, type_variables, scope, imports, typemap) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!types[0] && scope instanceof CEIType) {
|
if (!types[0]) {
|
||||||
// is it a type variable of the currently scoped type
|
// is it a type variable of the currently scoped type
|
||||||
const tv = scope.typeVariables.find(tv => tv.name === ident);
|
const tv = scoped_type.typeVariables.find(tv => tv.name === ident);
|
||||||
if (tv) {
|
if (tv) {
|
||||||
types.push(tv.type);
|
types.push(tv.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!types[0]) {
|
if (!types[0]) {
|
||||||
// is it a top-level type from the imports
|
// is it a top-level type from the imports
|
||||||
|
|||||||
Reference in New Issue
Block a user