Skip to content

feat(oxc_cli): support ignore-path#86

Merged
Boshen merged 1 commit intooxc-project:mainfrom
jason89521:feat/support-ignore-path
Mar 1, 2023
Merged

feat(oxc_cli): support ignore-path#86
Boshen merged 1 commit intooxc-project:mainfrom
jason89521:feat/support-ignore-path

Conversation

@jason89521
Copy link
Contributor

@jason89521 jason89521 commented Mar 1, 2023

Description

  • Support ignore-path option.
  • Add get_lint_matches to reduce the boilerplate testing code.

Additional information

As mentioned in #54, it seems that the add_custom_ignore_filename doesn't work.

Related issue

#54

@jason89521 jason89521 force-pushed the feat/support-ignore-path branch from 83add4c to 43c332b Compare March 1, 2023 08:55
@jason89521 jason89521 marked this pull request as ready for review March 1, 2023 09:07
@Boshen Boshen merged commit 298e956 into oxc-project:main Mar 1, 2023
@Boshen
Copy link
Member

Boshen commented Mar 1, 2023

Thank you!

@jason89521 jason89521 deleted the feat/support-ignore-path branch March 2, 2023 02:59
Boshen added a commit that referenced this pull request Oct 7, 2025
Reorder Kind enum to make all keywords truly contiguous, enabling a pure range check without additional OR clauses.

## Changes

**Enum Reordering**: Moved `True`, `False`, `Null` from the literals section (after punctuation) to immediately after `Yield`, making all keywords contiguous from `Await..=Null`.

**Before**:
```rust
pub fn is_any_keyword(self) -> bool {
    matches!(self as u8, x if x >= Await as u8 && x <= Yield as u8)
        || matches!(self, True | False | Null)  // Extra check needed!
}
```

**After**:
```rust
pub fn is_any_keyword(self) -> bool {
    matches!(self as u8, x if x >= Await as u8 && x <= Null as u8)  // Pure range check!
}
```

## Assembly Impact

### Before (range + OR)
```asm
; Range check for Await..=Yield
and   w8, w0, #0xff
sub   w8, w8, #5
cmp   w8, #86
cset  w9, lo
; Additional checks for True/False/Null
cmp   w0, #168
ccmp  w0, #171, #0, ne
cset  w0, lo
orr   w0, w9, w0      ; Combine results
```
**7 instructions**

### After (pure range)
```asm
and   w8, w0, #0xff
sub   w8, w8, #5
cmp   w8, #89
cset  w0, lo
```
**4 instructions** (43% reduction!)

## Why This Works

`True`, `False`, and `Null` are **both** keywords AND literals per ECMAScript spec:
- Keywords: Reserved words that cannot be used as identifiers
- Literals: Values with specific meanings

Grouping them with keywords is semantically correct and enables better optimization. The `is_literal()` function explicitly checks for these tokens, so their position in the enum doesn't affect correctness.

## Performance

- Called from `advance()` on **every token**
- **3 fewer instructions** on the hottest path
- **Simpler control flow** = better branch prediction
- **No OR operation** = faster execution

Added comprehensive tests including verification that True/False/Null work correctly as both keywords and literals.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Boshen added a commit that referenced this pull request Oct 7, 2025
Reorder Kind enum to make all keywords truly contiguous, enabling a pure range check without additional OR clauses.

## Changes

**Enum Reordering**: Moved `True`, `False`, `Null` from the literals section (after punctuation) to immediately after `Yield`, making all keywords contiguous from `Await..=Null`.

**Before**:
```rust
pub fn is_any_keyword(self) -> bool {
    matches!(self as u8, x if x >= Await as u8 && x <= Yield as u8)
        || matches!(self, True | False | Null)  // Extra check needed!
}
```

**After**:
```rust
pub fn is_any_keyword(self) -> bool {
    matches!(self as u8, x if x >= Await as u8 && x <= Null as u8)  // Pure range check!
}
```

## Assembly Impact

### Before (range + OR)
```asm
; Range check for Await..=Yield
and   w8, w0, #0xff
sub   w8, w8, #5
cmp   w8, #86
cset  w9, lo
; Additional checks for True/False/Null
cmp   w0, #168
ccmp  w0, #171, #0, ne
cset  w0, lo
orr   w0, w9, w0      ; Combine results
```
**7 instructions**

### After (pure range)
```asm
and   w8, w0, #0xff
sub   w8, w8, #5
cmp   w8, #89
cset  w0, lo
```
**4 instructions** (43% reduction!)

## Why This Works

`True`, `False`, and `Null` are **both** keywords AND literals per ECMAScript spec:
- Keywords: Reserved words that cannot be used as identifiers
- Literals: Values with specific meanings

Grouping them with keywords is semantically correct and enables better optimization. The `is_literal()` function explicitly checks for these tokens, so their position in the enum doesn't affect correctness.

## Performance

- Called from `advance()` on **every token**
- **3 fewer instructions** on the hottest path
- **Simpler control flow** = better branch prediction
- **No OR operation** = faster execution

Added comprehensive tests including verification that True/False/Null work correctly as both keywords and literals.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants