remove some unused code

pull/3539/head
Richard Harris 6 years ago
parent 68b6d9e09f
commit d7e6ffcdd3

@ -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<string, number> = {
'**': 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<string, number> = {
'&&': 6,
'||': 5
};
const precedence: Record<string, (node?: Node) => 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

@ -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',

Loading…
Cancel
Save