Skip to content

Commit

Permalink
use Object.setPrototypeOf instead of __proto__
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Dec 27, 2022
1 parent 6b61dea commit 2b227d7
Show file tree
Hide file tree
Showing 48 changed files with 80 additions and 80 deletions.
4 changes: 2 additions & 2 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ParseError(msg) {
* Inherit from `Error.prototype`.
*/

ParseError.prototype.__proto__ = Error.prototype;
Object.setPrototypeOf(ParseError.prototype, Error.prototype);

/**
* Initialize a new `SyntaxError` with the given `msg`.
Expand All @@ -52,4 +52,4 @@ function SyntaxError(msg) {
* Inherit from `Error.prototype`.
*/

SyntaxError.prototype.__proto__ = Error.prototype;
Object.setPrototypeOf(SyntaxError.prototype, Error.prototype);
2 changes: 1 addition & 1 deletion lib/nodes/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var Arguments = module.exports = function Arguments(){
* Inherit from `nodes.Expression.prototype`.
*/

Arguments.prototype.__proto__ = nodes.Expression.prototype;
Object.setPrototypeOf(Arguments.prototype, nodes.Expression.prototype);

/**
* Initialize an `Arguments` object with the nodes
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/atblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Atblock.prototype.__defineGetter__('nodes', function(){
* Inherit from `Node.prototype`.
*/

Atblock.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Atblock.prototype, Node.prototype);

/**
* Return a clone of this node.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/atrule.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var Atrule = module.exports = function Atrule(type){
* Inherit from `Node.prototype`.
*/

Atrule.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Atrule.prototype, Node.prototype);

/**
* Check if at-rule's block has only properties.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/binop.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ var BinOp = module.exports = function BinOp(op, left, right){
* Inherit from `Node.prototype`.
*/

BinOp.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(BinOp.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Block = module.exports = function Block(parent, node){
* Inherit from `Node.prototype`.
*/

Block.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Block.prototype, Node.prototype);

/**
* Check if this block has properties..
Expand Down Expand Up @@ -77,7 +77,7 @@ Block.prototype.__defineGetter__('isEmpty', function(){

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var Boolean = module.exports = function Boolean(val){
* Inherit from `Node.prototype`.
*/

Boolean.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Boolean.prototype, Node.prototype);

/**
* Return `this` node.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ var Call = module.exports = function Call(name, args){
* Inherit from `Node.prototype`.
*/

Call.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Call.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/charset.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var Charset = module.exports = function Charset(val){
* Inherit from `Node.prototype`.
*/

Charset.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Charset.prototype, Node.prototype);

/**
* Return @charset "val".
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Comment = module.exports = function Comment(str, suppress, inline){
* Inherit from `Node.prototype`.
*/

Comment.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Comment.prototype, Node.prototype);

/**
* Return a JSON representation of this node.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/each.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ var Each = module.exports = function Each(val, key, expr, block){
* Inherit from `Node.prototype`.
*/

Each.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Each.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Expression.prototype.__defineGetter__('hash', function(){
* Inherit from `Node.prototype`.
*/

Expression.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Expression.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ var Extend = module.exports = function Extend(selectors){
* Inherit from `Node.prototype`.
*/

Extend.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Extend.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ var Feature = module.exports = function Feature(segs){
* Inherit from `Node.prototype`.
*/

Feature.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Feature.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Function.prototype.__defineGetter__('arity', function(){
* Inherit from `Node.prototype`.
*/

Function.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Function.prototype, Node.prototype);

/**
* Return hash.
Expand All @@ -58,7 +58,7 @@ Function.prototype.__defineGetter__('hash', function(){

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var Group = module.exports = function Group(){
* Inherit from `Node.prototype`.
*/

Group.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Group.prototype, Node.prototype);

/**
* Push the given `selector` node.
Expand Down Expand Up @@ -74,7 +74,7 @@ Group.prototype.__defineGetter__('hasOnlyPlaceholders', function(){

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/hsla.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var HSLA = exports = module.exports = function HSLA(h,s,l,a){
* Inherit from `Node.prototype`.
*/

HSLA.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(HSLA.prototype, Node.prototype);

/**
* Return hsla(n,n,n,n).
Expand All @@ -54,7 +54,7 @@ HSLA.prototype.toString = function(){

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/ident.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ Ident.prototype.__defineGetter__('hash', function(){
* Inherit from `Node.prototype`.
*/

Ident.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Ident.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/if.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ var If = module.exports = function If(cond, negate){
* Inherit from `Node.prototype`.
*/

If.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(If.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var Import = module.exports = function Import(expr, once){
* Inherit from `Node.prototype`.
*/

Import.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Import.prototype, Node.prototype);

/**
* Return a clone of this node.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/keyframes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ var Keyframes = module.exports = function Keyframes(segs, prefix){
* Inherit from `Atrule.prototype`.
*/

Keyframes.prototype.__proto__ = Atrule.prototype;
Object.setPrototypeOf(Keyframes.prototype, Atrule.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var Literal = module.exports = function Literal(str){
* Inherit from `Node.prototype`.
*/

Literal.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Literal.prototype, Node.prototype);

/**
* Return hash.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var Media = module.exports = function Media(val){
* Inherit from `Atrule.prototype`.
*/

Media.prototype.__proto__ = Atrule.prototype;
Object.setPrototypeOf(Media.prototype, Atrule.prototype);

/**
* Clone this node.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var Member = module.exports = function Member(left, right){
* Inherit from `Node.prototype`.
*/

Member.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Member.prototype, Node.prototype);

/**
* Return a clone of this node.
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var Namespace = module.exports = function Namespace(val, prefix){
* Inherit from `Node.prototype`.
*/

Namespace.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Namespace.prototype, Node.prototype);

/**
* Return @namespace "val".
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function CoercionError(msg) {
* Inherit from `Error.prototype`.
*/

CoercionError.prototype.__proto__ = Error.prototype;
Object.setPrototypeOf(CoercionError.prototype, Error.prototype);

/**
* Node constructor.
Expand Down Expand Up @@ -84,7 +84,7 @@ Node.prototype = {

/**
* Return this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/null.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Null = module.exports = function Null(){};
* Inherit from `Node.prototype`.
*/

Null.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Null.prototype, Node.prototype);

/**
* Return 'Null'.
Expand All @@ -33,7 +33,7 @@ Null.prototype.__proto__ = Node.prototype;
* @api public
*/

Null.prototype.inspect =
Null.prototype.inspect =
Null.prototype.toString = function(){
return 'null';
};
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var Object = module.exports = function Object(){
* Inherit from `Node.prototype`.
*/

Object.prototype.__proto__ = Node.prototype;
globalThis.Object.setPrototypeOf(Object.prototype, Node.prototype);

/**
* Set `key` to `val`.
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Params.prototype.__defineGetter__('length', function(){
* Inherit from `Node.prototype`.
*/

Params.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Params.prototype, Node.prototype);

/**
* Push the given `node`.
Expand All @@ -55,7 +55,7 @@ Params.prototype.push = function(node){

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/nodes/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ var Property = module.exports = function Property(segs, expr){
* Inherit from `Node.prototype`.
*/

Property.prototype.__proto__ = Node.prototype;
Object.setPrototypeOf(Property.prototype, Node.prototype);

/**
* Return a clone of this node.
*
*
* @return {Node}
* @api public
*/
Expand Down
Loading

0 comments on commit 2b227d7

Please sign in to comment.