Skip to content

Commit

Permalink
Less_Parser: De-duplicate Less_Tree_Color::fromKeyword method
Browse files Browse the repository at this point in the history
This was forked in 2013 to support a new cache feature (5cfce73),
whereby each object needed an extra property. This feature has since
been removed in 2023 with 2370bbe (Ief46e2548), thus making the copy
identical and redundant.

Bug: T353249
Change-Id: I4b500222787eebcd5cb303db5e2f0621a427244b
  • Loading branch information
anny21 authored and Krinkle committed Jan 5, 2024
1 parent 79ae252 commit 9d985de
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1043,33 +1043,14 @@ private function parseEntitiesKeyword() {
$k = $this->MatchReg( '/\\G%|\\G[_A-Za-z-][_A-Za-z0-9-]*/' );
if ( $k ) {
$k = $k[0];
$color = $this->fromKeyword( $k );
$color = Less_Tree_Color::fromKeyword( $k );
if ( $color ) {
return $color;
}
return new Less_Tree_Keyword( $k );
}
}

// duplicate of Less_Tree_Color::FromKeyword
private function FromKeyword( $keyword ) {
$c = $keyword = strtolower( $keyword );

if ( Less_Colors::hasOwnProperty( $keyword ) ) {
// detect named color
$c = new Less_Tree_Color( substr( Less_Colors::color( $keyword ), 1 ) );
}

if ( $keyword === 'transparent' ) {
$c = new Less_Tree_Color( [ 0, 0, 0 ], 0, true );
}

if ( isset( $c ) && is_object( $c ) ) {
$c->value = $keyword;
return $c;
}
}

//
// A function call
//
Expand Down

0 comments on commit 9d985de

Please sign in to comment.