File compiler.js
has 1050 lines of code (exceeds 250 allowed). Consider refactoring.
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
Function LambdaCompiler
has 194 lines of code (exceeds 25 allowed). Consider refactoring.
var LambdaCompiler = (function (_super) {
__extends(LambdaCompiler, _super);
function LambdaCompiler() {
_super.call(this);
this._stack = new Array();
Function Expression
has 107 lines of code (exceeds 25 allowed). Consider refactoring.
var Expression = (function () {
function Expression(nodeType) {
this.nodeType = nodeType;
}
Expression.prototype.accept = function (visitor) {
Function BonsaiVisitor
has 100 lines of code (exceeds 25 allowed). Consider refactoring.
var BonsaiVisitor = (function (_super) {
__extends(BonsaiVisitor, _super);
function BonsaiVisitor() {
_super.apply(this, arguments);
}
Function LambdaCompiler
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
var LambdaCompiler = (function (_super) {
__extends(LambdaCompiler, _super);
function LambdaCompiler() {
_super.call(this);
this._stack = new Array();
Function PrintVisitor
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
var PrintVisitor = (function (_super) {
__extends(PrintVisitor, _super);
function PrintVisitor() {
_super.apply(this, arguments);
}
Function ExpressionVisitorGeneric
has 51 lines of code (exceeds 25 allowed). Consider refactoring.
var ExpressionVisitorGeneric = (function () {
function ExpressionVisitorGeneric() {
}
ExpressionVisitorGeneric.prototype.visit = function (node) {
if (node === null) {
Function ExpressionVisitor
has 51 lines of code (exceeds 25 allowed). Consider refactoring.
var ExpressionVisitor = (function () {
function ExpressionVisitor() {
}
ExpressionVisitor.prototype.visit = function (node) {
if (node === null) {
Function LambdaExpression
has 48 lines of code (exceeds 25 allowed). Consider refactoring.
var LambdaExpression = (function (_super) {
__extends(LambdaExpression, _super);
function LambdaExpression(body, parameters) {
_super.call(this, 2 );
this._body = body;
Function visitBinary
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
LambdaCompiler.prototype.visitBinary = function (node) {
this.visit(node.left);
this.visit(node.right);
var r = this._stack.pop();
var l = this._stack.pop();
Function FunctionCallExpression
has 40 lines of code (exceeds 25 allowed). Consider refactoring.
var FunctionCallExpression = (function (_super) {
__extends(FunctionCallExpression, _super);
function FunctionCallExpression(expression, methodName, args) {
_super.call(this, 28 );
this._expression = expression;
Function ConditionalExpression
has 40 lines of code (exceeds 25 allowed). Consider refactoring.
var ConditionalExpression = (function (_super) {
__extends(ConditionalExpression, _super);
function ConditionalExpression(test, ifTrue, ifFalse) {
_super.call(this, 26 );
this._test = test;
Function visitBinary
has 40 lines of code (exceeds 25 allowed). Consider refactoring.
BonsaiVisitor.prototype.visitBinary = function (node) {
var i = "";
switch (node.nodeType) {
case 3 :
i = "+";
Function BinaryExpression
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
var BinaryExpression = (function (_super) {
__extends(BinaryExpression, _super);
function BinaryExpression(nodeType, left, right) {
_super.call(this, nodeType);
this._left = left;
Function FreeVariableScanner
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
var FreeVariableScanner = (function (_super) {
__extends(FreeVariableScanner, _super);
function FreeVariableScanner() {
_super.call(this);
this._stack = new Array();
Function InvocationExpression
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var InvocationExpression = (function (_super) {
__extends(InvocationExpression, _super);
function InvocationExpression(expression, args) {
_super.call(this, 21 );
this._expression = expression;
Function IndexExpression
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var IndexExpression = (function (_super) {
__extends(IndexExpression, _super);
function IndexExpression(expression, args) {
_super.call(this, 30 );
this._expression = expression;
Function MemberExpression
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var MemberExpression = (function (_super) {
__extends(MemberExpression, _super);
function MemberExpression(obj, memberName) {
_super.call(this, 29 );
this._obj = obj;
Function NewExpression
has 32 lines of code (exceeds 25 allowed). Consider refactoring.
var NewExpression = (function (_super) {
__extends(NewExpression, _super);
function NewExpression(typeName, args) {
_super.call(this, 27 );
this._type = typeName;
Function Expression
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
var Expression = (function () {
function Expression(nodeType) {
this.nodeType = nodeType;
}
Expression.prototype.accept = function (visitor) {
Function Binder
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
var Binder = (function (_super) {
__extends(Binder, _super);
function Binder(resources) {
_super.call(this);
this._stack = new Array();
Function BonsaiVisitor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
var BonsaiVisitor = (function (_super) {
__extends(BonsaiVisitor, _super);
function BonsaiVisitor() {
_super.apply(this, arguments);
}
Function Binder
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
var Binder = (function (_super) {
__extends(Binder, _super);
function Binder(resources) {
_super.call(this);
this._stack = new Array();
Function FreeVariableScanner
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
var FreeVariableScanner = (function (_super) {
__extends(FreeVariableScanner, _super);
function FreeVariableScanner() {
_super.call(this);
this._stack = new Array();
Function PrintVisitor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
var PrintVisitor = (function (_super) {
__extends(PrintVisitor, _super);
function PrintVisitor() {
_super.apply(this, arguments);
}
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case 3 :
i = "+";
break;
case 4 :
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case 3 :
i = "+";
break;
case 4 :
Similar blocks of code found in 2 locations. Consider refactoring.
var InvocationExpression = (function (_super) {
__extends(InvocationExpression, _super);
function InvocationExpression(expression, args) {
_super.call(this, 21 );
this._expression = expression;
Similar blocks of code found in 2 locations. Consider refactoring.
var IndexExpression = (function (_super) {
__extends(IndexExpression, _super);
function IndexExpression(expression, args) {
_super.call(this, 30 );
this._expression = expression;
Similar blocks of code found in 2 locations. Consider refactoring.
var ConstantExpression = (function (_super) {
__extends(ConstantExpression, _super);
function ConstantExpression(value) {
_super.call(this, 0 );
this._value = value;
Similar blocks of code found in 2 locations. Consider refactoring.
var ParameterExpression = (function (_super) {
__extends(ParameterExpression, _super);
function ParameterExpression(name) {
_super.call(this, 1 );
this._name = name;
Similar blocks of code found in 2 locations. Consider refactoring.
ExpressionVisitorGeneric.prototype.visitMany = function (nodes) {
var res = new Array(nodes.length);
for (var i = 0; i < nodes.length; i++) {
var oldNode = nodes[i];
var newNode = this.visit(oldNode);
Similar blocks of code found in 2 locations. Consider refactoring.
ExpressionVisitor.prototype.visitMany = function (nodes) {
var res = new Array(nodes.length);
for (var i = 0; i < nodes.length; i++) {
var oldNode = nodes[i];
var newNode = this.visit(oldNode);
Similar blocks of code found in 2 locations. Consider refactoring.
PrintVisitor.prototype.visitLambda = function (node) {
var body = this.visit(node.body);
var children = this.visitMany(node.parameters);
children.unshift(body);
return "Lambda(" + children.join(", ") + ")";
Similar blocks of code found in 2 locations. Consider refactoring.
PrintVisitor.prototype.visitInvoke = function (node) {
var expression = this.visit(node.expression);
var children = this.visitMany(node.args);
children.unshift(expression);
return "Invoke(" + children.join(", ") + ")";
Similar blocks of code found in 4 locations. Consider refactoring.
Expression.lambda = function (body) {
var parameters = [];
for (var _i = 1; _i < arguments.length; _i++) {
parameters[_i - 1] = arguments[_i];
}
Similar blocks of code found in 4 locations. Consider refactoring.
Expression.invoke = function (expression) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
Similar blocks of code found in 4 locations. Consider refactoring.
Expression.index = function (obj) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
Similar blocks of code found in 4 locations. Consider refactoring.
Expression.new = function (typeName) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case 23 :
i = "-";
break;
case 24 :
Identical blocks of code found in 2 locations. Consider refactoring.
switch (node.nodeType) {
case 23 :
i = "-";
break;
case 24 :
Similar blocks of code found in 2 locations. Consider refactoring.
FreeVariableScanner.prototype.visitLambda = function (node) {
this._stack.push(node.parameters);
this.visit(node.body);
this._stack.pop();
return node;
Similar blocks of code found in 2 locations. Consider refactoring.
Binder.prototype.visitLambda = function (node) {
this._stack.push(node.parameters);
this.visit(node.body);
this._stack.pop();
return node;
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 2 locations. Consider refactoring.
function ConditionalExpression(test, ifTrue, ifFalse) {
_super.call(this, 26 );
this._test = test;
this._ifTrue = ifTrue;
this._ifFalse = ifFalse;
Similar blocks of code found in 2 locations. Consider refactoring.
function FunctionCallExpression(expression, methodName, args) {
_super.call(this, 28 );
this._expression = expression;
this._method = methodName;
this._args = args;
Similar blocks of code found in 5 locations. Consider refactoring.
ExpressionVisitor.prototype.visitCall = function (node) {
return node.update(this.visit(node.obj), this.visitMany(node.args));
};
Similar blocks of code found in 5 locations. Consider refactoring.
ExpressionVisitor.prototype.visitIndex = function (node) {
return node.update(this.visit(node.obj), this.visitMany(node.args));
};
Similar blocks of code found in 5 locations. Consider refactoring.
ExpressionVisitor.prototype.visitBinary = function (node) {
return node.update(this.visit(node.left), this.visit(node.right));
};
Similar blocks of code found in 5 locations. Consider refactoring.
ExpressionVisitor.prototype.visitLambda = function (node) {
return node.update(this.visit(node.body), this.visitMany(node.parameters));
};
Similar blocks of code found in 5 locations. Consider refactoring.
ExpressionVisitor.prototype.visitInvoke = function (node) {
return node.update(this.visit(node.expression), 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.
UnaryExpression.prototype.update = function (operand) {
if (operand !== this._operand) {
return new UnaryExpression(this.nodeType, operand);
}
return this;
Similar blocks of code found in 2 locations. Consider refactoring.
NewExpression.prototype.update = function (args) {
if (args !== this._args) {
return new NewExpression(this._type, args);
}
return this;
Similar blocks of code found in 2 locations. Consider refactoring.
ExpressionVisitor.prototype.visit = function (node) {
if (node === null) {
return null;
}
return node.accept(this);
Similar blocks of code found in 2 locations. Consider refactoring.
ExpressionVisitorGeneric.prototype.visit = function (node) {
if (node === null) {
return null;
}
return node.acceptGeneric(this);
There are no issues that match your filters.