Compare commits

..

9 Commits

Author SHA1 Message Date
Foxe Chen
cbcc5babba patch 9.1.2012: Vim9: cannot initialize class member with protected var
Problem:  Vim9: cannot initialize class member with protected var
Solution: Allow this to work if this happens within the same class
          (Foxe Chen)

closes: #18949

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-23 20:17:30 +00:00
Stanislaw Gruszka
5e577c7aa8 runtime(ftplugin): set different formatoptions for bpftrace
Problem:   Comment formatting does not work by default for bpftrace.
Solution:  Change default 'formatoptions' similarly as C and many other
           languages.

closes: #18996

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-23 20:15:14 +00:00
Christian Brabandt
bb10f71402 patch 9.1.2011: crash when unreferencing gtk icon theme
Problem:  crash when unreferencing gtk icon theme
          (noamhalevy-wq, after v9.1.1583)
Solution: Remove the g_object_unref() call.

gtk_icon_theme_get_default() returns a singleton that should NOT be
unreferenced. From GTK documentation:

> A unique GtkIconTheme associated with the default screen. This icon
theme is associated with the screen and can be used as long as the
screen is open. Do not ref or unref it.

fixes: #18997

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:59:50 +00:00
John Marriott
a90e80411a patch 9.1.2010: Missing out-of-memory checks in vim9class.c
Problem:  Missing out-of-memory checks in vim9class.c
          (after v9.1.2000)
Solution: Return FAIL early (John Marriott)

closes: #18991

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:49:43 +00:00
Stanislaw Gruszka
7982966f3e runtime(bpftrace): add base syntax plugin
Problem:  No syntax highlighting for bpftrace files.
Solution: Add basic syntax rules, which cover comments, keywords, strings,
          numbers, macros and probes (the bpftrace specific items).

closes: #18999

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:46:44 +00:00
Muraoka Taro
de37e7430a patch 9.1.2009: tests: "Xm4" test directory may not be deleted
Problem:  tests: "Xm4" test directory may not be deleted
Solution: Use "R" flag with mkdir() call to have the directory
          recursively deleted at the end of function Test_m4_format()
          (Muraoka Taro)

Test_m4_format in test_filetype.vim creates the "Xm4" directory with the
'D' flag. Then it creates two files in the "Xm4" directory. One of them,
"alocal.m4," was created with the 'D' flag, so it will disappear after
the test is complete. However, the other, "configure.ac," was created
without any flags, so it will remain even after the test is complete.
Because the parent directory "Xm4" was created with the 'D' flag, the
latter "configure.ac" remains and is not empty, so it will not be
deleted.

This forces the directory to be deleted regardless of its contents. As a
result, the two files "alocal.m4" and "configure.ac" created in the
directory are no longer needed, so they have been deleted.

closes: #18995

Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:33:50 +00:00
Ambrus Tóth
9c9982240a patch 9.1.2008: filetype: hylo files are not recognized
Problem:  filetype: hylo files are not recognized
Solution: Detect *.hylo files as hylo filetype (Ambrus Tóth)

References:
- https://hylo-lang.org/

closes: #18994

Signed-off-by: Ambrus Tóth <ping@ambrus.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:26:52 +00:00
Ivan Pešić
b571034a8f translation(sr): Update Serbian message translation
closes: #18993

Signed-off-by: Ivan Pešić <27575106+eevan78@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:21:01 +00:00
Stanislaw Gruszka
f2814754c0 patch 9.1.2007: filetype: bpftrace hashbang lines are not recognized
Problem:    bpftrace files are not recognized from the hashbang line.
Solution:   Add a hashbang check (Stanislaw Gruszka)

closes: #18992

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-12-22 18:17:36 +00:00
15 changed files with 136 additions and 13 deletions

1
.github/MAINTAINERS vendored
View File

@@ -454,6 +454,7 @@ runtime/syntax/asy.vim @avidseeker
runtime/syntax/autohotkey.vim @mmikeww
runtime/syntax/awk.vim @dkearns
runtime/syntax/basic.vim @dkearns
runtime/syntax/bpftrace.vim @sgruszka
runtime/syntax/bst.vim @tpope
runtime/syntax/bzl.vim @dbarnett
runtime/syntax/bzr.vim @hdima

View File

