/**
 * enums.js
 * Andrea Tino - 2015
 */

/**
 * Detects and collects enums in the ScriptSharp source code.
 */
module.exports = function() {
  var nodeTypes = require('./JSParser/nodeTypes.js');
  
  var enums = [];
  
  return {
    /**
     * Locates enums in the AST and stores all ids.
     * ast: A valid AST browser
     */
    retrieveTypes: function(ast) {
      if (!ast) {
        throw 'Error: AST cannot be null or undefined!';
      }
      
      ast.browseThroughNodes(nodeTypes.NODE_PROGRAM, function(d) {
        // We can add it
        classes.push(null);
      });
    }
  };
};


@@ -203,18 +203,36 @@
 var 
-enums = %5B%5D
+ast = null;%0A  var src = null
 ;%0A  
@@ -262,84 +262,482 @@
   * 
-Locates enums in the
+Initializes the module.%0A     * _ast: A valid AST browser.%0A     * _src: A valid source locator.%0A     */%0A    initialize: function(_ast, _src) %7B%0A      if (!ast) %7B%0A        throw 'Error:
  AST 
+c
 an
-d stores all ids.%0A     * ast: A valid AST browser
+not be null or undefined!';%0A      %7D%0A      if (!src) %7B%0A        throw 'Error: Source cannot be null or undefined!';%0A      %7D%0A      %0A      ast = _ast;%0A      src = _src;%0A    %7D,%0A    %0A    /**%0A     * Locates classes in the AST and stores all ids.%0A     * return: The array of classes ids found.
 %0A   
@@ -769,19 +769,16 @@
 unction(
-ast
 ) %7B%0A    
@@ -779,32 +779,40 @@
 %7B%0A      if (!ast
+ %7C%7C !src
 ) %7B%0A        thro
@@ -825,50 +825,69 @@
 or: 
-AST cannot be null or undefined!';%0A      %7D
+Initialization needed!';%0A      %7D%0A      %0A      var enums = %5B%5D;
 %0A   
@@ -938,15 +938,22 @@
 ODE_
-PROGRAM
+STATEMENT_EXPR
 , fu
@@ -997,22 +997,20 @@
         
-classe
+enum
 s.push(n
@@ -1025,16 +1025,43 @@
     %7D);%0A
+      %0A      return enums;%0A
     %7D%0A  

Update enums.js