MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / CheckAccess

Function CheckAccess

engine/3rdparty/tinyobjloader/deps/cpplint.py:2969–2996  ·  view source on GitHub ↗

Checks for improper use of DISALLOW* macros. 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

(filename, clean_lines, linenum, nesting_state, error)

Source from the content-addressed store, hash-verified

2967
2968
2969def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
2970 """Checks for improper use of DISALLOW* macros.
2971
2972 Args:
2973 filename: The name of the current file.
2974 clean_lines: A CleansedLines instance containing the file.
2975 linenum: The number of the line to check.
2976 nesting_state: A NestingState instance which maintains information about
2977 the current stack of nested blocks being parsed.
2978 error: The function to call with any errors found.
2979 """
2980 line = clean_lines.elided[linenum] # get rid of comments and strings
2981
2982 matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
2983 r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
2984 if not matched:
2985 return
2986 if nesting_state.stack and isinstance(nesting_state.stack[-1], _ClassInfo):
2987 if nesting_state.stack[-1].access != 'private':
2988 error(filename, linenum, 'readability/constructors', 3,
2989 '%s must be in the private: section' % matched.group(1))
2990
2991 else:
2992 # Found DISALLOW* macro outside a class declaration, or perhaps it
2993 # was used inside a function when it should have been part of the
2994 # class declaration. We could issue a warning here, but it
2995 # probably resulted in a compiler error already.
2996 pass
2997
2998
2999def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):

Callers 1

CheckStyleFunction · 0.85

Calls 2

MatchFunction · 0.85
errorFunction · 0.50

Tested by

no test coverage detected