Loading lib/jsduck/ast.rb +5 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,11 @@ module JsDuck elsif exp && ident?(exp) make_property(to_s(exp)) # "foo"; # "foo" (inside some expression) elsif string?(ast) make_property(to_value(ast)) # "foo"; (as a statement of it's own) elsif exp && string?(exp) make_property(to_value(exp)) Loading spec/ast_property_spec.rb +9 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,15 @@ describe "JsDuck::Ast detects property with" do it "lonely string" do detect("/** */ 'foo';")[:name].should == "foo" end it "string as function argument" do detect(<<-EOS)[:name].should == "foo" this.addEvents( /** */ "foo" ); EOS end end describe "type in var initialized with" do Loading Loading
lib/jsduck/ast.rb +5 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,11 @@ module JsDuck elsif exp && ident?(exp) make_property(to_s(exp)) # "foo"; # "foo" (inside some expression) elsif string?(ast) make_property(to_value(ast)) # "foo"; (as a statement of it's own) elsif exp && string?(exp) make_property(to_value(exp)) Loading
spec/ast_property_spec.rb +9 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,15 @@ describe "JsDuck::Ast detects property with" do it "lonely string" do detect("/** */ 'foo';")[:name].should == "foo" end it "string as function argument" do detect(<<-EOS)[:name].should == "foo" this.addEvents( /** */ "foo" ); EOS end end describe "type in var initialized with" do Loading