Skip to content

Commit

Permalink
revert embedded protocol changes
Browse files Browse the repository at this point in the history
  • Loading branch information
connorskees committed Sep 2, 2023
1 parent 7d6757c commit f715c22
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 57 deletions.
4 changes: 1 addition & 3 deletions lib/src/embedded/dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'host_callable.dart';
import 'importer/file.dart';
import 'importer/host.dart';
import 'logger.dart';
import 'mixin_registry.dart';
import 'util/proto_extensions.dart';
import 'utils.dart';

Expand Down Expand Up @@ -111,7 +110,6 @@ final class Dispatcher {
OutboundMessage_CompileResponse _compile(
InboundMessage_CompileRequest request) {
var functions = FunctionRegistry();
var mixins = MixinRegistry();

var style = request.style == OutputStyle.COMPRESSED
? sass.OutputStyle.compressed
Expand All @@ -125,7 +123,7 @@ final class Dispatcher {
(throw mandatoryError("Importer.importer")));

var globalFunctions = request.globalFunctions
.map((signature) => hostCallable(this, functions, mixins, signature));
.map((signature) => hostCallable(this, functions, signature));

late sass.CompileResult result;
switch (request.whichInput()) {
Expand Down
7 changes: 3 additions & 4 deletions lib/src/embedded/host_callable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import '../../src/embedded/mixin_registry.dart';
import '../callable.dart';
import '../exception.dart';
import 'dispatcher.dart';
Expand All @@ -19,12 +18,12 @@ import 'utils.dart';
/// the name defined in the [signature].
///
/// Throws a [SassException] if [signature] is invalid.
Callable hostCallable(Dispatcher dispatcher, FunctionRegistry functions,
MixinRegistry mixins, String signature,
Callable hostCallable(
Dispatcher dispatcher, FunctionRegistry functions, String signature,
{int? id}) {
late Callable callable;
callable = Callable.fromSignature(signature, (arguments) {
var protofier = Protofier(dispatcher, functions, mixins);
var protofier = Protofier(dispatcher, functions);
var request = OutboundMessage_FunctionCallRequest()
..arguments.addAll(
[for (var argument in arguments) protofier.protofy(argument)]);
Expand Down
33 changes: 0 additions & 33 deletions lib/src/embedded/mixin_registry.dart

This file was deleted.

19 changes: 2 additions & 17 deletions lib/src/embedded/protofier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'dispatcher.dart';
import 'embedded_sass.pb.dart' as proto;
import 'embedded_sass.pb.dart' hide Value, ListSeparator, CalculationOperator;
import 'function_registry.dart';
import 'mixin_registry.dart';
import 'host_callable.dart';
import 'utils.dart';

Expand All @@ -24,9 +23,6 @@ final class Protofier {
/// The IDs of first-class functions.
final FunctionRegistry _functions;

/// The IDs of first-class mixins.
final MixinRegistry _mixins;

/// Any argument lists transitively contained in [value].
///
/// The IDs of the [Value_ArgumentList] protobufs are always one greater than
Expand All @@ -39,10 +35,7 @@ final class Protofier {
///
/// The [functions] tracks the IDs of first-class functions so that the host
/// can pass them back to the compiler.
///
/// Similarly, the [mixins] tracks the IDs of first-class mixins so that the
/// host can pass them back to the compiler.
Protofier(this._dispatcher, this._functions, this._mixins);
Protofier(this._dispatcher, this._functions);

/// Converts [value] to its protocol buffer representation.
proto.Value protofy(Value value) {
Expand Down Expand Up @@ -92,8 +85,6 @@ final class Protofier {
result.calculation = _protofyCalculation(value);
case SassFunction():
result.compilerFunction = _functions.protofy(value);
case SassMixin():
result.compilerMixin = _mixins.protofy(value);
case sassTrue:
result.singleton = SingletonValue.TRUE;
case sassFalse:
Expand Down Expand Up @@ -249,15 +240,9 @@ final class Protofier {

case Value_Value.hostFunction:
return SassFunction(hostCallable(
_dispatcher, _functions, _mixins, value.hostFunction.signature,
_dispatcher, _functions, value.hostFunction.signature,
id: value.hostFunction.id));

case Value_Value.compilerMixin:
var id = value.compilerMixin.id;
if (_mixins[id] case var mixin?) return mixin;
throw paramsError(
"CompilerMixin.id $id doesn't match any known mixins");

case Value_Value.calculation:
return _deprotofyCalculation(value.calculation);

Expand Down

0 comments on commit f715c22

Please sign in to comment.