Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jun 6, 2020
1 parent 0f7d4a2 commit b35d6c5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ast/nodes/AssignmentExpression.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import MagicString from 'magic-string';
import { findFirstOccurrenceOutsideComment, RenderOptions, WHITESPACE } from '../../utils/renderHelpers';
import {
findFirstOccurrenceOutsideComment,
RenderOptions,
WHITESPACE
} from '../../utils/renderHelpers';
import { getSystemExportExpressionLeft } from '../../utils/systemJsRendering';
import { HasEffectsContext, InclusionContext } from '../ExecutionContext';
import { EMPTY_PATH, ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker';
Expand All @@ -9,7 +13,7 @@ import { ExpressionNode, IncludeChildren, NodeBase } from './shared/Node';
import { PatternNode } from './shared/Pattern';

export default class AssignmentExpression extends NodeBase {
left!: PatternNode | ExpressionNode;
left!: PatternNode;
operator!:
| '='
| '+='
Expand Down Expand Up @@ -55,7 +59,7 @@ export default class AssignmentExpression extends NodeBase {
const exportNames =
this.left.variable && options.exportNamesByVariable.get(this.left.variable);
const _ = options.compact ? '' : ' ';
if (exportNames && exportNames.length > 0) {
if (exportNames) {
const operatorPos = findFirstOccurrenceOutsideComment(
code.original,
this.operator,
Expand All @@ -74,7 +78,7 @@ export default class AssignmentExpression extends NodeBase {
)}${operation}`
);
code.appendLeft(this.right.end, ')');
} else if ('addExportedVariables' in this.left) {
} else {
const systemPatternExports: Variable[] = [];
this.left.addExportedVariables(systemPatternExports, options.exportNamesByVariable);
if (systemPatternExports.length > 0) {
Expand Down

0 comments on commit b35d6c5

Please sign in to comment.