-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6849715
commit 8e0bb25
Showing
8 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2021 Google LLC. Use of this source code is governed by an | ||
// MIT-style license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import {hash} from 'immutable'; | ||
|
||
import {Value} from './index'; | ||
|
||
/** A first-class SassScript mixin. */ | ||
export class SassMixin extends Value { | ||
/** | ||
* If this mixin is defined in the compiler, this is the unique ID that the | ||
* compiler uses to determine which mixin it refers to. | ||
* | ||
* This is marked as public so that the protofier can access it, but it's not | ||
* part of the package's public API and should not be accessed by user code. | ||
* It may be renamed or removed without warning in the future. | ||
*/ | ||
readonly id: number | undefined; | ||
|
||
constructor(id: number) { | ||
super(); | ||
this.id = id; | ||
} | ||
|
||
equals(other: Value): boolean { | ||
return this.id === undefined | ||
? other === this | ||
: other instanceof SassMixin && other.id === this.id; | ||
} | ||
|
||
hashCode(): number { | ||
return hash(this.id); | ||
} | ||
|
||
toString(): string { | ||
return `<compiler mixin ${this.id}>`; | ||
} | ||
|
||
assertMixin(): SassMixin { | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters