Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / jsbuilder / src / Parser / Statement / Debug.js
diff --git a/jsbuilder/src/Parser/Statement/Debug.js b/jsbuilder/src/Parser/Statement/Debug.js
new file mode 100644 (file)
index 0000000..e58c32f
--- /dev/null
@@ -0,0 +1,38 @@
+Loader.require('Parser.Statement.If');
+
+(function() {
+
+var priorities = {
+    error: 3,
+    warn: 2,
+    info: 1
+};
+
+var Debug = Parser.Statement.Debug = Ext.extend(Parser.Statement.If, {
+    constructor: function() {
+        var priority, name;
+
+        Debug.superclass.constructor.apply(this, arguments);
+
+        this.setProperty('debug', true);
+
+        for (name in priorities) {
+            if (priorities.hasOwnProperty(name)) {
+                if (this.getProperty(name)) {
+                    priority = priorities[name];
+                    this.removeProperty(name);
+                    break;
+                }
+            }
+        }
+
+        if (!priority) {
+            priority = 1;
+        }
+
+        this.setProperty('debugLevel', '<=' + priority);
+    }
+});
+
+
+})();