Skip to content

Commit

Permalink
Revert previous because it is handled via NodeBase
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed May 14, 2022
1 parent b0da24e commit e12f0e8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 35 deletions.
9 changes: 2 additions & 7 deletions src/ast/nodes/Property.ts
@@ -1,13 +1,13 @@
import type MagicString from 'magic-string';
import type { NormalizedTreeshakingOptions } from '../../rollup/types';
import type { RenderOptions } from '../../utils/renderHelpers';
import type { HasEffectsContext, InclusionContext } from '../ExecutionContext';
import type { HasEffectsContext } from '../ExecutionContext';
import { UnknownKey } from '../utils/PathTracker';
import type LocalVariable from '../variables/LocalVariable';
import type * as NodeType from './NodeType';
import { type ExpressionEntity, UNKNOWN_EXPRESSION } from './shared/Expression';
import MethodBase from './shared/MethodBase';
import type { ExpressionNode, IncludeChildren } from './shared/Node';
import type { ExpressionNode } from './shared/Node';
import type { PatternNode } from './shared/Pattern';

export default class Property extends MethodBase implements PatternNode {
Expand Down Expand Up @@ -35,11 +35,6 @@ export default class Property extends MethodBase implements PatternNode {
);
}

include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) {
if (!this.deoptimized) this.applyDeoptimizations();
super.include(context, includeChildrenRecursively);
}

markDeclarationReached(): void {
(this.value as PatternNode).markDeclarationReached();
}
Expand Down
8 changes: 1 addition & 7 deletions src/ast/nodes/SpreadElement.ts
@@ -1,11 +1,10 @@
import type { NormalizedTreeshakingOptions } from '../../rollup/types';
import type { HasEffectsContext } from '../ExecutionContext';
import { InclusionContext } from '../ExecutionContext';
import type { NodeEvent } from '../NodeEvents';
import { type ObjectPath, type PathTracker, UNKNOWN_PATH, UnknownKey } from '../utils/PathTracker';
import type * as NodeType from './NodeType';
import type { ExpressionEntity } from './shared/Expression';
import { type ExpressionNode, IncludeChildren, NodeBase } from './shared/Node';
import { type ExpressionNode, NodeBase } from './shared/Node';

export default class SpreadElement extends NodeBase {
declare argument: ExpressionNode;
Expand Down Expand Up @@ -40,11 +39,6 @@ export default class SpreadElement extends NodeBase {
);
}

include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) {
if (!this.deoptimized) this.applyDeoptimizations();
super.include(context, includeChildrenRecursively);
}

protected applyDeoptimizations(): void {
this.deoptimized = true;
// Only properties of properties of the argument could become subject to reassignment
Expand Down
8 changes: 1 addition & 7 deletions src/ast/nodes/UnaryExpression.ts
@@ -1,12 +1,11 @@
import type { DeoptimizableEntity } from '../DeoptimizableEntity';
import type { HasEffectsContext } from '../ExecutionContext';
import { InclusionContext } from '../ExecutionContext';
import { EMPTY_PATH, type ObjectPath, type PathTracker } from '../utils/PathTracker';
import Identifier from './Identifier';
import type { LiteralValue } from './Literal';
import type * as NodeType from './NodeType';
import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression';
import { type ExpressionNode, IncludeChildren, NodeBase } from './shared/Node';
import { type ExpressionNode, NodeBase } from './shared/Node';

const unaryOperators: {
[operator: string]: (value: LiteralValue) => LiteralValueOrUnknown;
Expand Down Expand Up @@ -56,11 +55,6 @@ export default class UnaryExpression extends NodeBase {
return path.length > 1;
}

include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) {
if (!this.deoptimized) this.applyDeoptimizations();
super.include(context, includeChildrenRecursively);
}

protected applyDeoptimizations(): void {
this.deoptimized = true;
if (this.operator === 'delete') {
Expand Down
8 changes: 1 addition & 7 deletions src/ast/nodes/UpdateExpression.ts
Expand Up @@ -6,11 +6,10 @@ import {
renderSystemExportSequenceBeforeExpression
} from '../../utils/systemJsRendering';
import type { HasEffectsContext } from '../ExecutionContext';
import { InclusionContext } from '../ExecutionContext';
import { EMPTY_PATH, type ObjectPath } from '../utils/PathTracker';
import Identifier from './Identifier';
import * as NodeType from './NodeType';
import { type ExpressionNode, IncludeChildren, NodeBase } from './shared/Node';
import { type ExpressionNode, NodeBase } from './shared/Node';

export default class UpdateExpression extends NodeBase {
declare argument: ExpressionNode;
Expand All @@ -31,11 +30,6 @@ export default class UpdateExpression extends NodeBase {
return path.length > 1;
}

include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) {
if (!this.deoptimized) this.applyDeoptimizations();
super.include(context, includeChildrenRecursively);
}

render(code: MagicString, options: RenderOptions): void {
const {
exportNamesByVariable,
Expand Down
8 changes: 1 addition & 7 deletions src/ast/nodes/YieldExpression.ts
@@ -1,10 +1,9 @@
import type MagicString from 'magic-string';
import type { RenderOptions } from '../../utils/renderHelpers';
import type { HasEffectsContext } from '../ExecutionContext';
import { InclusionContext } from '../ExecutionContext';
import { UNKNOWN_PATH } from '../utils/PathTracker';
import type * as NodeType from './NodeType';
import { type ExpressionNode, IncludeChildren, NodeBase } from './shared/Node';
import { type ExpressionNode, NodeBase } from './shared/Node';

export default class YieldExpression extends NodeBase {
declare argument: ExpressionNode | null;
Expand All @@ -17,11 +16,6 @@ export default class YieldExpression extends NodeBase {
return !context.ignore.returnYield || this.argument?.hasEffects(context);
}

include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) {
if (!this.deoptimized) this.applyDeoptimizations();
super.include(context, includeChildrenRecursively);
}

render(code: MagicString, options: RenderOptions): void {
if (this.argument) {
this.argument.render(code, options, { preventASI: true });
Expand Down

0 comments on commit e12f0e8

Please sign in to comment.