Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-04-06 09:56:34 +08:00
commit 65987f8506
7 changed files with 68 additions and 27 deletions

View file

@ -1712,6 +1712,10 @@ Return value is the fall-through block name."
(defun comp-jump-table-optimizable (jmp-table)
"Return t if JMP-TABLE can be optimized out."
;; Identify LAP sequences like:
;; (byte-constant #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (created 126 deleted 126 changed 126)) . 24)
;; (byte-switch)
;; (TAG 126 . 10)
(cl-loop
with labels = (cl-loop for target-label being each hash-value of jmp-table
collect target-label)
@ -1719,7 +1723,10 @@ Return value is the fall-through block name."
for l in (cdr-safe labels)
unless (= l x)
return nil
finally return t))
finally return (pcase (nth (1+ (comp-limplify-pc comp-pass))
(comp-func-lap comp-func))
(`(TAG ,label . ,_label-sp)
(= label l)))))
(defun comp-emit-switch (var last-insn)
"Emit a Limple for a lap jump table given VAR and LAST-INSN."

View file

@ -146,11 +146,6 @@
;; "typedef" keyword. It's value is a list of the identifiers that
;; the "typedef" declares as types.
;;
;; 'c-<>-c-types-set
;; This property is set on an opening angle bracket, and indicates that
;; any "," separators within the template/generic expression have been
;; marked with a 'c-type property value 'c-<>-arg-sep (see above).
;;
;; 'c-awk-NL-prop
;; Used in AWK mode to mark the various kinds of newlines. See
;; cc-awk.el.
@ -6172,12 +6167,18 @@ comment at the start of cc-engine.el for more info."
(cons (point)
(cons bound-<> s)))))
(defvar c-record-type-identifiers) ; Specially for `c-brace-stack-at'.
(defun c-brace-stack-at (here)
;; Given a buffer position HERE, Return the value of the brace stack there.
(save-excursion
(save-restriction
(widen)
(let ((c c-bs-cache)
(let (c-record-type-identifiers ; In case `c-forward-<>-arglist' would
; otherwise record identifiers outside
; of the restriction in force before
; this function.
(c c-bs-cache)
(can-use-prev (<= c-bs-prev-pos c-bs-cache-limit))
elt stack pos npos high-elt)
;; Trim the cache to take account of buffer changes.
@ -8630,11 +8631,9 @@ multi-line strings (but not C++, for example)."
;; List that collects the positions after the argument
;; separating ',' in the arglist.
arg-start-pos)
;; If the '<' has paren open syntax then we've marked it as an angle
;; bracket arglist before, so skip to the end.
(if (and syntax-table-prop-on-<
(or (not c-parse-and-markup-<>-arglists)
(c-get-char-property (point) 'c-<>-c-types-set)))
(if (and (not c-parse-and-markup-<>-arglists)
syntax-table-prop-on-<)
(progn
(forward-char)
(if (and (c-go-up-list-forward)
@ -8731,7 +8730,6 @@ multi-line strings (but not C++, for example)."
(c-unmark-<->-as-paren (point)))))
(c-mark-<-as-paren start)
(c-mark->-as-paren (1- (point)))
(c-put-char-property start 'c-<>-c-types-set t)
(c-truncate-lit-pos-cache start))
(setq res t)
nil)) ; Exit the loop.
@ -11200,7 +11198,7 @@ This function might do hidden buffer changes."
;; declaration.
(setq maybe-expression t)
(when (or (not c-asymmetry-fontification-flag)
(looking-at "=[^=]")
(looking-at "=\\([^=]\\|$\\)\\|;")
(c-fdoc-assymetric-space-about-asterisk))
(when (eq at-type 'maybe)
(setq unsafe-maybe t))

View file

@ -2678,9 +2678,7 @@ need for `c-font-lock-extra-types'.")
'same)
(looking-at c-colon-type-list-re)))
;; Inherited protected member: leave unfontified
)
(t (goto-char pos)
(c-font-lock-declarators limit nil c-label-face-name nil)))
))
(eq (char-after) ?,)))
(forward-char))) ; over the comma.
nil))

View file

@ -169,7 +169,13 @@
(defun elixir-ts--argument-indent-offset (node _parent &rest _)
"Return the argument offset position for NODE."
(if (treesit-node-prev-sibling node t) 0 elixir-ts-indent-offset))
(if (or (treesit-node-prev-sibling node t)
;; Don't indent if this is the first node or
;; if the line is empty.
(save-excursion
(beginning-of-line)
(looking-at-p "[[:blank:]]*$")))
0 elixir-ts-indent-offset))
(defun elixir-ts--argument-indent-anchor (node parent &rest _)
"Return the argument anchor position for NODE and PARENT."
@ -264,7 +270,7 @@
;; Handle incomplete maps when parent is ERROR.
((n-p-gp "^binary_operator$" "ERROR" nil) parent-bol 0)
;; When there is an ERROR, just indent to prev-line.
((parent-is "ERROR") prev-line 0)
((parent-is "ERROR") prev-line ,offset)
((node-is "^binary_operator$")
(lambda (node parent &rest _)
(let ((top-level
@ -449,16 +455,13 @@
:override t
`((sigil
(sigil_name) @elixir-ts-font-sigil-name-face
quoted_start: _ @font-lock-string-face
quoted_end: _ @font-lock-string-face
(:match "^[sSwWpP]$" @elixir-ts-font-sigil-name-face))
(:match "^[sSwWpPUD]$" @elixir-ts-font-sigil-name-face))
@font-lock-string-face
(sigil
"~" @font-lock-string-face
(sigil_name) @elixir-ts-font-sigil-name-face
quoted_start: _ @font-lock-regex-face
quoted_end: _ @font-lock-regex-face
(:match "^[rR]$" @elixir-ts-font-sigil-name-face))
@font-lock-regex-face
@font-lock-regexp-face
(sigil
"~" @font-lock-string-face
(sigil_name) @elixir-ts-font-sigil-name-face

View file

@ -1121,9 +1121,13 @@ leading double colon is not added."
"array"
"hash"
"parenthesized_statements"
"method_parameters"
"array_pattern"
"hash_pattern"
"if"
"unless"
"case"
"case_match"
"when"
"block"
"do_block"
@ -1132,8 +1136,8 @@ leading double colon is not added."
"identifier"
"constant"
"simple_symbol"
"symbol_array"
"hash_key_symbol"
"symbol_array"
"string"
"string_array"
"heredoc_body"

View file

@ -1,6 +1,5 @@
Code:
(lambda ()
(setq indent-tabs-mode nil)
(elixir-ts-mode)
(indent-region (point-min) (point-max)))
@ -330,3 +329,22 @@ defmodule Foo do
end
end
=-=-=
Code:
(lambda ()
(elixir-ts-mode)
(newline)
(indent-for-tab-command))
Name: New list item
=-=
[
:foo,$
]
=-=
[
:foo,
$
]
=-=-=

View file

@ -518,6 +518,19 @@
(defun comp-test-48029-nonascii-žžž-f (arg)
(when arg t))
(defun comp-test-62537-1-f ())
(defun comp-test-62537-2-f ()
(when (let ((val (comp-test-62537-1-f)))
(cond
((eq val 'x)
t)
((eq val 'y)
'y)))
(comp-test-62537-1-f))
t)
;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests ;;