File compiler.ts
has 966 lines of code (exceeds 250 allowed). Consider refactoring.
class Expression {
nodeType: ExpressionType;
constructor(nodeType: ExpressionType) {
this.nodeType = nodeType;
Expression
has 36 functions (exceeds 20 allowed). Consider refactoring.
class Expression {
nodeType: ExpressionType;
constructor(nodeType: ExpressionType) {
this.nodeType = nodeType;
Function visitBinary
has 64 lines of code (exceeds 25 allowed). Consider refactoring.
visitBinary(node: BinaryExpression): Expression {
this.visit(node.left);
this.visit(node.right);
var r = this._stack.pop();
Function visitBinary
has 58 lines of code (exceeds 25 allowed). Consider refactoring.
visitBinary(node: BinaryExpression): any {
var i = "";
switch (node.nodeType) {
case ExpressionType.Add:
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case ExpressionType.Add:
i = "+";
break;
case ExpressionType.Subtract:
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case ExpressionType.Add:
i = "+";
break;
case ExpressionType.Subtract:
Similar blocks of code found in 2 locations. Consider refactoring.
class IndexExpression extends Expression {
_expression: Expression;
_args: Expression[];
constructor(expression: Expression, args: Expression[]) {
Similar blocks of code found in 2 locations. Consider refactoring.
class InvocationExpression extends Expression {
_expression: Expression;
_args: Expression[];
constructor(expression: Expression, args: Expression[]) {
Similar blocks of code found in 2 locations. Consider refactoring.
visitMany<T extends Expression>(nodes: T[]): T[] {
var res = new Array<T>(nodes.length);
for (var i = 0; i < nodes.length; i++) {
var oldNode = nodes[i];
Similar blocks of code found in 2 locations. Consider refactoring.
visitMany<E extends Expression>(nodes: E[]): T[] {
var res = new Array<T>(nodes.length);
for (var i = 0; i < nodes.length; i++) {
var oldNode = nodes[i];
Identical blocks of code found in 2 locations. Consider refactoring.
visitLambda<T extends Function>(node: LambdaExpression<T>): Expression {
this._stack.push(node.parameters);
this.visit(node.body);
Identical blocks of code found in 2 locations. Consider refactoring.
visitLambda<T extends Function>(node: LambdaExpression<T>): Expression {
this._stack.push(node.parameters);
this.visit(node.body);
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case ExpressionType.Negate:
i = "-";
break;
case ExpressionType.UnaryPlus:
Similar blocks of code found in 2 locations. Consider refactoring.
visitLambda<T extends Function>(node: LambdaExpression<T>): string {
var body = this.visit(node.body);
var children = this.visitMany(node.parameters);
children.unshift(body);
return "Lambda(" + children.join(", ") + ")";
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case ExpressionType.Negate:
i = "-";
break;
case ExpressionType.UnaryPlus:
Similar blocks of code found in 2 locations. Consider refactoring.
visitInvoke(node: InvocationExpression): string {
var expression = this.visit(node.expression);
var children = this.visitMany(node.args);
children.unshift(expression);
return "Invoke(" + children.join(", ") + ")";
Identical blocks of code found in 2 locations. Consider refactoring.
for (var i = this._stack.length - 1; i >= 0; i--) {
if (this._stack[i].indexOf(node) >= 0) {
found = true;
break;
}
Identical blocks of code found in 2 locations. Consider refactoring.
for (var i = this._stack.length - 1; i >= 0; i--) {
if (this._stack[i].indexOf(node) >= 0) {
found = true;
break;
}
Similar blocks of code found in 4 locations. Consider refactoring.
visitCall(node: FunctionCallExpression): Expression {
return node.update(this.visit(node.obj), this.visitMany(node.args));
}
Similar blocks of code found in 4 locations. Consider refactoring.
visitInvoke(node: InvocationExpression): Expression {
return node.update(this.visit(node.expression), this.visitMany(node.args));
}
Similar blocks of code found in 4 locations. Consider refactoring.
visitBinary(node: BinaryExpression): Expression {
return node.update(this.visit(node.left), this.visit(node.right));
}
Similar blocks of code found in 4 locations. Consider refactoring.
visitIndex(node: IndexExpression): Expression {
return node.update(this.visit(node.obj), this.visitMany(node.args));
}
Identical blocks of code found in 5 locations. Consider refactoring.
for (var i = 0; i < n; i++) {
args[n - i - 1] = this._stack.pop();
}
Identical blocks of code found in 5 locations. Consider refactoring.
for (var i = 0; i < n; i++) {
args[n - i - 1] = this._stack.pop();
}
Identical blocks of code found in 5 locations. Consider refactoring.
for (var i = 0; i < n; i++) {
args[n - i - 1] = this._stack.pop();
}
Identical blocks of code found in 5 locations. Consider refactoring.
for (var i = 0; i < n; i++) {
args[n - i - 1] = this._stack.pop();
}
Identical blocks of code found in 5 locations. Consider refactoring.
for (var i = 0; i < n; i++) {
args[n - i - 1] = this._stack.pop();
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (node.obj !== null) {
this.visit(node.obj);
res = this._stack.pop() + ".";
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (node.obj !== null) {
this.visit(node.obj);
res = this._stack.pop() + ".";
}
Similar blocks of code found in 2 locations. Consider refactoring.
constructor(test: Expression, ifTrue: Expression, ifFalse: Expression) {
super(ExpressionType.Condition);
this._test = test;
this._ifTrue = ifTrue;
this._ifFalse = ifFalse;
Similar blocks of code found in 2 locations. Consider refactoring.
constructor(expression: Expression, methodName: string, args: Expression[]) {
super(ExpressionType.Call);
this._expression = expression;
this._method = methodName;
this._args = args;
Similar blocks of code found in 2 locations. Consider refactoring.
visit(node: Expression): Expression {
if (node === null) {
return null;
}
return node.accept(this);
Similar blocks of code found in 2 locations. Consider refactoring.
visit(node: Expression): T {
if (node === null) {
return null;
}
return node.acceptGeneric(this);
There are no issues that match your filters.