Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Cleanup: lock some variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcd047 committed Apr 23, 2014
1 parent 02cbebd commit 3c07df5
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 7 deletions.
2 changes: 2 additions & 0 deletions autoload/syntastic/log.vim
Expand Up @@ -113,6 +113,7 @@ function! s:isDebugEnabled_dumb(level) " {{{2
endfunction " }}}2

let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb')
lockvar s:isDebugEnabled

function! s:logRedirect(on) " {{{2
if exists("g:syntastic_debug_file")
Expand All @@ -138,6 +139,7 @@ function! s:logTimestamp_dumb() " {{{2
endfunction " }}}2

let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb')
lockvar s:logTimestamp

function! s:formatVariable(name) " {{{2
let vals = []
Expand Down
1 change: 1 addition & 0 deletions autoload/syntastic/util.vim
Expand Up @@ -88,6 +88,7 @@ endfunction " }}}2
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
" and hope for the best :)
let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
lockvar s:width

"print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) " {{{2
Expand Down
25 changes: 19 additions & 6 deletions plugin/syntastic.vim
Expand Up @@ -16,9 +16,11 @@ let g:loaded_syntastic_plugin = 1

if has('reltime')
let g:syntastic_start = reltime()
lockvar! g:syntastic_start
endif

let g:syntastic_version = '3.4.0-43'
let g:syntastic_version = '3.4.0-44'
lockvar g:syntastic_version

" Sanity checks {{{1

Expand All @@ -30,13 +32,16 @@ for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'
endfor

let s:running_windows = syntastic#util#isRunningWindows()
lockvar s:running_windows

if !s:running_windows && executable('uname')
try
let s:uname = system('uname')
catch /\m^Vim\%((\a\+)\)\=:E484/
call syntastic#log#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections")
finish
endtry
lockvar s:uname
endif

" }}}1
Expand Down Expand Up @@ -70,6 +75,7 @@ let g:syntastic_defaults = {
\ 'style_warning_symbol': 'S>',
\ 'warning_symbol': '>>'
\ }
lockvar! g:syntastic_defaults

for s:key in keys(g:syntastic_defaults)
if !exists('g:syntastic_' . s:key)
Expand Down Expand Up @@ -106,13 +112,19 @@ let s:debug_dump_options = [
if v:version > 703 || (v:version == 703 && has('patch446'))
call add(s:debug_dump_options, 'shellxescape')
endif
lockvar! s:debug_dump_options

" debug constants
let g:SyntasticDebugTrace = 1
let g:SyntasticDebugLoclist = 2
let g:SyntasticDebugNotifications = 4
let g:SyntasticDebugAutocommands = 8
let g:SyntasticDebugVariables = 16
let g:SyntasticDebugTrace = 1
lockvar g:SyntasticDebugTrace
let g:SyntasticDebugLoclist = 2
lockvar g:SyntasticDebugLoclist
let g:SyntasticDebugNotifications = 4
lockvar g:SyntasticDebugNotifications
let g:SyntasticDebugAutocommands = 8
lockvar g:SyntasticDebugAutocommands
let g:SyntasticDebugVariables = 16
lockvar g:SyntasticDebugVariables

" }}}1

Expand Down Expand Up @@ -554,6 +566,7 @@ endfunction " }}}2
function! s:uname() " {{{2
if !exists('s:uname')
let s:uname = system('uname')
lockvar s:uname
endif
return s:uname
endfunction " }}}2
Expand Down
2 changes: 2 additions & 0 deletions plugin/syntastic/highlighting.vim
Expand Up @@ -5,6 +5,7 @@ let g:loaded_syntastic_notifier_highlighting = 1

" Highlighting requires getmatches introduced in 7.1.040
let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040'))
lockvar s:has_highlighting

let g:SyntasticHighlightingNotifier = {}

Expand All @@ -18,6 +19,7 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif

return newObj
Expand Down
1 change: 1 addition & 0 deletions plugin/syntastic/notifiers.vim
Expand Up @@ -6,6 +6,7 @@ let g:loaded_syntastic_notifiers = 1
let g:SyntasticNotifiers = {}

let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
lockvar! s:notifier_types

" Public methods {{{1

Expand Down
2 changes: 2 additions & 0 deletions plugin/syntastic/registry.vim
Expand Up @@ -89,12 +89,14 @@ let s:defaultCheckers = {
\ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck']
\ }
lockvar! s:defaultCheckers

let s:defaultFiletypeMap = {
\ 'gentoo-metadata': 'xml',
\ 'lhaskell': 'haskell',
\ 'litcoffee': 'coffee'
\ }
lockvar! s:defaultFiletypeMap

let g:SyntasticRegistry = {}

Expand Down
3 changes: 2 additions & 1 deletion plugin/syntastic/signs.vim
Expand Up @@ -25,6 +25,7 @@ function! g:SyntasticSignsNotifier.New() " {{{2
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif

return newObj
Expand All @@ -41,7 +42,7 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
call self._signErrors(a:loclist)
endif
call self._removeSigns(old_signs)
let s:first_sign_id = s:next_sign_id
let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000
endfunction " }}}2

" }}}1
Expand Down
4 changes: 4 additions & 0 deletions syntax_checkers/html/tidy.vim
Expand Up @@ -123,6 +123,7 @@ let s:ignore_errors = [
\ "proprietary attribute \"aria-valuenow\"",
\ "proprietary attribute \"aria-valuetext\""
\ ]
lockvar! s:ignore_errors

let s:blocklevel_tags = [
\ "main",
Expand All @@ -135,6 +136,7 @@ let s:blocklevel_tags = [
\ "figure",
\ "figcaption"
\ ]
lockvar! s:blocklevel_tags

let s:inline_tags = [
\ "video",
Expand All @@ -153,11 +155,13 @@ let s:inline_tags = [
\ "details",
\ "datalist"
\ ]
lockvar! s:inline_tags

let s:empty_tags = [
\ "wbr",
\ "keygen"
\ ]
lockvar! s:empty_tags

function! s:IgnoreError(text)
for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors
Expand Down
1 change: 1 addition & 0 deletions syntax_checkers/sass/sass.vim
Expand Up @@ -18,6 +18,7 @@ let g:loaded_syntastic_sass_sass_checker = 1
"sass caching for large files drastically speeds up the checking, but store it
"in a temp location otherwise sass puts .sass_cache dirs in the users project
let s:sass_cache_location = tempname()
lockvar s:sass_cache_location

"By default do not check partials as unknown variables are a syntax error
if !exists("g:syntastic_sass_check_partials")
Expand Down

0 comments on commit 3c07df5

Please sign in to comment.