Skip to content

Commit 9d4fb20

Browse files
authored
Properly migrate built-ins with underscores (#165)
Fixes #138.
1 parent 694317a commit 9d4fb20

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.2.5
2+
3+
### Module Migrator
4+
5+
* The migrator now properly migrates built-in function calls with underscores
6+
(e.g. `map_get`).
7+
18
## 1.2.4
29

310
### Module Migrator

lib/src/migrators/module/references.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class _ReferenceVisitor extends RecursiveAstVisitor {
300300
for (var function in functions) {
301301
if (_isCssCompatibilityOverload(function)) continue;
302302
if (function.name.asPlain == null) continue;
303-
var name = function.name.asPlain;
303+
var name = function.name.asPlain.replaceAll('_', '-');
304304
var module = builtInFunctionModules[name];
305305
if (module != null) _sources[function] = BuiltInSource(module);
306306
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 1.2.4
2+
version: 1.2.5
33
description: A tool for running migrations on Sass files
44
author: Jennifer Thakar <[email protected]>
55
homepage: https://github.com/sass/migrator
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<==> input/entrypoint.scss
2+
$a: map_get((a: 1), a);
3+
$b: str_length("hello");
4+
$c: scale_color(blue, $lightness: -10%);
5+
6+
<==> output/entrypoint.scss
7+
@use "sass:color";
8+
@use "sass:map";
9+
@use "sass:string";
10+
$a: map.get((a: 1), a);
11+
$b: string.length("hello");
12+
$c: color.scale(blue, $lightness: -10%);

0 commit comments

Comments
 (0)