Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the variable syntax to namespace.$name #1459

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/core_functions/meta/load_css/error.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Error: $a was not declared with !default in the @used module.

<===> with/namespace/_midstream.scss
@use "upstream";
$upstream.a: c !default;
upstream.$a: c !default;

<===> with/namespace/_upstream.scss
$a: d;
Expand Down Expand Up @@ -582,15 +582,15 @@ Error: Undefined variable.
@use "sass:meta";
@meta.load-css("other");

a {b: $other.c}
a {b: other.$c}

<===> member/namespace/_other.scss
$c: d;

<===> member/namespace/error
Error: There is no module with the namespace "other".
,
4 | a {b: $other.c}
4 | a {b: other.$c}
| ^^^^^^^^
'
input.scss 4:7 root stylesheet
4 changes: 2 additions & 2 deletions spec/core_functions/meta/load_css/twice.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
@use "shared";
@include meta.load-css("other");

a {shared-b: $shared.b}
a {shared-b: shared.$b}

<===> shares_state/_other.scss
@use "shared";

$shared.b: value set by other;
shared.$b: value set by other;

<===> shares_state/_shared.scss
$b: default value;
Expand Down
4 changes: 2 additions & 2 deletions spec/core_functions/meta/load_css/with.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ configuration will use the configured module.

<===> multi_load/use/_midstream.scss
@use "upstream";
b {c: $upstream.a}
b {c: upstream.$a}

<===> multi_load/use/_upstream.scss
$a: original !default;
Expand All @@ -297,7 +297,7 @@ b {
@use "loads";
@use "midstream";

b {c: $midstream.a}
b {c: midstream.$a}

<===> multi_load/forward/_loads.scss
@use "sass:meta";
Expand Down
4 changes: 2 additions & 2 deletions spec/core_functions/modules/general.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ a {
================================================================================
<===> error/set_variable/input.scss
@use "sass:math";
$math.a: b;
math.$a: b;

<===> error/set_variable/error
Error: Undefined variable.
,
2 | $math.a: b;
2 | math.$a: b;
| ^^^^^^^^^^
'
input.scss 2:1 root stylesheet
Expand Down
8 changes: 4 additions & 4 deletions spec/css/custom_properties/error.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ Error: Invalid CSS after " --prop: };": expected selector or at-rule, was "}"
Use --trace for backtrace.

<===> brackets/curly/error-dart-sass
Error: expected "{".
Error: unmatched "}".
,
2 | --prop: };
| ^
3 | }
| ^
'
input.scss 2:13 root stylesheet
input.scss 3:1 root stylesheet

<===>
================================================================================
Expand Down
8 changes: 4 additions & 4 deletions spec/directives/forward/member/as.hrx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<===> variable_use/input.scss
@use "midstream";

a {b: $midstream.d-c}
a {b: midstream.$d-c}

