def CheckForNonConstReference(filename, clean_lines, linenum,<EOL>nesting_state, error):
<EOL>line = clean_lines.elided[linenum]<EOL>if '<STR_LIT:&>' not in line:<EOL><INDENT>return<EOL><DEDENT>if IsDerivedFunction(clean_lines, linenum):<EOL><INDENT>return<EOL><DEDENT>if IsOutOfLineMethodDefinition(clean_lines, linenum):<EOL><INDENT>return<EOL><DEDENT>if linenum > <NUM_LIT:1>:<EOL><INDENT>previous = None<EOL>if Match(r'<STR_LIT>', line):<EOL><INDENT>previous = Search(r'<STR_LIT>',<EOL>clean_lines.elided[linenum - <NUM_LIT:1>])<EOL><DEDENT>elif Match(r'<STR_LIT>', line):<EOL><INDENT>previous = Search(r'<STR_LIT>',<EOL>clean_lines.elided[linenum - <NUM_LIT:1>])<EOL><DEDENT>if previous:<EOL><INDENT>line = previous.group(<NUM_LIT:1>) + line.lstrip()<EOL><DEDENT>else:<EOL><INDENT>endpos = line.rfind('<STR_LIT:>>')<EOL>if endpos > -<NUM_LIT:1>:<EOL><INDENT>(_, startline, startpos) = ReverseCloseExpression(<EOL>clean_lines, linenum, endpos)<EOL>if startpos > -<NUM_LIT:1> and startline < linenum:<EOL><INDENT>line = '<STR_LIT>'<EOL>for i in xrange(startline, linenum + <NUM_LIT:1>):<EOL><INDENT>line += clean_lines.elided[i].strip()<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if (nesting_state.previous_stack_top and<EOL>not (isinstance(nesting_state.previous_stack_top, _ClassInfo) or<EOL>isinstance(nesting_state.previous_stack_top, _NamespaceInfo))):<EOL><INDENT>return<EOL><DEDENT>if linenum > <NUM_LIT:0>:<EOL><INDENT>for i in xrange(linenum - <NUM_LIT:1>, max(<NUM_LIT:0>, linenum - <NUM_LIT:10>), -<NUM_LIT:1>):<EOL><INDENT>previous_line = clean_lines.elided[i]<EOL>if not Search(r'<STR_LIT>', previous_line):<EOL><INDENT>break<EOL><DEDENT>if Match(r'<STR_LIT>', previous_line):<EOL><INDENT>return<EOL><DEDENT><DEDENT><DEDENT>if Search(r'<STR_LIT>', line):<EOL><INDENT>return<EOL><DEDENT>if IsInitializerList(clean_lines, linenum):<EOL><INDENT>return<EOL><DEDENT>whitelisted_functions = (r'<STR_LIT>'<EOL>r'<STR_LIT>'<EOL>r'<STR_LIT>'<EOL>r'<STR_LIT>')<EOL>if Search(whitelisted_functions, line):<EOL><INDENT>return<EOL><DEDENT>elif not Search(r'<STR_LIT>', line):<EOL><INDENT>for i in xrange(<NUM_LIT:2>):<EOL><INDENT>if (linenum > i and<EOL>Search(whitelisted_functions, clean_lines.elided[linenum - i - <NUM_LIT:1>])):<EOL><INDENT>return<EOL><DEDENT><DEDENT><DEDENT>decls = ReplaceAll(r'<STR_LIT>', '<STR_LIT:U+0020>', line)  <EOL>for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls):<EOL><INDENT>if (not Match(_RE_PATTERN_CONST_REF_PARAM, parameter) and<EOL>not Match(_RE_PATTERN_REF_STREAM_PARAM, parameter)):<EOL><INDENT>error(filename, linenum, '<STR_LIT>', <NUM_LIT:2>,<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' +<EOL>ReplaceAll('<STR_LIT>', '<STR_LIT:<>', parameter))<EOL><DEDENT><DEDENT>
Check for non-const references.

    Separate from CheckLanguage since it scans backwards from current
    line, instead of scanning forward.

    Args:
      filename: The name of the current file.
      clean_lines: A CleansedLines instance containing the file.
      linenum: The number of the line to check.
      nesting_state: A NestingState instance which maintains information about
                     the current stack of nested blocks being parsed.
      error: The function to call with any errors found.