From 49bad2a0a662794089506a964cb7b470aff13826 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 26 Feb 2021 15:19:31 -0500 Subject: [PATCH] * lisp/cedet/semantic/analyze*.el: Use lexical-binding * lisp/cedet/semantic/analyze.el: Use lexical-binding. Rename the dynbound var `prefixtypes` to `semantic--prefixtypes`. (semantic--prefixtypes): Declare var. * lisp/cedet/semantic/analyze/complete.el: Use lexical-binding. (semantic--prefixtypes): Declare var. (semantic-analyze-possible-completions-default): Remove unused var `any`. Rename `prefixtypes` to `semantic--prefixtypes`. * lisp/cedet/semantic/analyze/debug.el: Use lexical-binding. (semantic-analyzer-debug-global-symbol): Remove no-op use of `prefixtypes`. * lisp/cedet/semantic/analyze/refs.el: * lisp/cedet/semantic/analyze/fcn.el: Use lexical-binding. --- lisp/cedet/semantic/analyze.el | 32 +++++++++++++------------ lisp/cedet/semantic/analyze/complete.el | 16 +++++++------ lisp/cedet/semantic/analyze/debug.el | 8 +++---- lisp/cedet/semantic/analyze/fcn.el | 4 ++-- lisp/cedet/semantic/analyze/refs.el | 4 ++-- 5 files changed, 34 insertions(+), 30 deletions(-) diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index c0a054dafc3..1a4be11c789 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el @@ -1,4 +1,4 @@ -;;; semantic/analyze.el --- Analyze semantic tags against local context +;;; semantic/analyze.el --- Analyze semantic tags against local context -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. @@ -167,7 +167,7 @@ of the parent function.") ;; Simple methods against the context classes. ;; (cl-defmethod semantic-analyze-type-constraint - ((context semantic-analyze-context) &optional desired-type) + ((_context semantic-analyze-context) &optional desired-type) "Return a type constraint for completing :prefix in CONTEXT. Optional argument DESIRED-TYPE may be a non-type tag to analyze." (when (semantic-tag-p desired-type) @@ -344,8 +344,8 @@ This function knows of flags: (setq tagtype (cons tmptype tagtype)) (when miniscope (let ((rawscope - (apply 'append - (mapcar 'semantic-tag-type-members tagtype)))) + (apply #'append + (mapcar #'semantic-tag-type-members tagtype)))) (oset miniscope fullscope rawscope))) ) (setq s (cdr s))) @@ -437,6 +437,8 @@ to provide a large number of non-cached analysis for filtering symbols." (:override))) ) +(defvar semantic--prefixtypes) + (defun semantic-analyze-current-symbol-default (analyzehookfcn position) "Call ANALYZEHOOKFCN on the analyzed symbol at POSITION." (let* ((semantic-analyze-error-stack nil) @@ -453,14 +455,14 @@ to provide a large number of non-cached analysis for filtering symbols." (catch 'unfindable ;; If debug on error is on, allow debugging in this fcn. (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes 'unfindable))) + prefix scope 'semantic--prefixtypes 'unfindable))) ;; Debug on error is off. Capture errors and move on (condition-case err ;; NOTE: This line is duplicated in ;; semantic-analyzer-debug-global-symbol ;; You will need to update both places. (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes)) + prefix scope 'semantic--prefixtypes)) (error (semantic-analyze-push-error err)))) ;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart nil)) @@ -531,7 +533,7 @@ Returns an object based on symbol `semantic-analyze-context'." (bounds (nth 2 prefixandbounds)) ;; @todo - vv too early to really know this answer! vv (prefixclass (semantic-ctxt-current-class-list)) - (prefixtypes nil) + (semantic--prefixtypes nil) (scope (semantic-calculate-scope position)) (function nil) (fntag nil) @@ -611,13 +613,13 @@ Returns an object based on symbol `semantic-analyze-context'." (if debug-on-error (catch 'unfindable (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes 'unfindable)) + prefix scope 'semantic--prefixtypes 'unfindable)) ;; If there's an alias, dereference it and analyze ;; sequence again. (when (setq newseq (semantic-analyze-dereference-alias prefix)) (setq prefix (semantic-analyze-find-tag-sequence - newseq scope 'prefixtypes 'unfindable)))) + newseq scope 'semantic--prefixtypes 'unfindable)))) ;; Debug on error is off. Capture errors and move on (condition-case err ;; NOTE: This line is duplicated in @@ -625,11 +627,11 @@ Returns an object based on symbol `semantic-analyze-context'." ;; You will need to update both places. (progn (setq prefix (semantic-analyze-find-tag-sequence - prefix scope 'prefixtypes)) + prefix scope 'semantic--prefixtypes)) (when (setq newseq (semantic-analyze-dereference-alias prefix)) (setq prefix (semantic-analyze-find-tag-sequence - newseq scope 'prefixtypes)))) + newseq scope 'semantic--prefixtypes)))) (error (semantic-analyze-push-error err)))) ) @@ -650,7 +652,7 @@ Returns an object based on symbol `semantic-analyze-context'." :prefix prefix :prefixclass prefixclass :bounds bounds - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) ;; No function, try assignment @@ -670,7 +672,7 @@ Returns an object based on symbol `semantic-analyze-context'." :bounds bounds :prefix prefix :prefixclass prefixclass - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) ;; TODO: Identify return value condition. @@ -686,7 +688,7 @@ Returns an object based on symbol `semantic-analyze-context'." :bounds bounds :prefix prefix :prefixclass prefixclass - :prefixtypes prefixtypes + :prefixtypes semantic--prefixtypes :errors semantic-analyze-error-stack))) (t (setq context-return nil)) @@ -750,7 +752,7 @@ Some useful functions are found in `semantic-format-tag-functions'." :group 'semantic :type semantic-format-tag-custom-list) -(defun semantic-analyze-princ-sequence (sequence &optional prefix buff) +(defun semantic-analyze-princ-sequence (sequence &optional prefix _buff) "Send the tag SEQUENCE to standard out. Use PREFIX as a label. Use BUFF as a source of override methods." diff --git a/lisp/cedet/semantic/analyze/complete.el b/lisp/cedet/semantic/analyze/complete.el index e8139ab1aea..ccf405d62e2 100644 --- a/lisp/cedet/semantic/analyze/complete.el +++ b/lisp/cedet/semantic/analyze/complete.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/complete.el --- Smart Completions +;;; semantic/analyze/complete.el --- Smart Completions -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -45,7 +45,7 @@ "For the tag TYPE, return any constant symbols of TYPE. Used as options when completing.") -(defun semantic-analyze-type-constants-default (type) +(defun semantic-analyze-type-constants-default (_type) "Do nothing with TYPE." nil) @@ -54,7 +54,7 @@ Used as options when completing.") (let ((origc tags)) ;; Accept only tags that are of the datatype specified by ;; the desired classes. - (setq tags (apply 'nconc ;; All input lists are permutable. + (setq tags (apply #'nconc ;; All input lists are permutable. (mapcar (lambda (class) (semantic-find-tags-by-class class origc)) classlist))) @@ -109,6 +109,8 @@ in a buffer." (when (called-interactively-p 'any) (error "Buffer was not parsed by Semantic.")))) +(defvar semantic--prefixtypes) + (defun semantic-analyze-possible-completions-default (context &optional flags) "Default method for producing smart completions. Argument CONTEXT is an object specifying the locally derived context. @@ -121,14 +123,14 @@ FLAGS can be any number of: (desired-type (semantic-analyze-type-constraint a)) (desired-class (oref a prefixclass)) (prefix (oref a prefix)) - (prefixtypes (oref a prefixtypes)) + (semantic--prefixtypes (oref a prefixtypes)) (completetext nil) (completetexttype nil) (scope (oref a scope)) (localvar (when scope (oref scope localvar))) (origc nil) (c nil) - (any nil) + ;; (any nil) (do-typeconstraint (not (memq 'no-tc flags))) (do-longprefix (not (memq 'no-longprefix flags))) (do-unique (not (memq 'no-unique flags))) @@ -138,7 +140,7 @@ FLAGS can be any number of: ;; If we are not doing the long prefix, shorten all the key ;; elements. (setq prefix (list (car (reverse prefix))) - prefixtypes nil)) + semantic--prefixtypes nil)) ;; Calculate what our prefix string is so that we can ;; find all our matching text. @@ -155,7 +157,7 @@ FLAGS can be any number of: ;; The prefixtypes should always be at least 1 less than ;; the prefix since the type is never looked up for the last ;; item when calculating a sequence. - (setq completetexttype (car (reverse prefixtypes))) + (setq completetexttype (car (reverse semantic--prefixtypes))) (when (or (not completetexttype) (not (and (semantic-tag-p completetexttype) (eq (semantic-tag-class completetexttype) 'type)))) diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index 4947368757e..58d6644f9a9 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/debug.el --- Debug the analyzer +;;; semantic/analyze/debug.el --- Debug the analyzer -*- lexical-binding: t; -*- ;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -109,11 +109,11 @@ Argument COMP are possible completions here." (condition-case err (with-current-buffer origbuf (let* ((position (or (cdr-safe (oref ctxt bounds)) (point))) - (prefixtypes nil) ; Used as type return + ;; (semantic--prefixtypes nil) ; Used as type return (scope (semantic-calculate-scope position)) ) (semantic-analyze-find-tag-sequence - (list prefix "") scope 'prefixtypes) + (list prefix "") scope) ;; 'semantic--prefixtypes ) ) (error (setq finderr err))) @@ -149,7 +149,7 @@ path was setup incorrectly.\n") (semantic-analyzer-debug-add-buttons) )) -(defun semantic-analyzer-debug-missing-datatype (ctxt idx comp) +(defun semantic-analyzer-debug-missing-datatype (ctxt idx _comp) "Debug why we can't find a datatype entry for CTXT prefix at IDX. Argument COMP are possible completions here." (let* ((prefixitem (nth idx (oref ctxt prefix))) diff --git a/lisp/cedet/semantic/analyze/fcn.el b/lisp/cedet/semantic/analyze/fcn.el index 10d11c33ebb..d47e8976e58 100644 --- a/lisp/cedet/semantic/analyze/fcn.el +++ b/lisp/cedet/semantic/analyze/fcn.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/fcn.el --- Analyzer support functions. +;;; semantic/analyze/fcn.el --- Analyzer support functions. -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -55,7 +55,7 @@ Return the string representing the compound name.") (defun semantic-analyze-unsplit-name-default (namelist) "Concatenate the names in NAMELIST with a . between." - (mapconcat 'identity namelist ".")) + (mapconcat #'identity namelist ".")) ;;; SELECTING ;; diff --git a/lisp/cedet/semantic/analyze/refs.el b/lisp/cedet/semantic/analyze/refs.el index a39ff6f6736..31cbb9e1173 100644 --- a/lisp/cedet/semantic/analyze/refs.el +++ b/lisp/cedet/semantic/analyze/refs.el @@ -1,4 +1,4 @@ -;;; semantic/analyze/refs.el --- Analysis of the references between tags. +;;; semantic/analyze/refs.el --- Analysis of the references between tags. -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -296,7 +296,7 @@ Only works for tags in the global namespace." (let* ((classmatch (semantic-tag-class tag)) (RES (semanticdb-find-tags-collector - (lambda (table tags) + (lambda (_table tags) (semantic-find-tags-by-class classmatch tags) ;; @todo - Add parent check also. ) -- 2.39.2