summaryrefslogtreecommitdiffstats
path: root/src/eval.c
AgeCommit message (Collapse)Author
2024-06-03patch 9.1.0462: eval5() and eval7 are too complexv9.1.0462Yegappan Lakshmanan
Problem: eval5() and eval7 are too complex Solution: Refactor eval5() and eval7() in eval.c (Yegappan Lakshmanan) closes: #14900 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-30patch 9.1.0450: evalc. code too complexv9.1.0450Yegappan Lakshmanan
Problem: eval.c code too complex Solution: refactor eval6() and eval9() functions into several smaller functions (Yegappan Lakshmanan) closes: #14875 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-29patch 9.1.0448: compiler warning in eval.cv9.1.0448Yegappan Lakshmanan
Problem: compiler warning in eval.c (after v9.1.0429) Solution: refactor code (Yegappan Lakshmanan) fixes: #14847 closes: #14867 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-25patch 9.1.0445: Coverity warning after 9.1.0440v9.1.0445Yegappan Lakshmanan
Problem: Coverity warning after 9.1.0440 Solution: Fix Coverity warning, add a test and reduce the calls to clear_tv() (Yegappan Lakshmanan). closes: #14845 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-24patch 9.1.0440: function get_lval() is too longv9.1.0440Yegappan Lakshmanan
Problem: function get_lval() is too long Solution: factor out the get_lval_subscript() function (Yegappan Lakshmanan) closes: #14839 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-22patch 9.1.0431: eval.c is too longv9.1.0431Yegappan Lakshmanan
Problem: eval.c is too long Solution: Move garbage collection code to new gc.c file (Yegappan Lakshmanan) closes: #14824 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-21patch 9.1.0429: Coverity complains about eval.c refactorv9.1.0429Christian Brabandt
Problem: Coverity complains about eval.c refactor (after v9.1.0422) Solution: Check that buf is not used un-initialized, add explicit conditions for save and restore of copyID Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-20patch 9.1.0422: function echo_string_core() is too longv9.1.0422Yegappan Lakshmanan
Problem: function echo_string_core() is too long Solution: Refactor into several smaller functions (Yegappan Lakshmanan) closes: #14804 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-19patch 9.1.0419: eval.c not sufficiently testedv9.1.0419Yegappan Lakshmanan
Problem: eval.c not sufficiently tested Solution: Add a few more additional tests for eval.c, (Yegappan Lakshmanan) closes: #14799 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-17patch 9.1.0415: Some functions are not testedv9.1.0415Yegappan Lakshmanan
Problem: Some functions are not tested Solution: Add a few more tests, fix a few minor problems (Yegappan Lakshmanan) closes: #14789 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-12patch 9.1.0411: too long functions in eval.cv9.1.0411Yegappan Lakshmanan
Problem: too long functions in eval.c Solution: refactor functions (Yegappan Lakshmanan) closes: #14755 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-08patch 9.1.0398: Vim9: imported vars are not properly type checkedv9.1.0398Yegappan Lakshmanan
Problem: Vim9: imported vars are not properly type checked Solution: Check the imported variable type properly (Yegappan Lakshmanan) closes: #14729 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-02patch 9.1.0387: Vim9: null value tests not sufficientv9.1.0387Yegappan Lakshmanan
Problem: Vim9: null value tests not sufficient Solution: Add a more comprehensive test for null values (Yegappan Lakshmanan) closes: #14701 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-01patch 9.1.0385: Vim9: crash with null_class and null_objectv9.1.0385Yegappan Lakshmanan
Problem: Vim9: crash with null_class and null_object (Aliaksei Budavei) Solution: Handle null_class and null_object correctly (Yegappan Lakshmanan) fixes: #14678 closes: #14681 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-15patch 9.1.0335: String interpolation fails for List typev9.1.0335Yegappan Lakshmanan
Problem: String interpolation fails for List type Solution: use implicit string(list) for string interpolation and :put = (Yegappan Lakshmanan) related: #14529 closes: #14556 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-14patch 9.1.0329: String interpolation fails for Dict typev9.1.0329Yegappan Lakshmanan
Problem: String interpolation fails for Dict type Solution: Support Dict data type properly, also support :put =Dict (without having to convert it to string() first) (Yegappan Lakshmanan) fixes: #14529 closes: #14541 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-09patch 9.1.0287: Vim9: comment may be treated as heredoc startv9.1.0287zeertzjq
Problem: Vim9: comment may be treated as heredoc start. (Ernie Rael) Solution: Use skip_var_list() instead of find_name_end(). (zeertzjq) fixes: #14444 closes: #14446 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-04patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classesv9.1.0263Yegappan Lakshmanan
Problem: Vim9: Problem with lambda blocks in enums and classes (Aliaksei Budavei) Solution: Support evaluating lambda blocks from a string, skip over comments (Yegappan Lakshmanan) fixes: #14350 closes: #14405 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-02patch 9.1.0257: Vim9: :call may not find imported class membersv9.1.0257Yegappan Lakshmanan
Problem: Vim9: :call may not find imported class members (mityu) Solution: Set the typval of an imported lval variable correctly (Yegappan Lakshmanan) fixes: #14334 closes: #14386 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-28patch 9.1.0219: Vim9: No enum supportv9.1.0219Yegappan Lakshmanan
Problem: No enum support Solution: Implement enums for Vim9 script (Yegappan Lakshmanan) closes: #14224 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-11patch 9.1.0168: too many STRLEN() callsv9.1.0168John Marriott
Problem: too many STRLEN() calls Solution: Make use of ml_get_len() calls instead (John Marriott) closes: #14123 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-03patch 9.1.0148: Vim9: can't call internal methods with objectsv9.1.0148Yegappan Lakshmanan
Problem: Vim9: can't call internal methods with objects Solution: Add support for empty(), len() and string() function calls for objects (Yegappan Lakshmanan) closes: #14129 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-06patch 9.1.0080: unexpected error for modifying final list using +=v9.1.0080Yegappan Lakshmanan
Problem: unexpected error for modifying final list using += operator (Ernie Rael) Solution: Allow List value modification of a final variable using += operator (Yegappan Lakshmanan) fixes: #13745 fixes: #13959 closes: #13962 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-12patch 9.1.0017: [security]: use-after-free in eval1_emsg()v9.1.0017Yegappan Lakshmanan
Problem: use-after-free in eval1_emsg() when an empty line follows a lambda (by @yu3s) Solution: only set evalarg->eval_using_cmdline = FALSE when the *arg pointer is not null fixes: #13833 closes: #13841 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04patch 9.1.0006: is*() and to*() function may be unsafev9.1.0006Keith Thompson
Problem: is*() and to*() function may be unsafe Solution: Add SAFE_* macros and start using those instead (Keith Thompson) Use SAFE_() macros for is*() and to*() functions The standard is*() and to*() functions declared in <ctype.h> have undefined behavior for negative arguments other than EOF. If plain char is signed, passing an unchecked value from argv for from user input to one of these functions has undefined behavior. Solution: Add SAFE_*() macros that cast the argument to unsigned char. Most implementations behave sanely for negative arguments, and most character values in practice are non-negative, but it's still best to avoid undefined behavior. The change from #13347 has been omitted, as this has already been separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a (v9.0.2054) fixes: #13332 closes: #13347 Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-21patch 9.0.2184: Vim9: inconsistent :type/:class messagesv9.0.2184Ernie Rael
Problem: Vim9: inconsistent :type/:class messages Solution: Update the Messages (Ernie Rael) closes: #13706 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-19patch 9.0.2180: POSIX function name in exarg causes issuesv9.0.2180Zoltan Arpadffy
Problem: POSIX function name in exarg struct causes issues on OpenVMS Solution: Rename getline member in exarg struct to ea_getline, remove isinf() workaround for VMS There are compilers that do not treat well POSIX functions - like getline - usage in the structs. Older VMS compilers could digest this... but the newer OpenVMS compilers ( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these structs. This could be limited to getline() that is defined via getdelim() and might not affect all POSIX functions in general - but avoiding POSIX function names usage in the structs is a "safe side" practice without compromising the functionality or the code readability. The previous OpenVMS X86 port used a workaround limiting the compiler capabilities using __CRTL_VER_OVERRIDE=80400000 In order to make the OpenVMS port future proof, this pull request proposes a possible solution. closes: #13704 Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-16patch 9.0.2170: Vim9: no support for const/final class/objects varsv9.0.2170Yegappan Lakshmanan
Problem: Vim9: no support for const/final class/objects vars Solution: Support final and const object and class variables closes: #13655 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-11patch 9.0.2096: Vim9: confusing usage of privatev9.0.2096Ernie Rael
Problem: Vim9: confusing usage of private Solution: clarify and use protected keyword instead [vim9class] document `_` as protected instead of private fixes #13504 closes: #13520 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-28patch 9.0.2078: several problems with type aliasesv9.0.2078Yegappan Lakshmanan
Problem: several problems with type aliases Solution: Check for more error conditions, add tests, fix issues Check for more error conditions and add additional tests fixes #13434 fixes #13437 fixes #13438 closes #13441 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-27patch 9.0.2076: Vim9: No support for type aliasesv9.0.2076Yegappan Lakshmanan
Problem: Vim9: No support for type aliases Solution: Implement :type command A type definition is giving a name to a type specification. This also known type alias. :type ListOfStrings = list<string> The type alias can be used wherever a built-in type can be used. The type alias name must start with an upper case character. closes: #13407 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-15patch 9.0.2029: Vim9: no support for partials using call()v9.0.2029Yegappan Lakshmanan
Problem: Vim9: no support for partials using call() Solution: Add support closes: #13341 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-15patch 9.0.2027: Vim9: no support for bitwise operators in lambda funcsv9.0.2027Yegappan Lakshmanan
Problem: Vim9: no support for bitwise operators in lambda funcs Solution: move "evaluate" assignment a bit up in order to decide to perform bitwise operations closes: #13342 closes: #13345 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-14patch 9.0.2020: Vim9: islocked() needs more workv9.0.2020Ernie Rael
Problem: Vim9: islocked() needs more work Solution: rework islocked() and remove sync_root from get_lval() closes: #13329 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-14patch 9.0.2019: Vim9: no support for funcrefsv9.0.2019Yegappan Lakshmanan
Problem: Vim9: no support for funcrefs Solution: Add support for object/class funcref members closes: #11981 #12417 #12960 #12324 #13333 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-11patch 9.0.2015: Vim9: does not handle islocked() from a method correctlyv9.0.2015Ernie Rael
Problem: Vim9: does not handle islocked() from a method correctly Solution: Handle islocked() builtin from a method. - Setup `lval_root` from `f_islocked()`. - Add function `fill_exec_lval_root()` to get info about executing method. - `sync_root` added in get_lval to handle method member access. - Conservative approach to reference counting. closes: #13309 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-11patch 9.0.2012: Vim9: error message can be more accuratev9.0.2012Ernie Rael
Problem: Vim9: error message can be more accurate Solution: Fix the error messages Fix message for some single use error messages. closes: #13312 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-07patch 9.0.2001: Vim9: segfault with islocked()v9.0.2001Ernie Rael
Problem: Vim9: segfault with islocked() Solution: Check that the lval pointer is not null for objects and class variables closes: #13295 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-06patch 9.0.1999: Vim9: some error messages can be improvedv9.0.1999Ernie Rael
Problem: Vim9: some error messages can be improved Solution: Mention the defining class for variable access error message closes: #13272 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-06patch 9.0.1995: Invalid memory access with empty 'foldexpr'v9.0.1995zeertzjq
Problem: Invalid memory access when 'foldexpr' returns empty string. Solution: Check for NUL. closes: #13293 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-10-05patch 9.0.1986: Vim9: accepting type-annotationsv9.0.1986Yegappan Lakshmanan
Problem: Vim9: accepting type-annotations Solution: Reject type annotations outside of declarations. closes: #13267 closes: #13283 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-04patch 9.0.1982: vim9: clean up from v9.0.1955v9.0.1982Ernie Rael
Problem: vim9: clean up from v9.0.1955 Solution: Fix a few remaining issues, improve error message - Use `cl_exec`, the executing class, to check permissions in `get_lval()`. - Handle lockvar of script variable from class. - Add 'in class "Xxx"' to e_cannot_access_private_variable_str. closes: #13222 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-29patch 9.0.1955: Vim9: lockvar issues with objects/classesv9.0.1955Ernie Rael
Problem: Vim9: lockvar issues with objects/classes Solution: fix `get_lhs()` object/class access and avoid `SEGV`, make error messages more accurate. - `get_lval()` detects/returns object/class access - `compile_lock_unlock()` generate code for bare static and obj_arg access - `do_lock_var()` check lval for `ll_object`/`ll_class` and fail if so. Details: - Add `ll_object`/`ll_class`/`ll_oi` to `lval_T`. - Add `lockunlock_T` to `isn_T` for `is_arg` to specify handling of `lval_root` in `get_lval()`. - In `get_lval()`, fill in `ll_object`/`ll_class`/`ll_oi` as needed; when no `[idx] or .key`, check lval_root on the way out. - In `do_lock_var()` check for `ll_object`/`ll_class`; also bullet proof ll_dict case and give `Dictionay required` if problem. (not needed to avoid lockvar crash anymore) - In `compile_lock_unlock()` compile for the class variable and func arg cases. closes: #13174 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-09-27patch 9.0.1945: Vim9: missing support for ro-vars in interfacev9.0.1945Yegappan Lakshmanan
Problem: Vim9: missing support for ro-vars in interface Solution: Support only read-only object variables in an interface, add additional checks when parsing class definitions. closes: #13183 cloess: #13184 cloess: #13185. closes: #13188 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-24patch 9.0.1935: Vim9: not consistent error messagesv9.0.1935RestorerZ
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-21patch 9.0.1926: Vim9: not enough info in error messagev9.0.1926Ernie Rael
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-20patch 9.0.1920: Vim9: cannot write public var in nested objectv9.0.1920Ernie Rael
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-19patch 9.0.1914: Vim9: few issues when accessing object membersv9.0.1914Yegappan Lakshmanan
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-18patch 9.0.1909: Vim9: problem calling class method from other classv9.0.1909Yegappan Lakshmanan
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-15patch 9.0.1898: Vim9: restrict access to static varsv9.0.1898Yegappan Lakshmanan
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>