-
Notifications
You must be signed in to change notification settings - Fork 360
/
Copy pathfunctions.dart
51 lines (45 loc) · 1.48 KB
/
functions.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2016 Google Inc. 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 'dart:collection';
import 'package:collection/collection.dart';
import 'callable.dart';
import 'functions/color.dart' as color;
import 'functions/list.dart' as list;
import 'functions/map.dart' as map;
import 'functions/math.dart' as math;
import 'functions/meta.dart' as meta;
import 'functions/selector.dart' as selector;
import 'functions/string.dart' as string;
/// Sass core functions that are globally available.
///
/// This excludes a few functions that need access to the evaluation context;
/// these are defined in `_EvaluateVisitor`.
final List<BuiltInCallable> globalFunctions = UnmodifiableListView([
...color.global,
...list.global,
...map.global,
...math.global,
...selector.global,
...string.global,
...meta.global,
// This is only invoked using `call()`. Hand-authored `if()`s are parsed as
// [IfExpression]s.
BuiltInCallable.function(
"if",
r"$condition, $if-true, $if-false",
(arguments) => arguments[0].isTruthy ? arguments[1] : arguments[2],
),
]);
/// Sass's core library modules.
///
/// This doesn't include the `meta` module, because that needs additional
/// functions that can only be defined in the evaluator itself.
final coreModules = UnmodifiableListView([
color.module,
list.module,
map.module,
math.module,
selector.module,
string.module,
]);