Skip to content

Commit

Permalink
Add basic scoring system
Browse files Browse the repository at this point in the history
  • Loading branch information
vesln committed Nov 9, 2013
1 parent 6ba06cf commit 5a8b942
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/hell/nodes/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Case() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/catch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Catch() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/conditional.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Conditional() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/dowhile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function DoWhile() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/for.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function For() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/forin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Forin() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
13 changes: 12 additions & 1 deletion lib/hell/nodes/if.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function If() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand All @@ -38,6 +38,17 @@ If.prototype.each = function(fn, ctx) {
}
};

/**
* Calculate extra score based on if `else` existence.
*
* @returns {Number}
* @api private
*/

If.prototype.extraScore = function() {
return this.params.alternate ? 1 : 0;
};

/**
* Primary export.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/logical.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Logical() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function Switch() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/while.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Node = require('./node');

function While() {
Node.apply(this, arguments);
this._score = 0;
this._score = 1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/hell/nodes/with.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
var Node = require('./node');

/**
* While Statement.
* With Statement.
*
* @constructor
*/
Expand Down

0 comments on commit 5a8b942

Please sign in to comment.