@@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
# Last Change: 2025 Dec 14
# Last Change: 2025 Dec 22
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
# These functions are moved here from runtime/filetype.vim to make startup
@@ -2118,6 +2118,8 @@ const ft_from_ext = {
"tmpl": "template",
# Hurl
"hurl": "hurl",
# Hylo
"hylo": "hylo",
# Hyper Builder
"hb": "hb",
# Httest

View File

@@ -4,7 +4,7 @@ vim9script
# Invoked from "scripts.vim" in 'runtimepath'
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
# Last Change: 2025 Aug 09
# Last Change: 2025 Dec 22
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
export def DetectFiletype()
@@ -233,6 +233,10 @@ export def Exe2filetype(name: string, line1: string): string
elseif name =~ '^execlineb\>'
return 'execline'
# Bpftrace
elseif name =~ '^bpftrace\>'
return 'bpftrace'
# Vim
elseif name =~ '^vim\>'
return 'vim'

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: bpftrace
" Maintainer: Stanislaw Gruszka <stf_xl@wp.pl>
" Last Change: 2025 Dec 05
" Last Change: 2025 Dec 23
if exists('b:did_ftplugin')
finish
@@ -11,4 +11,6 @@ let b:did_ftplugin = 1
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
setlocal commentstring=//\ %s
let b:undo_ftplugin = "setlocal comments< commentstring<"
setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setlocal comments< commentstring< formatoptions<"

View File

@@ -0,0 +1,66 @@
" Vim syntax file
" Language: bpftrace
" Maintainer: Stanislaw Gruszka <stf_xl@wp.pl>
" Last Change: 2025 Dec 22
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
syn keyword bpftraceConditional if else
syn keyword bpftraceRepeat while for unroll
syn keyword bpftraceStatement break continue return
syn keyword bpftraceKeyword let macro import config
syn keyword bpftraceOperator sizeof offsetof
syn keyword bpftraceProbe BEGIN END begin end
syn match bpftraceProbe "\v<(bench|self|test)\ze:"
syn match bpftraceProbe "\v<(fentry|fexit|kfunc|kretfunc|kprobe|kretprobe)\ze:"
syn match bpftraceProbe "\v<(profile|interval|iterator|hardware|software|uprobe|uretprobe)\ze:"
syn match bpftraceProbe "\v<(usdt|tracepoint|rawtracepoint|watchpoint|asyncwatchpoint)\ze:"
syn match bpftraceProbe "\v(^|[^:])<\zs(h|i|it|f|fr|k|kr|p|rt|s|t|u|ur|U|w|aw)\ze:"
syn keyword bpftraceType bool int8 int16 int32 int64
syn keyword bpftraceType uint8 uint16 uint32 uint64
syn keyword bpftraceType struct
syn match bpftraceMacro "\<\h\w*\ze\_s*("
syn match bpftraceNumber display "[+-]\=\<\d\+\>"
syn match bpftraceNumber display "\<0x\x\+\>"
syn keyword bpftraceBoolean true false
syn region bpftraceString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell extend
syn keyword bpftraceTodo contained TODO FIXME XXX
syn match bpftraceShebang /\%^#![^[].*/
syn region bpftraceCommentLine start="//" end="$" contains=bpftraceTodo,@Spell
syn region bpftraceCommentBlock matchgroup=bpftraceCommentBlock start="/\*" end="\*/" contains=bpftraceTodo,@Spell
" Define the default highlighting.
hi def link bpftraceConditional Conditional
hi def link bpftraceMacro Macro
hi def link bpftraceRepeat Repeat
hi def link bpftraceKeyword Keyword
hi def link bpftraceNumber Number
hi def link bpftraceBoolean Boolean
hi def link bpftraceShebang Comment
hi def link bpftraceCommentLine Comment
hi def link bpftraceCommentBlock Comment
hi def link bpftraceString String
hi def link bpftraceType Type
hi def link bpftraceProbe Identifier
syn sync minlines=100
let b:current_syntax = "bpftrace"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8 sw=8 noexpandtab

View File

@@ -131,6 +131,7 @@ fill_evalarg_from_eap(evalarg_T *evalarg, exarg_T *eap, int skip)
evalarg->eval_getline = eap->ea_getline;
evalarg->eval_cookie = eap->cookie;
}
evalarg->eval_class = eap->class;
}
/*

View File

@@ -1973,6 +1973,8 @@ struct exarg
void *cookie; // argument for getline()
#ifdef FEAT_EVAL
cstack_T *cstack; // condition stack for ":if" etc.
class_T *class; // Name of class being defined. Used by :class
// and :enum commands.
#endif
};

View File

@@ -2025,7 +2025,7 @@ EXTERN listitem_T range_list_item;
EXTERN evalarg_T EVALARG_EVALUATE
# ifdef DO_INIT
= {EVAL_EVALUATE, 0, NULL, NULL, NULL, NULL, GA_EMPTY, GA_EMPTY, NULL,
{0, 0, (int)sizeof(char_u *), 20, NULL}, 0, NULL}
{0, 0, (int)sizeof(char_u *), 20, NULL}, 0, NULL, NULL}
# endif
;
#endif

View File

@@ -2750,9 +2750,7 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
icon_theme = gtk_icon_theme_get_default();
if (icon_theme && gtk_icon_theme_has_icon(icon_theme, "gvim"))
{
gtk_window_set_icon_name(GTK_WINDOW(gui.mainwin), "gvim");
}
else
{
/*
@@ -2770,7 +2768,6 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
g_list_foreach(icons, (GFunc)(void *)&g_object_unref, NULL);
g_list_free(icons);
}
g_object_unref(icon_theme);
}
#if !defined(USE_GNOME_SESSION)

View File

@@ -7811,7 +7811,7 @@ msgid "E1129: Throw with empty string"
msgstr "E1129: Throw са празним стрингом"
msgid "E1130: Cannot add to null list"
msgstr "E1130: null не може да се дода листи"
msgstr "E1130: Не може да се дода у null листу"
msgid "E1131: Cannot add to null blob"
msgstr "E1131: Не може да се дода на null блоб"
@@ -8141,7 +8141,7 @@ msgstr "E1219: За аргумент %d се захтева Покретни и
#, c-format
msgid "E1220: String or Number required for argument %d"
msgstr "E1220: За аргумент %d се се захтева Стринг или Број"
msgstr "E1220: За аргумент %d се захтева Стринг или Број"
#, c-format
msgid "E1221: String or Blob required for argument %d"

View File

@@ -2282,6 +2282,9 @@ typedef struct {
// pointer to the lines concatenated for a lambda.
char_u *eval_tofree_lambda;
// pointer to name of class being constructed
class_T *eval_class;
} evalarg_T;
// Flag for expression evaluation.

View File

@@ -381,6 +381,7 @@ def s:GetFilenameChecks(): dict<list<string>>
http: ['file.http'],
hurl: ['file.hurl'],
hy: ['file.hy', '.hy-history'],
hylo: ['file.hylo'],
hyprlang: ['hyprlock.conf', 'hyprland.conf', 'hypridle.conf', 'hyprpaper.conf', '/hypr/foo.conf'],
i3config: ['/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'],
ibasic: ['file.iba', 'file.ibi'],
@@ -1095,6 +1096,7 @@ def s:GetScriptChecks(): dict<list<list<string>>>
['#!/path/regina']],
janet: [['#!/path/janet']],
dart: [['#!/path/dart']],
bpftrace: [['#!/path/bpftrace']],
vim: [['#!/path/vim']],
}
enddef
@@ -3233,9 +3235,9 @@ endfunc
func Test_m4_format()
filetype on
call mkdir('Xm4', 'D')
call mkdir('Xm4', 'R')
cd Xm4
call writefile([''], 'alocal.m4', 'D')
call writefile([''], 'alocal.m4')
split alocal.m4
call assert_equal('m4', &filetype)
bwipe!

View File

@@ -12407,10 +12407,14 @@ def Test_protected_new_method()
vim9script
class A
static var _instance: A
static var handler: func = A._Internal
var str: string
def _new(str: string)
this.str = str
enddef
static def _Internal(): string
return "test"
enddef
static def GetInstance(str: string): A
if _instance == null
_instance = A._new(str)
@@ -12422,6 +12426,24 @@ def Test_protected_new_method()
var b: A = A.GetInstance('bar')
assert_equal('foo', a.str)
assert_equal('foo', b.str)
assert_equal('test', A.handler())
END
v9.CheckSourceSuccess(lines)
lines =<< trim END
vim9script
enum Test
A,
B,
C
static var handler: func = Test._Internal
static def _Internal(): string
return "test"
enddef
endenum
assert_equal('test', Test.handler())
END
v9.CheckSourceSuccess(lines)
enddef

View File

@@ -734,6 +734,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2012,
/**/
2011,
/**/
2010,
/**/
2009,
/**/
2008,
/**/
2007,
/**/
2006,
/**/

