Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/alterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Alterator for KotlinCode {}
impl Alterator for MozjsCode {
fn alterate(node: &Node, code: &[u8], span: bool, children: Vec<AstNode>) -> AstNode {
match Mozjs::from(node.kind_id()) {
Mozjs::String => {
Mozjs::String | Mozjs::String2 => {
// TODO: have a thought about template_strings:
// they may have children for replacement...
let (text, span) = Self::get_text_span(node, code, span, true);
Expand Down
12 changes: 6 additions & 6 deletions src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ macro_rules! is_js_func {
($parser: ident, $node: ident) => {
match $node.kind_id().into() {
FunctionDeclaration | MethodDefinition => true,
Function => check_if_func!($parser, $node),
FunctionExpression => check_if_func!($parser, $node),
ArrowFunction => check_if_arrow_func!($parser, $node),
_ => false,
}
Expand All @@ -63,7 +63,7 @@ macro_rules! is_js_closure {
($parser: ident, $node: ident) => {
match $node.kind_id().into() {
GeneratorFunction | GeneratorFunctionDeclaration => true,
Function => !check_if_func!($parser, $node),
FunctionExpression => !check_if_func!($parser, $node),
ArrowFunction => !check_if_arrow_func!($parser, $node),
_ => false,
}
Expand Down Expand Up @@ -376,7 +376,7 @@ impl Checker for MozjsCode {
matches!(
node.kind_id().into(),
Mozjs::Program
| Mozjs::Function
| Mozjs::FunctionExpression
| Mozjs::Class
| Mozjs::GeneratorFunction
| Mozjs::FunctionDeclaration
Expand Down Expand Up @@ -433,7 +433,7 @@ impl Checker for JavascriptCode {
matches!(
node.kind_id().into(),
Javascript::Program
| Javascript::Function
| Javascript::FunctionExpression
| Javascript::Class
| Javascript::GeneratorFunction
| Javascript::FunctionDeclaration
Expand Down Expand Up @@ -491,7 +491,7 @@ impl Checker for TypescriptCode {
matches!(
node.kind_id().into(),
Typescript::Program
| Typescript::Function
| Typescript::FunctionExpression
| Typescript::Class
| Typescript::GeneratorFunction
| Typescript::FunctionDeclaration
Expand Down Expand Up @@ -550,7 +550,7 @@ impl Checker for TsxCode {
matches!(
node.kind_id().into(),
Tsx::Program
| Tsx::Function
| Tsx::FunctionExpression
| Tsx::Class
| Tsx::GeneratorFunction
| Tsx::FunctionDeclaration
Expand Down
32 changes: 16 additions & 16 deletions src/getter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Getter for MozjsCode {
use Mozjs::*;

match node.kind_id().into() {
Function
FunctionExpression
| MethodDefinition
| GeneratorFunction
| FunctionDeclaration
Expand Down Expand Up @@ -148,10 +148,10 @@ impl Getter for MozjsCode {
| GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ
| STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ
| Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const
| Function | Function2 | SEMI => HalsteadType::Operator,
Identifier | Identifier2 | MemberExpression | PropertyIdentifier | String | Number
| True | False | Null | Void | This | Super | Undefined | Set | Get | Typeof
| Instanceof => HalsteadType::Operand,
| Function | FunctionExpression | SEMI => HalsteadType::Operator,
Identifier | Identifier2 | MemberExpression | MemberExpression2
| PropertyIdentifier | String | String2 | Number | True | False | Null | Void
| This | Super | Undefined | Set | Get | Typeof | Instanceof => HalsteadType::Operand,
_ => HalsteadType::Unknown,
}
}
Expand All @@ -164,7 +164,7 @@ impl Getter for JavascriptCode {
use Javascript::*;

match node.kind_id().into() {
Function
FunctionExpression
| MethodDefinition
| GeneratorFunction
| FunctionDeclaration
Expand Down Expand Up @@ -216,10 +216,10 @@ impl Getter for JavascriptCode {
| GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ
| STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ
| Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const
| Function | SEMI => HalsteadType::Operator,
Identifier | Identifier2 | MemberExpression | PropertyIdentifier | String | Number
| True | False | Null | Void | This | Super | Undefined | Set | Get | Typeof
| Instanceof => HalsteadType::Operand,
| Function | FunctionExpression | SEMI => HalsteadType::Operator,
Identifier | Identifier2 | MemberExpression | MemberExpression2
| PropertyIdentifier | String | String2 | Number | True | False | Null | Void
| This | Super | Undefined | Set | Get | Typeof | Instanceof => HalsteadType::Operand,
_ => HalsteadType::Unknown,
}
}
Expand All @@ -232,7 +232,7 @@ impl Getter for TypescriptCode {
use Typescript::*;

match node.kind_id().into() {
Function
FunctionExpression
| MethodDefinition
| GeneratorFunction
| FunctionDeclaration
Expand Down Expand Up @@ -285,7 +285,7 @@ impl Getter for TypescriptCode {
| GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ
| STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ
| Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const
| Function | SEMI => HalsteadType::Operator,
| Function | FunctionExpression | SEMI => HalsteadType::Operator,
Identifier | NestedIdentifier | MemberExpression | PropertyIdentifier | String
| Number | True | False | Null | Void | This | Super | Undefined | Set | Get
| Typeof | Instanceof => HalsteadType::Operand,
Expand All @@ -301,7 +301,7 @@ impl Getter for TsxCode {
use Tsx::*;

match node.kind_id().into() {
Function
FunctionExpression
| MethodDefinition
| GeneratorFunction
| FunctionDeclaration
Expand Down Expand Up @@ -354,10 +354,10 @@ impl Getter for TsxCode {
| GT | PLUSEQ | BANG | BANGEQEQ | EQEQEQ | DASHEQ | STAREQ | SLASHEQ | PERCENTEQ
| STARSTAREQ | GTGTEQ | GTGTGTEQ | LTLTEQ | AMPEQ | CARET | CARETEQ | PIPEEQ
| Yield | LBRACK | LBRACE | Await | QMARK | QMARKQMARK | New | Let | Var | Const
| Function | SEMI => HalsteadType::Operator,
| Function | FunctionExpression | SEMI => HalsteadType::Operator,
Identifier | NestedIdentifier | MemberExpression | PropertyIdentifier | String
| Number | True | False | Null | Void | This | Super | Undefined | Set | Get
| Typeof | Instanceof => HalsteadType::Operand,
| String2 | Number | True | False | Null | Void | This | Super | Undefined | Set
| Get | Typeof | Instanceof => HalsteadType::Operand,
_ => HalsteadType::Unknown,
}
}
Expand Down
Loading