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

Support multiple global uses in one file #833

Merged
merged 2 commits into from Sep 27, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/src/async_environment.dart
Expand Up @@ -196,7 +196,7 @@ class AsyncEnvironment {
/// with the same name as a variable defined in this environment.
void addModule(Module module, {String namespace}) {
if (namespace == null) {
_globalModules ??= Set();
_globalModules ??= {};
_globalModules.add(module);
_allModules.add(module);

Expand Down Expand Up @@ -700,7 +700,9 @@ class AsyncEnvironment {
T value;
for (var module in _globalModules) {
var valueInModule = callback(module);
if (valueInModule != null && value != null) {
if (valueInModule == null) continue;

if (value != null) {
throw SassScriptException(
'This $type is available from multiple global modules:\n' +
bulletedList(_globalModules
Expand Down
8 changes: 5 additions & 3 deletions lib/src/environment.dart
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_environment.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: 1a6678b9aa71d8d8ea5aab9216a48e401a892453
// Checksum: 2522d5fbfb9d301b361a9bacac97228de2c6fd68
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -202,7 +202,7 @@ class Environment {
/// with the same name as a variable defined in this environment.
void addModule(Module<Callable> module, {String namespace}) {
if (namespace == null) {
_globalModules ??= Set();
_globalModules ??= {};
_globalModules.add(module);
_allModules.add(module);

Expand Down Expand Up @@ -704,7 +704,9 @@ class Environment {
T value;
for (var module in _globalModules) {
var valueInModule = callback(module);
if (valueInModule != null && value != null) {
if (valueInModule == null) continue;

if (value != null) {
throw SassScriptException(
'This $type is available from multiple global modules:\n' +
bulletedList(_globalModules
Expand Down