Skip to content

Commit e5fd079

Browse files
committed
reduce property access
1 parent e6fd70b commit e5fd079

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/tailwindcss/src/utilities.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4619,9 +4619,12 @@ export function createCssUtility(node: AtRule) {
46194619
designSystem.utilities.functional(name.slice(0, -2), (candidate) => {
46204620
let atRule = structuredClone(node)
46214621

4622+
let value = candidate.value
4623+
let modifier = candidate.modifier
4624+
46224625
// A value is required for functional utilities, if you want to accept
46234626
// just `tab-size`, you'd have to use a static utility.
4624-
if (candidate.value === null) return
4627+
if (value === null) return
46254628

46264629
// Whether `--value(…)` was used
46274630
let usedValueFn = false
@@ -4667,7 +4670,7 @@ export function createCssUtility(node: AtRule) {
46674670
if (valueNode.value === '--value') {
46684671
usedValueFn = true
46694672

4670-
let resolved = resolveValueFunction(candidate.value!, valueNode, designSystem)
4673+
let resolved = resolveValueFunction(value, valueNode, designSystem)
46714674
if (resolved) {
46724675
resolvedValueFn = true
46734676
if (resolved.ratio) {
@@ -4689,14 +4692,14 @@ export function createCssUtility(node: AtRule) {
46894692
else if (valueNode.value === '--modifier') {
46904693
// If there is no modifier present in the candidate, then the
46914694
// declaration can be removed.
4692-
if (candidate.modifier === null) {
4695+
if (modifier === null) {
46934696
replaceDeclarationWith([])
46944697
return ValueParser.ValueWalkAction.Skip
46954698
}
46964699

46974700
usedModifierFn = true
46984701

4699-
let replacement = resolveValueFunction(candidate.modifier!, valueNode, designSystem)
4702+
let replacement = resolveValueFunction(modifier, valueNode, designSystem)
47004703
if (replacement) {
47014704
resolvedModifierFn = true
47024705
replaceWith(replacement.nodes)
@@ -4726,7 +4729,7 @@ export function createCssUtility(node: AtRule) {
47264729

47274730
// When a candidate has a modifier, then the `--modifier(…)` must
47284731
// resolve correctly or the `--value(ratio)` must resolve correctly.
4729-
if (candidate.modifier && !resolvedRatioValue && !resolvedModifierFn) return null
4732+
if (modifier && !resolvedRatioValue && !resolvedModifierFn) return null
47304733

47314734
// Resolved `--value(ratio)`, so all other declarations that didn't use
47324735
// `--value(ratio)` should be removed. E.g.: `--value(number)` would

0 commit comments

Comments
 (0)