Skip to content

Commit 2cbff93

Browse files
committed
Operands impl and assertions
1 parent 3dc5bfc commit 2cbff93

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/getter.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ impl Getter for JavaCode {
556556
// | Throws2 | EQ | EQEQ | AMP | AMPAMP | AMPEQ | LT | LTLT | LTEQ | LTLTEQ | BANGEQ
557557
// | GTEQ | GTGTEQ | GTGTGT | GTGTGTEQ | PLUSEQ | BANG | STAREQ | SLASHEQ | PERCENTEQ
558558
// | CARET | CARETEQ | LBRACE | RBRACE | QMARK | Instanceof
559-
// Operator: function calls?
559+
// Operator: function calls
560560
MethodInvocation
561561
// Operator: control flow
562562
| If | Else | Switch | Case | Try | Catch | Throw | Throws | Throws2 | For | While | Continue | Break | Do | Finally
@@ -570,16 +570,14 @@ impl Getter for JavaCode {
570570
| PLUS | DASH | STAR | SLASH | AMP | PIPE | CARET | PERCENT| LTLT | GTGT | GTGTGT
571571
| PLUSEQ | DASHEQ | STAREQ | SLASHEQ | AMPEQ | PIPEEQ | CARETEQ | PERCENTEQ | LTLTEQ | GTGTEQ | GTGTGTEQ
572572
// type identifier
573-
| TypeIdentifier
574-
// Literals
575-
| IntegralType | FloatingPointType | BooleanType | NullLiteral
573+
| TypeIdentifier | IntegralType | FloatingPointType | BooleanType
576574
=> {
577575
println!("operator: {}", node.object().kind().to_string());
578576
HalsteadType::Operator
579577
},
580578

581-
// variables, constants
582-
Identifier | Literal => {
579+
// Operands: variables, constants, literals
580+
Identifier | NullLiteral | ClassLiteral | StringLiteral | CharacterLiteral | HexIntegerLiteral | OctalIntegerLiteral | BinaryIntegerLiteral | DecimalIntegerLiteral | HexFloatingPointLiteral | DecimalFloatingPointLiteral => {
583581
println!("operand: {} ", node.object().kind().to_string());
584582
HalsteadType::Operand
585583
},

src/metrics/halstead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ mod tests {
542542
[
543543
(u_operators, 16, usize), // void ; ( String [ ] ) { , int = + / format . }
544544
(operators, 33, usize),
545-
(u_operands, 11, usize), // main, a, b, c, avg, 3, 5, MessageFormat.format, format, "{}"
545+
(u_operands, 11, usize), // main args a b c avg 5 3 MessageFormat format "{0}"
546546
(operands, 21, usize)
547547
]
548548
);

0 commit comments

Comments
 (0)