From cd1c360ef08a4e28fc791e4bb9d03f595dd2878d Mon Sep 17 00:00:00 2001 From: Dave Holoway Date: Mon, 29 Jun 2020 15:49:04 +0100 Subject: [PATCH] remove unused field from ResolvedImport --- langserver/java/import-resolver.js | 10 +++++----- langserver/java/parsetypes/resolved-import.js | 10 +--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/langserver/java/import-resolver.js b/langserver/java/import-resolver.js index cf70ee2..9559aff 100644 --- a/langserver/java/import-resolver.js +++ b/langserver/java/import-resolver.js @@ -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 const matches = fetchImportedTypes(typenames, dotted_name, false); if (matches) { - return new ResolvedImport(null, matches, '*', typemap, import_kind); + return new ResolvedImport(matches, '*', typemap, import_kind); } } else if (dotted_name.includes('.')) { // the final ident is the static member - the rest is the exact type const split_name = dotted_name.match(/(.+)\.([^.]+)$/); const matches = fetchImportedTypes(typenames, split_name[1], false); 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 (i.members.length > 0) { return i; @@ -56,7 +56,7 @@ function resolveSingleImport(typemap, dotted_name, is_static, on_demand, import_ } else { const matches = fetchImportedTypes(typenames, dotted_name, on_demand); if (matches) { - return new ResolvedImport(null, matches, null, typemap, import_kind); + return new ResolvedImport(matches, null, typemap, import_kind); } } return null; @@ -86,14 +86,14 @@ function resolveImports(typemap, package_name, implicitPackages = ['java.lang']) if (package_name) { const matches = fetchImportedTypes(typenames, package_name, true); 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 implicitPackages.forEach(package_name => { const matches = fetchImportedTypes(typenames, package_name, true); if (matches) - resolved.push(new ResolvedImport(null, matches, null, typemap, 'implicit-import')); + resolved.push(new ResolvedImport(matches, null, typemap, 'implicit-import')); }) /** diff --git a/langserver/java/parsetypes/resolved-import.js b/langserver/java/parsetypes/resolved-import.js index fd59763..cc37d42 100644 --- a/langserver/java/parsetypes/resolved-import.js +++ b/langserver/java/parsetypes/resolved-import.js @@ -1,7 +1,6 @@ /** * @typedef {import('java-mti').CEIType} CEIType */ -const { ImportBlock } = require('../parser9'); /** * Class representing a resolved import. @@ -12,19 +11,12 @@ const { ImportBlock } = require('../parser9'); */ class ResolvedImport { /** - * @param {ImportBlock} import_decl * @param {RegExpMatchArray} matches * @param {string} static_ident * @param {Map} typemap * @param {'owner-package'|'import'|'implicit-import'} import_kind */ - constructor(import_decl, matches, static_ident, typemap, import_kind) { - /** - * The associated import declaration. - * - this value is null for owner-package and implicit-imports - */ - this.import = import_decl; - + constructor(matches, static_ident, typemap, import_kind) { /** * Array of fully qualified type names in JRE format resolved in this import */