0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

1480 Commits

Author SHA1 Message Date
RestorerZ
7fe8f43f49
patch 9.0.1935: Vim9: not consistent error messages
Problem:  Vim9: not consistent error messages
Solution: Make error messages more consistent. Use "variable" for
          (object/class) member

closes: #13155

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: RestorerZ <restorer@mail2k.ru>
2023-09-24 23:21:24 +02:00
Ernie Rael
696270bcae
patch 9.0.1926: Vim9: not enough info in error message
Problem:  Vim9: not enough info in error message
Solution: Add class name, change member to variable, quote names

closes: #13136

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-21 16:42:28 +02:00
Ernie Rael
98e68c07ce
patch 9.0.1920: Vim9: cannot write public var in nested object
Problem:  Vim9: cannot write public var in nested object
Solution: Write variable in nested read-only object reference.
          Also test write fails.

closes: #13130
closes: #13131

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-20 20:13:06 +02:00
Yegappan Lakshmanan
1db1514365
patch 9.0.1914: Vim9: few issues when accessing object members
Problem:  Vim9: few issues when accessing object members
Solution: When calling an object method, check for null object.
          Accessing a Dict object member doesn't work.

closes: #13119
closes: #13123
closes: #13124

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-19 20:36:02 +02:00
Yegappan Lakshmanan
00cd18222e
patch 9.0.1909: Vim9: problem calling class method from other class
Problem:  Vim9: problem calling class method from other class
Solution: Fix this problem, fix readonly object access, update error
          messages.

Calling a class method from another method without the class name prefix
doesn't work properly.

A readonly object variable is modifiable outside the class using a
nested object assignment.

Remove the unused E1338 error message.

Update error messages.

closes: #13116

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-18 19:56:49 +02:00
Yegappan Lakshmanan
c30a90d9b2
patch 9.0.1898: Vim9: restrict access to static vars
Problem:  Vim9: restrict access to static vars and methods
Solution: Class members are accesible only from the class where they are
          defined.

Based on the #13004 discussion, the following changes are made:

    1) Static variables and methods are accessible only using the class
       name and inside the class where they are defined.
    2) Static variables and methods can be used without the class name in
       the class where they are defined.
    3) Static variables of a super class are not copied to the sub class.
    4) A sub class can declare a class variable with the same name as the
       super class.
    5) When a method or member is found during compilation, use more
       specific error messages.

This aligns the Vim9 class variable/method implementation with the Dart
implementation.

Also while at it, ignore duplicate class and object methods.

The access level of an object method can however be changed in a
subclass.

For the tests, use the new CheckSourceFailure() function instead of the
CheckScriptFailure() function in the tests.

closes: #13086

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-15 20:14:55 +02:00
Yegappan Lakshmanan
f36bbcd402
patch 9.0.1890: Vim9: lookup code for class/object repaeated
Problem:  Vim9: lookup code for class/object repaeated
Solution: Refactor and make use of lookup functions

closes: #13067

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-10 18:19:06 +02:00
Ernie Rael
86eda07805
patch 9.0.1869: Coverity warns about unitialized var
Problem:  Coverity warns about unitialized var
Solution: initialize it

closes: #13029

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-05 07:33:48 +02:00
Ernie Rael
18143d3111
patch 9.0.1867: Vim9: access to interface statics possible
Problem:  Vim9: access to interface statics possible
Solution: Prevent direct access to interface statics

closes: #13007

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-04 22:30:41 +02:00
Yegappan Lakshmanan
544be0d893
patch 9.0.1865: Vim9: garbage collection may cause crash
Problem:  Vim9: garbage collection may cause crash
Solution: validate that class members typeval is not null

closes: #13028

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-04 22:14:28 +02:00
Yegappan Lakshmanan
e651e110c1
patch 9.0.1862: Vim9 Garbage Collection issues
Problem:  Vim9 Garbage Collection issues
Solution: Class members are garbage collected early leading to
          use-after-free problems.  Handle the garbage
          collection of classes properly.

closes: #13019

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-04 07:51:01 +02:00
LemonBoy
c5d2744c04
patch 9.0.1741: No type checking in interfaces
Problem: No type checking in interfaces
Solution: Implement member type check in vim9 interfaces

Most of the code is a small refactoring to allow the use of a where_T
for signaling the type mismatch, the type checking itself is pretty
simple.

Improve where_T error reports

Let the caller explicitly define the kind of location it's referring to
and free the WT_ARGUMENT enum from its catch-all role.

Implement type checking for interface methods

Follows closely the logic used for type-checking the members.

closes: #12844

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-08-19 13:04:53 +02:00
zeertzjq
ad0c442f1f
patch 9.0.1723: Fix regression in {func} argument of reduce()
Problem: Fix regression in {func} argument of reduce()
Solution: pass function name as string again

Before patch 9.0.0548, passing a string as {func} argument of reduce()
is treated as a function name, but after patch 9.0.0548 it is treated as
an expression instead, which is useless as reduce() doesn't set any v:
variables. This PR restores the behavior of {func} before that patch.

