mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 01:48:18 +00:00
remove unused field from ResolvedImport
This commit is contained in:
@@ -39,14 +39,14 @@ function resolveSingleImport(typemap, dotted_name, is_static, on_demand, import_
|
|||||||
// import all static members - the dotted name must be an exact type
|
// import all static members - the dotted name must be an exact type
|
||||||
const matches = fetchImportedTypes(typenames, dotted_name, false);
|
const matches = fetchImportedTypes(typenames, dotted_name, false);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
return new ResolvedImport(null, matches, '*', typemap, import_kind);
|
return new ResolvedImport(matches, '*', typemap, import_kind);
|
||||||
}
|
}
|
||||||
} else if (dotted_name.includes('.')) {
|
} else if (dotted_name.includes('.')) {
|
||||||
// the final ident is the static member - the rest is the exact type
|
// the final ident is the static member - the rest is the exact type
|
||||||
const split_name = dotted_name.match(/(.+)\.([^.]+)$/);
|
const split_name = dotted_name.match(/(.+)\.([^.]+)$/);
|
||||||
const matches = fetchImportedTypes(typenames, split_name[1], false);
|
const matches = fetchImportedTypes(typenames, split_name[1], false);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const i = new ResolvedImport(null, matches, split_name[2], typemap, import_kind);
|
const i = new ResolvedImport(matches, split_name[2], typemap, import_kind);
|
||||||
// if there's no matching member, treat it as an invalid import
|
// if there's no matching member, treat it as an invalid import
|
||||||
if (i.members.length > 0) {
|
if (i.members.length > 0) {
|
||||||
return i;
|
return i;
|
||||||
@@ -56,7 +56,7 @@ function resolveSingleImport(typemap, dotted_name, is_static, on_demand, import_
|
|||||||
} else {
|
} else {
|
||||||
const matches = fetchImportedTypes(typenames, dotted_name, on_demand);
|
const matches = fetchImportedTypes(typenames, dotted_name, on_demand);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
return new ResolvedImport(null, matches, null, typemap, import_kind);
|
return new ResolvedImport(matches, null, typemap, import_kind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -86,14 +86,14 @@ function resolveImports(typemap, package_name, implicitPackages = ['java.lang'])
|
|||||||
if (package_name) {
|
if (package_name) {
|
||||||
const matches = fetchImportedTypes(typenames, package_name, true);
|
const matches = fetchImportedTypes(typenames, package_name, true);
|
||||||
if (matches)
|
if (matches)
|
||||||
resolved.push(new ResolvedImport(null, matches, null, typemap, 'owner-package'));
|
resolved.push(new ResolvedImport(matches, null, typemap, 'owner-package'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// import types from the implicit packages
|
// import types from the implicit packages
|
||||||
implicitPackages.forEach(package_name => {
|
implicitPackages.forEach(package_name => {
|
||||||
const matches = fetchImportedTypes(typenames, package_name, true);
|
const matches = fetchImportedTypes(typenames, package_name, true);
|
||||||
if (matches)
|
if (matches)
|
||||||
resolved.push(new ResolvedImport(null, matches, null, typemap, 'implicit-import'));
|
resolved.push(new ResolvedImport(matches, null, typemap, 'implicit-import'));
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @typedef {import('java-mti').CEIType} CEIType
|
* @typedef {import('java-mti').CEIType} CEIType
|
||||||
*/
|
*/
|
||||||
const { ImportBlock } = require('../parser9');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a resolved import.
|
* Class representing a resolved import.
|
||||||
@@ -12,19 +11,12 @@ const { ImportBlock } = require('../parser9');
|
|||||||
*/
|
*/
|
||||||
class ResolvedImport {
|
class ResolvedImport {
|
||||||
/**
|
/**
|
||||||
* @param {ImportBlock} import_decl
|
|
||||||
* @param {RegExpMatchArray} matches
|
* @param {RegExpMatchArray} matches
|
||||||
* @param {string} static_ident
|
* @param {string} static_ident
|
||||||
* @param {Map<string,CEIType>} typemap
|
* @param {Map<string,CEIType>} typemap
|
||||||
* @param {'owner-package'|'import'|'implicit-import'} import_kind
|
* @param {'owner-package'|'import'|'implicit-import'} import_kind
|
||||||
*/
|
*/
|
||||||
constructor(import_decl, matches, static_ident, typemap, import_kind) {
|
constructor(matches, static_ident, typemap, import_kind) {
|
||||||
/**
|
|
||||||
* The associated import declaration.
|
|
||||||
* - this value is null for owner-package and implicit-imports
|
|
||||||
*/
|
|
||||||
this.import = import_decl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of fully qualified type names in JRE format resolved in this import
|
* Array of fully qualified type names in JRE format resolved in this import
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user