Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Apr 11, 2024
1 parent 9f6087f commit ccfdda1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
11 changes: 3 additions & 8 deletions lib/dependencies/HarmonyImportDependencyParserPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,9 @@ module.exports = class HarmonyImportDependencyParserPlugin {
if (!rightPart || !rightPart.isIdentifier()) return;

const rootInfo = rightPart.rootInfo;
if (
typeof rootInfo === "string" ||
!rootInfo ||
!rootInfo.tagInfo ||
rootInfo.tagInfo.tag !== harmonySpecifierTag
)
return;
const settings = rootInfo.tagInfo.data;
if (!isHarmonySpecifierTag(rootInfo)) return;
const settings = /** @type {VariableInfoInterface} */ (rootInfo)
.tagInfo.data;
const members = rightPart.getMembers();
const baseIds = settings.ids.concat(members);
const ids = baseIds.concat([leftPart]);
Expand Down
6 changes: 3 additions & 3 deletions lib/javascript/JavascriptParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const { importAssertions } = require("acorn-import-assertions");
const { SyncBailHook, HookMap } = require("tapable");
const vm = require("vm");
const Parser = require("../Parser");
const AppendOnlyStackedSet = require("../util/AppendOnlyStackedSet");
const StackedMap = require("../util/StackedMap");
const WriteOnlyStackedSet = require("../util/WriteOnlyStackedSet");
const binarySearchBounds = require("../util/binarySearchBounds");
const memoize = require("../util/memoize");
const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
Expand Down Expand Up @@ -138,7 +138,7 @@ class VariableInfo {
/**
* @typedef {Object} ScopeInfo
* @property {StackedMap<string, VariableInfo | ScopeInfo>} definitions
* @property {WriteOnlyStackedSet<string>} guards
* @property {AppendOnlyStackedSet<string>} guards
* @property {boolean | "arrow"} topLevelScope
* @property {boolean | string} inShorthand
* @property {boolean} inTaggedTemplateTag
Expand Down Expand Up @@ -4259,7 +4259,7 @@ class JavascriptParser extends Parser {
isStrict: false,
isAsmJs: false,
definitions: new StackedMap(),
guards: new WriteOnlyStackedSet()
guards: new AppendOnlyStackedSet()
};
/** @type {ParserState} */
this.state = state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* @template T
*/
class WriteOnlyStackedSet {
class AppendOnlyStackedSet {
constructor(sets = []) {
this._sets = sets;
this._current = undefined;
Expand Down Expand Up @@ -42,8 +42,10 @@ class WriteOnlyStackedSet {
}

createChild() {
return new WriteOnlyStackedSet(this._sets.length ? this._sets.slice() : []);
return new AppendOnlyStackedSet(
this._sets.length ? this._sets.slice() : []
);
}
}

module.exports = WriteOnlyStackedSet;
module.exports = AppendOnlyStackedSet;
14 changes: 7 additions & 7 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ type AliasOptionNewRequest = string | false | string[];
declare interface AliasOptions {
[index: string]: AliasOptionNewRequest;
}
declare abstract class AppendOnlyStackedSet<T> {
add(el: T): void;
has(el: T): boolean;
clear(): void;
createChild(): AppendOnlyStackedSet<any>;
}
declare interface Argument {
description: string;
simpleType: "string" | "number" | "boolean";
Expand Down Expand Up @@ -12923,7 +12929,7 @@ declare interface RuntimeValueOptions {
*/
declare interface ScopeInfo {
definitions: StackedMap<string, ScopeInfo | VariableInfo>;
guards: WriteOnlyStackedSet<string>;
guards: AppendOnlyStackedSet<string>;
topLevelScope: boolean | "arrow";
inShorthand: string | boolean;
inTaggedTemplateTag: boolean;
Expand Down Expand Up @@ -14790,12 +14796,6 @@ type WriteFileOptions =
declare interface WriteOnlySet<T> {
add: (item: T) => void;
}
declare abstract class WriteOnlyStackedSet<T> {
add(el: T): void;
has(el: T): boolean;
clear(): void;
createChild(): WriteOnlyStackedSet<any>;
}

declare interface WriteStreamOptions {
flags?: string;
Expand Down

0 comments on commit ccfdda1

Please sign in to comment.