add AST_SymbolConst for names defined with const

This commit is contained in:
Mihai Bazon
2012-10-02 12:22:39 +03:00
parent ff696cd7bc
commit 347160c631
3 changed files with 15 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ function SymbolDef(scope, orig) {
this.global = false;
this.mangled_name = null;
this.undeclared = false;
this.constant = false;
};
SymbolDef.prototype = {
@@ -144,9 +145,11 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(){
(node.scope = scope.parent_scope).def_function(node);
node.init.push(tw.parent());
}
else if (node instanceof AST_SymbolVar) {
scope.def_variable(node);
var def = tw.parent();
else if (node instanceof AST_SymbolVar
|| node instanceof AST_SymbolConst) {
var def = scope.def_variable(node);
def.constant = node instanceof AST_SymbolConst;
def = tw.parent();
if (def.value) node.init.push(def);
}
else if (node instanceof AST_SymbolCatch) {