Skip to content

Commit

Permalink
[Feature] ast.js: +Ast.SourceLocation.meta, some cleanul on Ast.Ident…
Browse files Browse the repository at this point in the history
…ifier
  • Loading branch information
Yoric committed Mar 18, 2012
1 parent c0de3e9 commit 18496e8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/comp/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Ast.SourceLocation.prototype = {
return this.source+" ["+this.start+"-"+this.end+"]";
}
};
Ast.SourceLocation.meta = new Ast.SourceLocation("(part of JavaScript)", "alpha", "omega");

Ast.Directive = function Directive(range, type, string, key, code, name) {
this.type = type;
this.value = string;
Expand Down Expand Up @@ -542,11 +544,10 @@ Ast.IfStatement.prototype.walk = function(cb) {
return this.walk_exit(cb.IfStatement);
};

Ast.Identifier = function Identifier(loc, range, comments, name, isexpr, info) {
Ast.Identifier = function Identifier(loc, range, comments, name) {
Ast.Node.call(this, loc, range, comments);
this.name = name;
this.isexpr = isexpr || false;
this.info = info || {};
this.info = {};
};
Ast.Identifier.prototype = new Ast.Node();
Ast.Identifier.prototype.type = "Identifier";
Expand Down Expand Up @@ -625,6 +626,9 @@ Ast.VariableDeclarator.prototype.isConst = function() {
Ast.VariableDeclarator.prototype.isParam = function() {
return this.kind == "argument";
};
Ast.VariableDeclarator.prototype.isFunction = function() {
return this.kind == "function";
};
Ast.VariableDeclarator.prototype.walk = function(cb) {
let result;
if ((result = this.walk_enter(cb.VariableDeclarator))) {
Expand Down

0 comments on commit 18496e8

Please sign in to comment.