<===> variable_use/_midstream.scss
@forward "upstream" as d-*;
Expand All @@ -19,7 +19,7 @@ a {
<===> variable_assignment/top_level/input.scss
@use "midstream";

$midstream.d-a: new value;
midstream.$d-a: new value;

b {c: midstream.d-get-a()};

Expand All @@ -44,7 +44,7 @@ b {
a {
// Namespaced assignments always assign to the other module's variable, even
// if they're nested in a block scope.
$midstream.d-b: new value;
midstream.$d-b: new value;

c: midstream.d-get-b();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ c {
<===> different_separator/input.scss
@use "midstream";

a {b: $midstream.d-c}
a {b: midstream.$d-c}

<===> different_separator/_midstream.scss
@forward "upstream" as d_*;
Expand Down
6 changes: 3 additions & 3 deletions spec/directives/forward/member/bare.hrx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<===> variable_use/input.scss
@use "midstream";

a {b: $midstream.c}
a {b: midstream.$c}

<===> variable_use/_midstream.scss
@forward "upstream";
Expand All @@ -19,7 +19,7 @@ a {
<===> variable_assignment/top_level/input.scss
@use "midstream";

$midstream.a: new value;
midstream.$a: new value;

b {c: midstream.get-a()};

Expand All @@ -44,7 +44,7 @@ b {
a {
// Namespaced assignments always assign to the other module's variable, even
// if they're nested in a block scope.
$midstream.b: new value;
midstream.$b: new value;

c: midstream.get-b();
}
Expand Down
4 changes: 2 additions & 2 deletions spec/directives/forward/member/import.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ b {
<===> forward_to_import/variable_assignment/input.scss
@use "used";

$used.a: new value;
used.$a: new value;

b {c: used.get-a()};

Expand All @@ -95,7 +95,7 @@ b {
<===> forward_to_import/variable_use/input.scss
@use "used";

a {b: $used.c}
a {b: used.$c}

<===> forward_to_import/variable_use/_used.scss
@forward "forwarded";
Expand Down
4 changes: 2 additions & 2 deletions spec/directives/forward/member/shadowed.hrx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<===> variable_use/input.scss
@use "midstream";

a {b: $midstream.c}
a {b: midstream.$c}

<===> variable_use/_midstream.scss
@forward "upstream";
Expand All @@ -21,7 +21,7 @@ a {
<===> variable_assignment/top_level/input.scss
@use "midstream";

$midstream.a: new value;
midstream.$a: new value;

b {
midstream: midstream.get-midstream-a();
Expand Down
10 changes: 5 additions & 5 deletions spec/directives/forward/member/visibility.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $a: old value;
<===> hide/variable_assignment/input.scss
@use "midstream";

$midstream.a: new value;
midstream.$a: new value;

b {c: midstream.get-a()};

Expand All @@ -47,7 +47,7 @@ $c: e;
<===> hide/variable_use/input.scss
@use "midstream";

a {b: $midstream.c}
a {b: midstream.$c}

<===> hide/variable_use/output.css
a {
Expand Down Expand Up @@ -83,7 +83,7 @@ $c: e;
<===> hide/wrong_type/variable_use/input.scss
@use "midstream";

a {b: $midstream.c}
a {b: midstream.$c}

<===> hide/wrong_type/variable_use/output.css
a {
Expand Down Expand Up @@ -123,7 +123,7 @@ $a: old value;
<===> show/variable_assignment/input.scss
@use "midstream";

$midstream.a: new value;
midstream.$a: new value;

b {c: midstream.get-a()};

Expand All @@ -141,7 +141,7 @@ $c: d;
<===> show/variable_use/input.scss
@use "midstream";

a {b: $midstream.c}
a {b: midstream.$c}

<===> show/variable_use/output.css
a {
Expand Down
16 changes: 8 additions & 8 deletions spec/directives/use/error/member.hrx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<===> missing_member/namespaced/variable_use/input.scss
@use "other";

a {b: $other.member}
a {b: other.$member}

<===> missing_member/namespaced/variable_use/other.scss
<===> missing_member/namespaced/variable_use/error
Error: Undefined variable.
,
3 | a {b: $other.member}
3 | a {b: other.$member}
| ^^^^^^^^^^^^^
'
input.scss 3:7 root stylesheet
Expand All @@ -17,13 +17,13 @@ Error: Undefined variable.
<===> missing_member/namespaced/variable_declaration/input.scss
@use "other";

$other.member: value;
other.$member: value;

<===> missing_member/namespaced/variable_declaration/other.scss
<===> missing_member/namespaced/variable_declaration/error
Error: Undefined variable.
,
3 | $other.member: value;
3 | other.$member: value;
| ^^^^^^^^^^^^^^^^^^^^
'
input.scss 3:1 root stylesheet
Expand Down Expand Up @@ -95,7 +95,7 @@ Error: Undefined mixin.
<===>
================================================================================
<===> member_before_use/variable_use/input.scss
$variable: $other.member;
$variable: other.$member;
@use "other";

<===> member_before_use/variable_use/other.scss
Expand All @@ -104,15 +104,15 @@ $member: value;
<===> member_before_use/variable_use/error
Error: There is no module with the namespace "other".
,
1 | $variable: $other.member;
1 | $variable: other.$member;
| ^^^^^^^^^^^^^
'
input.scss 1:12 root stylesheet

<===>
================================================================================
<===> member_before_use/variable_declaration/input.scss
$other.member: value;
other.$member: value;
@use "other";

<===> member_before_use/variable_declaration/other.scss
Expand All @@ -121,7 +121,7 @@ $member: value;
<===> member_before_use/variable_declaration/error
Error: There is no module with the namespace "other".
,
1 | $other.member: value;
1 | other.$member: value;
| ^^^^^^^^^^^^^^^^^^^^
'
input.scss 1:1 root stylesheet
Expand Down
34 changes: 17 additions & 17 deletions spec/directives/use/error/syntax.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -314,38 +314,38 @@ Error: Expected identifier.
<===>
================================================================================
<===> member/variable/no_member/input.scss
a {a: $namespace.}
a {a: namespace.$}

<===> member/variable/no_member/error
Error: Expected identifier.
,
1 | a {a: $namespace.}
1 | a {a: namespace.$}
| ^
'
input.scss 1:18 root stylesheet

<===>
================================================================================
<===> member/variable/private/input.scss
a {a: $namespace._member}
a {a: namespace.$_member}

<===> member/variable/private/error
Error: Private members can't be accessed from outside their modules.
,
1 | a {a: $namespace._member}
| ^^^^^^^
1 | a {a: namespace.$_member}
| ^^^^^^^^^^^^^^^^^^
'
input.scss 1:18 root stylesheet
input.scss 1:7 root stylesheet

<===>
================================================================================
<===> member/variable/global/input.scss
$namespace.member: value !global;
namespace.$member: value !global;

<===> member/variable/global/error
Error: !global isn't allowed for variables in other modules.
,
1 | $namespace.member: value !global;
1 | namespace.$member: value !global;
| ^^^^^^^
'
input.scss 1:26 root stylesheet
Expand Down Expand Up @@ -408,16 +408,16 @@ Error: expected "{".
// Private member usage is a syntax error, so it should fail at parse time
// without needing to be executed.
@function foo() {
@debug $namespace._member;
@debug namespace.$_member;
}

<===> member/unused_private/error
Error: Private members can't be accessed from outside their modules.
,
4 | @debug $namespace._member;
| ^^^^^^^
4 | @debug namespace.$_member;
| ^^^^^^^^^^^^^^^^^^
'
input.scss 4:21 root stylesheet
input.scss 4:10 root stylesheet

<===>
================================================================================
Expand Down Expand Up @@ -474,15 +474,15 @@ Error: Expected identifier.
<===>
================================================================================
<===> with/namespace_variable/input.scss
@use "other" with ($a.b: c);
@use "other" with (a.$b: c);

<===> with/namespace_variable/error
Error: expected ":".
Error: expected "$".
,
1 | @use "other" with ($a.b: c);
| ^
1 | @use "other" with (a.$b: c);
| ^
'
input.scss 1:22 root stylesheet
input.scss 1:20 root stylesheet

<===>
================================================================================
Expand Down
Loading