From d7e6ffcdd3f5f3ab5d1e15daaf922be7f245ae45 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 22 Sep 2019 21:05:34 -0400 Subject: [PATCH] remove some unused code --- .../compile/nodes/shared/Expression.ts | 54 +------------------ src/compiler/compile/utils/stringify.ts | 4 -- 2 files changed, 1 insertion(+), 57 deletions(-) diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index fe3d5a83f0..24753ee40b 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -11,57 +11,9 @@ import Block from '../../render_dom/Block'; import is_dynamic from '../../render_dom/wrappers/shared/is_dynamic'; import { x, b } from 'code-red'; import { invalidate } from '../../utils/invalidate'; -import { Node, BinaryExpression, LogicalExpression, FunctionExpression } from 'estree'; +import { Node, FunctionExpression } from 'estree'; import { TemplateNode } from '../../../interfaces'; -const binary_operators: Record = { - '**': 15, - '*': 14, - '/': 14, - '%': 14, - '+': 13, - '-': 13, - '<<': 12, - '>>': 12, - '>>>': 12, - '<': 11, - '<=': 11, - '>': 11, - '>=': 11, - in: 11, - instanceof: 11, - '==': 10, - '!=': 10, - '===': 10, - '!==': 10, - '&': 9, - '^': 8, - '|': 7 -}; - -const logical_operators: Record = { - '&&': 6, - '||': 5 -}; - -const precedence: Record number> = { - Literal: () => 21, - Identifier: () => 21, - ParenthesizedExpression: () => 20, - MemberExpression: () => 19, - NewExpression: () => 19, // can be 18 (if no args) but makes no practical difference - CallExpression: () => 19, - UpdateExpression: () => 17, - UnaryExpression: () => 16, - BinaryExpression: (node: BinaryExpression) => binary_operators[node.operator], - LogicalExpression: (node: LogicalExpression) => logical_operators[node.operator], - ConditionalExpression: () => 4, - AssignmentExpression: () => 3, - YieldExpression: () => 2, - SpreadElement: () => 1, - SequenceExpression: () => 0 -}; - type Owner = Wrapper | TemplateNode; export default class Expression { @@ -220,10 +172,6 @@ export default class Expression { }); } - get_precedence() { - return this.node.type in precedence ? precedence[this.node.type](this.node) : 0; - } - // TODO move this into a render-dom wrapper? manipulate(block?: Block) { // TODO ideally we wouldn't end up calling this method diff --git a/src/compiler/compile/utils/stringify.ts b/src/compiler/compile/utils/stringify.ts index 650a49051a..d042cd43ca 100644 --- a/src/compiler/compile/utils/stringify.ts +++ b/src/compiler/compile/utils/stringify.ts @@ -1,7 +1,3 @@ -export function stringify(data: string, options = {}) { - return JSON.stringify(escape(data, options)); -} - export function string_literal(data: string) { return { type: 'Literal',