Skip to content

Commit

Permalink
Stop using Delegating*.typed()
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 14, 2018
1 parent 7a2d724 commit a31a147
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
4 changes: 1 addition & 3 deletions lib/src/callable/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import 'dart:async';

import 'package:async/async.dart';

import '../value.dart';
import '../value/external/value.dart' as ext;
import 'async_built_in.dart';
Expand Down Expand Up @@ -34,6 +32,6 @@ abstract class AsyncCallable {
new AsyncBuiltInCallable(name, arguments, (arguments) {
var result = callback(arguments);
if (result is ext.Value) return result as Value;
return DelegatingFuture.typed(result as Future);
return (result as Future).then((value) => value as Value);
});
}
14 changes: 9 additions & 5 deletions lib/src/extend/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,12 @@ bool _selectorPseudoIsSuperselector(
/// and that have the given [name].
Iterable<PseudoSelector> _selectorPseudosNamed(
CompoundSelector compound, String name) =>
DelegatingIterable.typed(compound.components.where((simple) =>
simple is PseudoSelector &&
simple.isClass &&
simple.selector != null &&
simple.name == name));
// TODO(nweiz): Use whereType() when we only have to support Dart 2 runtime
// semantics.
compound.components
.where((pseudo) =>
pseudo is PseudoSelector &&
pseudo.isClass &&
pseudo.selector != null &&
pseudo.name == name)
.cast();
7 changes: 3 additions & 4 deletions lib/src/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'dart:async';
import 'dart:js_util';
import 'dart:typed_data';

import 'package:collection/collection.dart';
import 'package:dart2_constant/convert.dart' as convert;
import 'package:js/js.dart';
import 'package:path/path.dart' as p;
Expand Down Expand Up @@ -134,7 +133,7 @@ RenderResult _renderSync(RenderOptions options) {
if (options.data != null) {
result = compileString(options.data,
nodeImporter: _parseImporter(options, start),
functions: DelegatingList.typed(_parseFunctions(options)),
functions: _parseFunctions(options).cast(),
indented: isTruthy(options.indentedSyntax),
style: _parseOutputStyle(options.outputStyle),
useSpaces: options.indentType != 'tab',
Expand All @@ -145,7 +144,7 @@ RenderResult _renderSync(RenderOptions options) {
} else if (options.file != null) {
result = compile(file,
nodeImporter: _parseImporter(options, start),
functions: DelegatingList.typed(_parseFunctions(options)),
functions: _parseFunctions(options).cast(),
indented: options.indentedSyntax,
style: _parseOutputStyle(options.outputStyle),
useSpaces: options.indentType != 'tab',
Expand Down Expand Up @@ -255,7 +254,7 @@ NodeImporter _parseImporter(RenderOptions options, DateTime start) {
if (options.importer == null) {
importers = [];
} else if (options.importer is List) {
importers = DelegatingList.typed(options.importer as List);
importers = (options.importer as List).cast();
} else {
importers = [options.importer as _Importer];
}
Expand Down
6 changes: 2 additions & 4 deletions lib/src/value/external/argument_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:collection/collection.dart';

import '../../value.dart' as internal;
import '../../value.dart' show ListSeparator;
import 'value.dart';
Expand All @@ -21,6 +19,6 @@ abstract class SassArgumentList extends SassList {

factory SassArgumentList(Iterable<Value> contents,
Map<String, Value> keywords, ListSeparator separator) =>
new internal.SassArgumentList(DelegatingIterable.typed(contents),
DelegatingMap.typed(keywords), separator);
new internal.SassArgumentList(
contents.cast(), keywords.cast(), separator);
}
5 changes: 1 addition & 4 deletions lib/src/value/external/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:collection/collection.dart';

import '../../value.dart' as internal;
import '../../value.dart' show ListSeparator;
import 'value.dart';
Expand All @@ -23,6 +21,5 @@ abstract class SassList extends Value {
/// Returns an empty list with the given [separator] and [brackets].
factory SassList(Iterable<Value> contents, ListSeparator separator,
{bool brackets: false}) =>
new internal.SassList(DelegatingIterable.typed(contents), separator,
brackets: brackets);
new internal.SassList(contents.cast(), separator, brackets: brackets);
}
4 changes: 1 addition & 3 deletions lib/src/value/external/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:collection/collection.dart';

import '../../value.dart' as internal;
import 'value.dart';

Expand All @@ -22,5 +20,5 @@ abstract class SassMap extends Value {
const factory SassMap.empty() = internal.SassMap.empty;

factory SassMap(Map<Value, Value> contents) =>
new internal.SassMap(DelegatingMap.typed(contents));
new internal.SassMap(contents.cast());
}
2 changes: 1 addition & 1 deletion tool/grind/standalone.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Future _buildPackage(http.Client client, String os, {bool x64: true}) async {
.firstWhere((file) => os == 'windows'
? file.name.endsWith("/bin/dart.exe")
: file.name.endsWith("/bin/dart"));
var executable = DelegatingList.typed<int>(dartExecutable.content as List);
var executable = dartExecutable.content as List<int>;

// Use the app snapshot when packaging for the current operating system.
//
Expand Down

0 comments on commit a31a147

Please sign in to comment.