Skip to content

Commit

Permalink
rename rules -> children
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Jan 14, 2017
1 parent 8f36965 commit 3839d01
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions lib/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function getInfo(start) {

function getStylesheet(nested) {
var start = scanner.tokenStart;
var rules = new List();
var children = new List();
var child;

scan:
Expand Down Expand Up @@ -120,13 +120,13 @@ function getStylesheet(nested) {
child = getRule();
}

rules.appendData(child);
children.appendData(child);
}

return {
type: 'StyleSheet',
info: getInfo(start),
rules: rules
children: children
};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function translateSimpleSelector(list) {
function translate(node) {
switch (node.type) {
case 'StyleSheet':
return each(node.rules);
return each(node.children);

case 'Atrule':
return translateAtRule(node);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/translateWithSourceMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function eachDelim(list, delimeter) {
function translate(node) {
switch (node.type) {
case 'StyleSheet':
return createAnonymousSourceNode(node.rules.map(translate));
return createAnonymousSourceNode(node.children.map(translate));

case 'Atrule':
var nodes = ['@', node.name];
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function walkRules(node, item, list) {
var oldStylesheet = this.stylesheet;
this.stylesheet = node;

node.rules.each(walkRules, this);
node.children.each(walkRules, this);

this.stylesheet = oldStylesheet;
break;
Expand All @@ -30,7 +30,7 @@ function walkRulesRight(node, item, list) {
var oldStylesheet = this.stylesheet;
this.stylesheet = node;

node.rules.eachRight(walkRulesRight, this);
node.children.eachRight(walkRulesRight, this);

this.stylesheet = oldStylesheet;
break;
Expand All @@ -55,7 +55,7 @@ function walkDeclarations(node) {
var oldStylesheet = this.stylesheet;
this.stylesheet = node;

node.rules.each(walkDeclarations, this);
node.children.each(walkDeclarations, this);

this.stylesheet = oldStylesheet;
break;
Expand Down Expand Up @@ -94,7 +94,7 @@ function walk(walk, node) {
var oldStylesheet = this.stylesheet;
this.stylesheet = node;

node.rules.each(walk, this);
node.children.each(walk, this);

this.stylesheet = oldStylesheet;
break;
Expand Down
24 changes: 12 additions & 12 deletions test/fixture/parse/atrule/stylesheet.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -76,7 +76,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -165,7 +165,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -251,7 +251,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -304,7 +304,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -393,7 +393,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -458,7 +458,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -545,7 +545,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -598,7 +598,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -663,7 +663,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -762,7 +762,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down Expand Up @@ -820,7 +820,7 @@
},
"block": {
"type": "StyleSheet",
"rules": [
"children": [
{
"type": "Rule",
"selector": {
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/parse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var wrapper = {
stylesheet: function(ast) {
return {
type: 'StyleSheet',
rules: [ast]
children: [ast]
};
},
value: function(ast) {
Expand Down
Loading

0 comments on commit 3839d01

Please sign in to comment.