Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from sass/refactor
Changes based on review for #4
- Loading branch information
Showing
25 changed files
with
586 additions
and
929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# Sass Modules Migrator | ||
|
||
This tool is designed to help migrate stylesheets from the old `@import` | ||
functionality to the new module system. | ||
functionality to [the new module system][module-spec]. | ||
|
||
This is still a work-in-progress, but should eventually implement everything | ||
described in [sass/sass#2575](https://github.com/sass/sass/issues/2575). | ||
|
||
[module-spec]: https://github.com/sass/language/blob/master/accepted/module-system.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2019 Google LLC | ||
// | ||
// Use of this source code is governed by an MIT-style | ||
// license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
import 'utils.dart'; | ||
|
||
/// Keeps track of the scope of any members declared at the current level of | ||
/// the stylesheet. | ||
class LocalScope { | ||
/// The parent of this scope, or null if this scope is only nested one level | ||
/// from the root of the file. | ||
final LocalScope parent; | ||
|
||
/// Variables defined in this scope. | ||
final variables = normalizedSet(); | ||
|
||
/// Mixins defined in this scope. | ||
final mixins = normalizedSet(); | ||
|
||
/// Functions defined in this scope. | ||
final functions = normalizedSet(); | ||
|
||
LocalScope(this.parent); | ||
|
||
/// Returns whether a variable [name] exists somewhere within this scope. | ||
bool isLocalVariable(String name) => | ||
variables.contains(name) || (parent?.isLocalVariable(name) ?? false); | ||
|
||
/// Returns whether a mixin [name] exists somewhere within this scope. | ||
bool isLocalMixin(String name) => | ||
variables.contains(name) || (parent?.isLocalMixin(name) ?? false); | ||
|
||
/// Returns whether a function [name] exists somewhere within this scope. | ||
bool isLocalFunction(String name) => | ||
variables.contains(name) || (parent?.isLocalFunction(name) ?? false); | ||
} |
Oops, something went wrong.