def check
defined_type_indexes.each do |class_idx|
unless class_idx[:param_tokens].nil?
paren_stack = []
class_idx[:param_tokens].each_with_index do |token, i|
if token.type == :LPAREN
paren_stack.push(true)
elsif token.type == :RPAREN
paren_stack.pop
end
next unless paren_stack.empty?
if token.type == :VARIABLE
if token.next_code_token.nil? || [:COMMA, :RPAREN].include?(token.next_code_token.type)
prev_tokens = class_idx[:param_tokens][0..i]
unless prev_tokens.rindex { |r| r.type == :EQUALS }.nil?
unless token.prev_code_token.nil? or token.prev_code_token.type == :EQUALS
msg = 'optional parameter listed before required parameter'
notify :warning, {
:message => msg,
:line => token.line,
:column => token.column,
}
end
end
end
end
end
end
end
end