View File

@@ -179,7 +179,10 @@ add_member(
m->ocm_name.length = (size_t)(varname_end - varname);
m->ocm_name.string = vim_strnsave(varname, m->ocm_name.length);
if (m->ocm_name.string == NULL)
{
m->ocm_name.length = 0;
return FAIL;
}
m->ocm_access = has_public ? VIM_ACCESS_ALL
: *varname == '_' ? VIM_ACCESS_PRIVATE : VIM_ACCESS_READ;
if (has_final)
@@ -230,7 +233,10 @@ add_members_to_class(
*m = parent_members[i];
m->ocm_name.string = vim_strnsave(m->ocm_name.string, m->ocm_name.length);
if (m->ocm_name.string == NULL)
{
m->ocm_name.length = 0;
return FAIL;
}
if (m->ocm_init != NULL)
m->ocm_init = vim_strsave(m->ocm_init);
}
@@ -2116,6 +2122,8 @@ early_ret:
cl->class_object_type.tt_type = VAR_OBJECT;
cl->class_object_type.tt_class = cl;
eap->class = cl;
// Add the class to the script-local variables.
// TODO: handle other context, e.g. in a function
// TODO: does uf_hash need to be cleared?
@@ -3237,7 +3245,8 @@ class_object_index(
if (fp != NULL)
{
// Protected methods are not accessible outside the class
if (*name == '_')
if (fp->uf_defclass != evalarg->eval_class
&& *name == '_')
{
semsg(_(e_cannot_access_protected_method_str), fp->uf_name);
goto done;