Loading lib/jsduck/js/ast.rb +4 −7 Original line number Diff line number Diff line Loading @@ -50,16 +50,13 @@ module JsDuck def detect(node) ast = Js::Node.create(node) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil if doc = Js::Class.detect(ast, exp, var, @docs) if doc = Js::Class.detect(ast, @docs) doc elsif doc = Js::Method.detect(ast, exp, var) elsif doc = Js::Method.detect(ast) doc elsif doc = Js::Event.detect(ast, exp, var) elsif doc = Js::Event.detect(ast) doc elsif doc = Js::Property.detect(ast, exp, var) elsif doc = Js::Property.detect(ast) doc else Js::Property.make() Loading lib/jsduck/js/class.rb +4 −1 Original line number Diff line number Diff line Loading @@ -13,9 +13,12 @@ module JsDuck # Checks if AST node is a class, and if so, returns doc-hash # with clas name and various auto-detected attributes. # When not a class returns nil. def detect(ast, exp, var, docs) def detect(ast, docs) @docs = docs exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # Ext.define("Class", {}) if exp && exp.ext_define? make(exp["arguments"][0].to_value, exp) Loading lib/jsduck/js/event.rb +3 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,9 @@ module JsDuck # Checks if AST node is an event, and if so, returns doc-hash # with event name and various auto-detected properties. # When not an event returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil # this.fireEvent("foo", ...) if exp && exp.fire_event? make(exp["arguments"][0].to_value) Loading lib/jsduck/js/method.rb +4 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,10 @@ module JsDuck # Checks if AST node is a method, and if so, returns doc-hash # with method name and various auto-detected properties. # When not a method returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # function foo() {} if ast.function? make(ast["id"].to_s || "", ast) Loading lib/jsduck/js/property.rb +4 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,10 @@ module JsDuck # Checks if AST node is a property, and if so, returns doc-hash # with property name and various auto-detected attributes. # When not a property returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # foo = ... if exp && exp.assignment_expression? make(exp["left"].to_s, exp["right"]) Loading Loading
lib/jsduck/js/ast.rb +4 −7 Original line number Diff line number Diff line Loading @@ -50,16 +50,13 @@ module JsDuck def detect(node) ast = Js::Node.create(node) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil if doc = Js::Class.detect(ast, exp, var, @docs) if doc = Js::Class.detect(ast, @docs) doc elsif doc = Js::Method.detect(ast, exp, var) elsif doc = Js::Method.detect(ast) doc elsif doc = Js::Event.detect(ast, exp, var) elsif doc = Js::Event.detect(ast) doc elsif doc = Js::Property.detect(ast, exp, var) elsif doc = Js::Property.detect(ast) doc else Js::Property.make() Loading
lib/jsduck/js/class.rb +4 −1 Original line number Diff line number Diff line Loading @@ -13,9 +13,12 @@ module JsDuck # Checks if AST node is a class, and if so, returns doc-hash # with clas name and various auto-detected attributes. # When not a class returns nil. def detect(ast, exp, var, docs) def detect(ast, docs) @docs = docs exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # Ext.define("Class", {}) if exp && exp.ext_define? make(exp["arguments"][0].to_value, exp) Loading
lib/jsduck/js/event.rb +3 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,9 @@ module JsDuck # Checks if AST node is an event, and if so, returns doc-hash # with event name and various auto-detected properties. # When not an event returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil # this.fireEvent("foo", ...) if exp && exp.fire_event? make(exp["arguments"][0].to_value) Loading
lib/jsduck/js/method.rb +4 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,10 @@ module JsDuck # Checks if AST node is a method, and if so, returns doc-hash # with method name and various auto-detected properties. # When not a method returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # function foo() {} if ast.function? make(ast["id"].to_s || "", ast) Loading
lib/jsduck/js/property.rb +4 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,10 @@ module JsDuck # Checks if AST node is a property, and if so, returns doc-hash # with property name and various auto-detected attributes. # When not a property returns nil. def detect(ast, exp, var) def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil var = ast.variable_declaration? ? ast["declarations"][0] : nil # foo = ... if exp && exp.assignment_expression? make(exp["left"].to_s, exp["right"]) Loading