From 18344fbd0d06b71199c9bef5b9dbbfde42663562 Mon Sep 17 00:00:00 2001 From: Devon Burriss Date: Thu, 24 Mar 2022 19:53:57 +0100 Subject: [PATCH 1/3] Adds Interface SpaceKind --- src/spaces.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spaces.rs b/src/spaces.rs index 73d943243..04d9ac263 100644 --- a/src/spaces.rs +++ b/src/spaces.rs @@ -38,6 +38,8 @@ pub enum SpaceKind { Unit, /// A `C/C++` namespace Namespace, + /// An interface + Interface, } impl fmt::Display for SpaceKind { @@ -51,6 +53,7 @@ impl fmt::Display for SpaceKind { SpaceKind::Impl => "impl", SpaceKind::Unit => "unit", SpaceKind::Namespace => "namespace", + SpaceKind::Interface => "interface", }; write!(f, "{}", s) } From c766633c5b30a4cc414ea4c79f0b253194314852 Mon Sep 17 00:00:00 2001 From: Devon Burriss Date: Thu, 24 Mar 2022 19:54:33 +0100 Subject: [PATCH 2/3] Enables Java interface function space --- src/checker.rs | 7 ++++++- src/getter.rs | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index 475049866..49957be7b 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -209,7 +209,12 @@ impl Checker for JavaCode { mk_checker!(is_call, MethodInvocation); mk_checker!(is_func, MethodDeclaration); mk_checker!(is_closure,); - mk_checker!(is_func_space, Program, ClassDeclaration); + mk_checker!( + is_func_space, + Program, + ClassDeclaration, + InterfaceDeclaration + ); mk_checker!(is_non_arg,); } diff --git a/src/getter.rs b/src/getter.rs index ec7f95828..edd8a22b1 100644 --- a/src/getter.rs +++ b/src/getter.rs @@ -515,8 +515,9 @@ impl Getter for JavaCode { let typ = node.object().kind_id(); match typ.into() { - InterfaceDeclaration | ClassDeclaration => SpaceKind::Class, + ClassDeclaration => SpaceKind::Class, MethodDeclaration | LambdaExpression => SpaceKind::Function, + InterfaceDeclaration => SpaceKind::Interface, Program => SpaceKind::Unit, _ => SpaceKind::Unknown, } From a0c7cb04ccf6c7f1128e82d9559bbd7e94c30d36 Mon Sep 17 00:00:00 2001 From: Devon Burriss Date: Thu, 24 Mar 2022 20:33:59 +0100 Subject: [PATCH 3/3] Enables TS & TSX interface function space --- src/checker.rs | 2 ++ src/getter.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/checker.rs b/src/checker.rs index 49957be7b..ba99cbb04 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -288,6 +288,7 @@ impl Checker for TypescriptCode { MethodDefinition, GeneratorFunctionDeclaration, ClassDeclaration, + InterfaceDeclaration, ArrowFunction ); @@ -325,6 +326,7 @@ impl Checker for TsxCode { GeneratorFunction, GeneratorFunctionDeclaration, ClassDeclaration, + InterfaceDeclaration, ArrowFunction ); diff --git a/src/getter.rs b/src/getter.rs index edd8a22b1..704326dc3 100644 --- a/src/getter.rs +++ b/src/getter.rs @@ -251,6 +251,7 @@ impl Getter for TypescriptCode { | GeneratorFunctionDeclaration | ArrowFunction => SpaceKind::Function, Class | ClassDeclaration => SpaceKind::Class, + InterfaceDeclaration => SpaceKind::Interface, Program => SpaceKind::Unit, _ => SpaceKind::Unknown, } @@ -321,6 +322,7 @@ impl Getter for TsxCode { | GeneratorFunctionDeclaration | ArrowFunction => SpaceKind::Function, Class | ClassDeclaration => SpaceKind::Class, + InterfaceDeclaration => SpaceKind::Interface, Program => SpaceKind::Unit, _ => SpaceKind::Unknown, }