Commit fa13d4f0 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Allow mixins to be an array of strings.

parent aad238b0
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -270,12 +270,18 @@ module JsDuck
      end
    end

    # <mixins> := "mixins" ":" <object-literal>
    # <mixins> := "mixins" ":" [ <object-literal> | <array-literal> ]
    def ext_define_mixins
      if look("mixins", ":", "{")
      if look("mixins", ":")
        match("mixins", ":")
        lit = literal
        lit && lit[:value].map {|x| x[:value][:value] }
        if lit && lit[:type] == :object
          lit[:value].map {|x| x[:value][:value] }
        elsif lit && lit[:type] == :array
          lit[:value].map {|x| x[:value] }
        else
          nil
        end
      end
    end

+4 −4
Original line number Diff line number Diff line
@@ -256,10 +256,10 @@ describe JsDuck::Aggregator do
          alternateClassName: ['JustClass'],
          stuff: ["foo", "bar"],
          requires: ['ClassA', 'ClassB'],
          mixins: {
            obs: 'Ext.util.Observable',
            bar: 'Foo.Bar'
          }
          mixins: [
            'Ext.util.Observable',
            'Foo.Bar'
          ]
        });
      EOS
    end