Skip to content

Commit

Permalink
use in instead of !!
Browse files Browse the repository at this point in the history
  • Loading branch information
army8735 committed Apr 3, 2014
1 parent c410d26 commit 50932c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/parser/js/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ var Context = Class(function(parent, name) {
return !this.isTop() && !this.name;
},
hasParam: function(p) {
return !!this.paramsMap[p];
return p in this.paramsMap;
},
getParams: function() {
return this.params;
},
addParam: function(p) {
//形参不可能重复,无需判断
this.paramsMap[p] = true;
this.paramsMap[p] = this.params.length;
this.params.push(p);
return this;
},
Expand All @@ -76,7 +76,7 @@ var Context = Class(function(parent, name) {
},
//通过name查找函数声明,id查找表达式
hasChild: function(name) {
return !!this.childrenMap[name];
return name in this.childrenMap;
},
addChild: function(child) {
var name = child.getName();
Expand All @@ -102,7 +102,7 @@ var Context = Class(function(parent, name) {
return this;
},
hasVar: function(v) {
return !!this.varsMap[v];
return v in this.varsMap;
},
addVar: function(node, assign) {
var v = node.leaves()[0].token().content();
Expand Down Expand Up @@ -138,7 +138,7 @@ var Context = Class(function(parent, name) {
return this.returns;
},
hasVid: function(v) {
return !!this.vidsMap[v];
return v in this.vidsMap;
},
getVid: function(v) {
return this.vidsMap[v];
Expand Down
2 changes: 1 addition & 1 deletion tests/covrage.html

Large diffs are not rendered by default.

0 comments on commit 50932c2

Please sign in to comment.