Skip to content

Commit

Permalink
Support multiple global uses in one file (#833)
Browse files Browse the repository at this point in the history
Closes #832
  • Loading branch information
nex3 committed Sep 27, 2019
1 parent 7d34406 commit fa3c657
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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

0 comments on commit fa3c657

Please sign in to comment.