Skip to content

Commit a4733d2

Browse files
chore(refactor): minor tweak
1 parent d92d3c3 commit a4733d2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

assembly/nfa/matcher.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class CharacterRangeMatcher extends Matcher {
118118

119119
matches(code: u32): bool {
120120
for (let i = 0, len = this.ranges.length; i < len; i++) {
121-
if (code >= u32(this.ranges[i].from) && code <= u32(this.ranges[i].to)) {
121+
if (this.ranges[i].contains(code)) {
122122
return true;
123123
}
124124
}

assembly/util.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ export class Range {
2424
offset(value: i32): Range {
2525
return new Range(this.from + value, this.to + value);
2626
}
27+
28+
contains(value: i32): bool {
29+
return value >= this.from && value <= this.to;
30+
}
2731
}

0 commit comments

Comments
 (0)