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