Skip to content

Commit bd72124

Browse files
committed
Add removed Null
1 parent 8ad3876 commit bd72124

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/ps/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ impl<'a> RuleMut<'a> for CastNull {
211211
if view.kind() == "expression_with_unary_operator" {
212212
if let (Some(operator), Some(expression)) = (view.child(0), view.child(1)) {
213213
match (operator.text()?.to_lowercase().as_str(), expression.data()) {
214-
("+", Some(Powershell::DeadCode)) => node.set(Raw(Num(0))),
215-
("-", Some(Powershell::DeadCode)) => node.set(Raw(Num(0))),
214+
("+", Some(Powershell::Null)) => node.set(Raw(Num(0))),
215+
("-", Some(Powershell::Null)) => node.set(Raw(Num(0))),
216216
_ => (),
217217
}
218218
}

src/ps/forward.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::error::{Error, MinusOneResult};
22
use crate::ps::Powershell;
3-
use crate::ps::Powershell::DeadCode;
3+
use crate::ps::Powershell::Null;
44
use crate::rule::RuleMut;
55
use crate::tree::{ControlFlow, NodeMut};
66

@@ -92,7 +92,7 @@ impl<'a> RuleMut<'a> for Forward {
9292
}
9393
} else {
9494
// an empty subexpression is considering as null output
95-
node.reduce(DeadCode)
95+
node.reduce(Null)
9696
}
9797
}
9898
"parenthesized_expression" => {

src/ps/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ pub enum Powershell {
105105
Array(Vec<Value>),
106106
PSItem(Vec<Value>),
107107
DeadCode,
108+
Null,
108109
HashMap(BTreeMap<Value, Value>),
109110
HashEntry(Value, Value),
110111
Type(String), // Will infer type

src/ps/var.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::error::{Error, MinusOneResult};
2-
use crate::ps::Powershell::{self, Array, DeadCode, Raw, Type};
2+
use crate::ps::Powershell::{self, Array, Null, Raw, Type};
33
use crate::ps::Value::{self, Bool, Num, Str};
44
use crate::regex::Regex;
55
use crate::rule::{Rule, RuleMut};
@@ -656,7 +656,7 @@ impl<'a> RuleMut<'a> for StaticVar {
656656
match view.text()?.to_lowercase().as_str() {
657657
"$shellid" => node.set(Raw(Str(String::from("Microsoft.Powershell")))),
658658
"$?" => node.set(Raw(Bool(true))),
659-
"$null" => node.set(DeadCode),
659+
"$null" => node.set(Null),
660660
"$pshome" => node.set(Raw(Str(String::from(
661661
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0",
662662
)))),

0 commit comments

Comments
 (0)