seems cleaner if AST_Label doesn't inherit from AST_SymbolDeclaration
authorMihai Bazon <mihai@bazon.net>
Wed, 10 Oct 2012 08:37:51 +0000 (11:37 +0300)
committerMihai Bazon <mihai@bazon.net>
Wed, 10 Oct 2012 08:37:51 +0000 (11:37 +0300)
lib/ast.js
lib/scope.js

index 1ac1926..852f2a1 100644 (file)
@@ -785,7 +785,7 @@ var AST_Label = DEFNODE("Label", "references", {
     $propdoc: {
         references: "[AST_LabelRef*] a list of nodes referring to this label"
     }
-}, AST_SymbolDeclaration);
+}, AST_Symbol);
 
 var AST_SymbolRef = DEFNODE("SymbolRef", null, {
     $documentation: "Reference to some symbol (not definition/declaration)",
index 7edce0e..cd48084 100644 (file)
@@ -533,7 +533,7 @@ AST_Toplevel.DEFMETHOD("scope_warnings", function(options){
             AST_Node.warn("Eval is used [{file}:{line},{col}]", node.start);
         }
         if (options.unreferenced
-            && node instanceof AST_SymbolDeclaration
+            && (node instanceof AST_SymbolDeclaration || node instanceof AST_Label)
             && node.unreferenced()) {
             AST_Node.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]", {
                 type: node instanceof AST_Label ? "Label" : "Symbol",