mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
Deprecate the use of "a=b" for non-temporary assignment in 0.15.
It is still the syntax for temporary assignment; only using it as a standalone command is deprecated.
This commit is contained in:
parent
fbfbef8531
commit
37c3c0b0de
|
@ -25,6 +25,12 @@ This is the draft release notes for 0.15.0, scheduled to be released on
|
|||
The following deprecated features trigger a warning whenever the code is parsed
|
||||
or compiled, even if it is not executed:
|
||||
|
||||
- Using the syntax of temporary assignment (`var=value`) for non-temporary
|
||||
assignment is now deprecated. The syntax is still valid for temporary
|
||||
assignment. For example, using `foo=bar` as a standalone command is
|
||||
deprecated, but using it as part of command, like `foo=bar ls`, is not
|
||||
deprecated.
|
||||
|
||||
- The `chr` command is now deprecated. Use `str:from-codepoints` instead.
|
||||
|
||||
- The `ord` command is now deprecated. Use `str:to-codepoints` instead.
|
||||
|
|
|
@ -161,7 +161,9 @@ func (cp *compiler) formOp(n *parse.Form) effectOp {
|
|||
if len(n.Assignments) > 0 {
|
||||
assignmentOps = cp.assignmentOps(n.Assignments)
|
||||
if n.Head == nil {
|
||||
// Permanent assignment.
|
||||
// Using the syntax of temporary assignment for non-temporary
|
||||
// assignment. Still supported as of 0.15 but deprecated.
|
||||
cp.deprecate(n, `using the syntax of temporary assignment for non-temporary assignment is deprecated; use "var" or "set" instead`, 15)
|
||||
return seqOp{assignmentOps}
|
||||
}
|
||||
for _, a := range n.Assignments {
|
||||
|
|
|
@ -69,6 +69,11 @@ func TestCommand(t *testing.T) {
|
|||
)
|
||||
}
|
||||
|
||||
func TestCommand_DeprecateUsingTemporaryAssignmentForNonTemporaryAssignment(t *testing.T) {
|
||||
testCompileTimeDeprecation(t, "foo=bar", `using the syntax of temporary assignment for non-temporary assignment is deprecated; use "var" or "set" instead`, 15)
|
||||
|
||||
}
|
||||
|
||||
func TestCommand_Special(t *testing.T) {
|
||||
Test(t,
|
||||
// Regression test for #1204; ensures that the arguments of special
|
||||
|
|
Loading…
Reference in New Issue
Block a user