Also correct an emsg() call, as e_string_list_or_blob_required doesn't
contain format specifiers.

closes: #12824

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-08-17 22:15:47 +02:00
zeertzjq
19dfa276c3 patch 9.0.1633: duplicate code for converting float to string
Problem:    Duplicate code for converting float to string.
Solution:   Use tv_get_string(). (closes #12521)
2023-06-15 10:56:41 +01:00
Bram Moolenaar
8509014add patch 9.0.1597: cursor ends up below the window after a put
Problem:    Cursor ends up below the window after a put.
Solution:   Mark w_crow and w_botline invalid when changing the cursor line.
            (closes #12465)
2023-06-01 19:27:08 +01:00
h-east
2bd6a09691 patch 9.0.1569: cannot use "this.member" in lambda in class method
Problem:    Cannot use "this.member" in lambda in class method.
Solution:   Adjust check for reserved keyword. (Hirohito Higashi,
            closes #12416, closes #12076, closes #12336)
2023-05-19 19:01:17 +01:00
zeertzjq
f2588b6fc9 patch 9.0.1508: catch does not work when lines are joined with a newline
Problem:    Catch does not work when lines are joined with a newline.
Solution:   Set "nextcmd" appropriately. (closes #12348)
2023-05-05 17:22:35 +01:00
zeertzjq
a93d9cdc74 patch 9.0.1505: error when heredoc content looks like heredoc
Problem:    Error when heredoc content looks like heredoc.
Solution:   Handle curly expressions. (closes #12325)
2023-05-02 16:25:47 +01:00
zeertzjq
b7f6f93475 patch 9.0.1452: code using EVAL_CONSTANT is dead, it is never set
Problem:    Code using EVAL_CONSTANT is dead, it is never set.
Solution:   Remove EVAL_CONSTANT. (closes #12252)
2023-04-13 22:12:50 +01:00
zeertzjq
c481ad38f0 patch 9.0.1401: condition is always true
Problem:    Condition is always true.
Solution:   Remove the condition. (closes #12139)
2023-03-11 16:18:51 +00:00
Yegappan Lakshmanan
14113fdf9c patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file
Problem:    FOR_ALL_ macros are defined in an unexpected file.
Solution:   Move FOR_ALL_ macros to macros.h.  Add FOR_ALL_HASHTAB_ITEMS.
            (Yegappan Lakshmanan, closes #12109)
2023-03-07 17:13:51 +00:00
=?UTF-8?q?Ola=20S=C3=B6der?=
d8742476d1 patch 9.0.1381: ACCESS_ names have a conflict with on some systems
Problem:    ACCESS_ names have a conflict with on some systems.
Solution:   Rename by prepending VIM_. (Ola Söder, closes #12105)
2023-03-05 13:12:32 +00:00
Bram Moolenaar
99a7c0d89c patch 9.0.1338: :defcompile and :disassemble can't find class method
Problem:    :defcompile and :disassemble can't find class method. (Ernie Rael)
Solution:   Make a class name and class.method name work. (closes #11984)
2023-02-21 19:55:14 +00:00
Bram Moolenaar
ce93d162da patch 9.0.1266: error for space before ": type" is inconsistent
Problem:    Error for space before ": type" is inconsistent.
Solution:   Give E1059 in more places. (closes #11868)
2023-01-30 21:12:34 +00:00
Bram Moolenaar
b149d22796 patch 9.0.1239: cannot have a line break before an object member access
Problem:    Cannot have a line break before an object member access.
Solution:   Check for "." in next line. (closes #11864)
2023-01-24 13:03:37 +00:00
Bram Moolenaar
bcbfaf32e0 patch 9.0.1180: compiler warnings without the +job feature
Problem:    Compiler warnings without the +job feature.
Solution:   Adjust #ifdefs. (John Marriott)
2023-01-11 19:11:15 +00:00
Yegappan Lakshmanan
ea125393af patch 9.0.1175: the set_ref_in_item() function is too long
Problem:    The set_ref_in_item() function is too long.
Solution:   Use a separate function for more complicated types. (Yegappan
            Lakshmanan, closes #11802)
2023-01-11 11:46:17 +00:00
Bram Moolenaar
94674f2223 patch 9.0.1152: class "implements" argument not implemented
Problem:    Class "implements" argument not implemented.
Solution:   Implement "implements" argument.  Add basic checks for when a
            class implements an interface.
2023-01-06 18:42:20 +00:00
Bram Moolenaar
cf760d50dc patch 9.0.1149: class members may be garbage collected
Problem:    Class members may be garbage collected.
Solution:   Mark class members as being in use.
2023-01-05 13:16:04 +00:00
Bram Moolenaar
3ac1d97a1d patch 9.0.1145: invalid memory access with recursive substitute expression
Problem:    Invalid memory access with recursive substitute expression.
Solution:   Check the return value of vim_regsub().
2023-01-04 17:17:54 +00:00
Bram Moolenaar
a9fa8c58fb patch 9.0.1133: error message names do not match the items
Problem:    Error message names do not match the items.
Solution:   Add "_str" when the text contains "%s".
2023-01-02 18:10:04 +00:00
Yegappan Lakshmanan
87c1cbbe98 patch 9.0.1105: code is indented too much
Problem:    Code is indented too much.
Solution:   Use an early return. (Yegappan Lakshmanan, closes #11756)
2022-12-27 19:54:52 +00:00
Bram Moolenaar
34820944ed patch 9.0.1081: using "->" with split lines does not always work
Problem:    Using "->" with split lines does not always work.
Solution:   Avoid trying to get another line. (closes #11723)
2022-12-19 20:28:38 +00:00
Bram Moolenaar
d505d17885 patch 9.0.1074: class members are not supported yet
Problem:    Class members are not supported yet.
Solution:   Add initial support for class members.
2022-12-18 21:42:55 +00:00
Bram Moolenaar
3d473ee1a6 patch 9.0.1060: private and public object members are not implemented yet
problem:    Private and public object members are not implemented yet.
Solution:   Implement private and public object members.
2022-12-14 20:59:32 +00:00
Bram Moolenaar
f94178db8d patch 9.0.1059: build failure with some compilers
Problem:    Build failure with some compilers that can't handle a
            declaration directly after a "case" statement.
Solution:   Add a block to put the declarations in.
2022-12-14 17:50:00 +00:00
Bram Moolenaar
91c9d6d772 patch 9.0.1058: string value of class and object do not have information
Problem:    String value of class and object do not have useful information.
Solution:   Add the class name and for the object the member values.
2022-12-14 17:30:37 +00:00
Bram Moolenaar
7ce7daf6cd patch 9.0.1045: in a class object members cannot be initialized
Problem:    In a class object members cannot be initialized.
Solution:   Support initializing object members. Make "dissassemble" work on
            an object method.
2022-12-10 18:42:12 +00:00
Bram Moolenaar
ffdaca9e6f patch 9.0.1041: cannot define a method in a class
Problem:    Cannot define a method in a class.
Solution:   Implement defining an object method.  Make calling an object
            method work.
2022-12-09 21:41:48 +00:00
Bram Moolenaar
d28d7b94f5 patch 9.0.1035: object members are not being marked as used
Problem:    Object members are not being marked as used, garbage collection
            may free them.
Solution:   Mark object members as used.  Fix reference counting.
2022-12-08 20:42:00 +00:00
Bram Moolenaar
00b28d6c23 patch 9.0.1031: Vim9 class is not implemented yet
Problem:    Vim9 class is not implemented yet.
Solution:   Add very basic class support.
2022-12-08 15:32:33 +00:00
Bram Moolenaar
84497cd06f patch 9.0.0967: leaking memory from autocmd windows
Problem:    Leaking memory from autocmd windows.
Solution:   Free window when auc_win is not NULL.
2022-11-28 20:34:52 +00:00
Bram Moolenaar
e76062c078 patch 9.0.0965: using one window for executing autocommands is insufficient
Problem:    Using one window for executing autocommands is insufficient.
Solution:   Use up to five windows for executing autocommands.
2022-11-28 18:51:43 +00:00
Bram Moolenaar
88456cd3c4 patch 9.0.0904: various comment and indent flaws
Problem:    Various comment and indent flaws.
Solution:   Improve comments and indenting.
2022-11-18 22:14:09 +00:00
zeertzjq
91c75d18d9 patch 9.0.0836: wrong error when using extend() with funcref
Problem:    Wrong error when using extend() with funcref.
Solution:   Better check the variable type. (closes #11468, closes #11455)
2022-11-05 20:21:58 +00:00
dundargoc
c57b5bcd22 patch 9.0.0828: various typos
Problem:    Various typos.
Solution:   Correct typos. (closes #11432)
2022-11-02 13:30:51 +00:00
Bram Moolenaar
cdef1cefa2 patch 9.0.0804: crash when trying to divide a number by -1
Problem:    Crash when trying to divice the largest negative number by -1.
Solution:   Handle this case specifically.
2022-10-20 14:17:18 +01:00
Bram Moolenaar
79f234499b patch 9.0.0712: wrong column when calling setcursorcharpos() with zero lnum
Problem:    Wrong column when calling setcursorcharpos() with zero lnum.
Solution:   Set the line number before calling buf_charidx_to_byteidx().
            (closes #11329)
2022-10-10 12:42:57 +01:00
Bram Moolenaar
bdc09a18fc patch 9.0.0683: cannot specify a time for :echowindow
Problem:    Cannot specify a time for :echowindow.
Solution:   A count can be used to specify the display time. Add
            popup_findecho().
2022-10-07 14:31:45 +01:00
Bram Moolenaar
a4e0b9785e patch 9.0.0634: evaluating "expr" options has more overhead than needed
Problem:    Evaluating "expr" options has more overhead than needed.
Solution:   Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
            "expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
            'formatexpr', 'indentexpr' and 'charconvert'.
2022-10-01 19:43:52 +01:00