fix(tvix/eval/value/function): use BTreeMap for function arg names
At least toXML wants to get these out in a sorted fashion. Change-Id: I6373d7488fff7c40dc2ddeeecd03ba537c92c4af Reviewed-on: https://cl.tvl.fyi/c/depot/+/10685 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
adff7be4d1
commit
e1d2589163
2 changed files with 5 additions and 5 deletions
|
|
@ -21,7 +21,7 @@ mod scope;
|
||||||
use codemap::Span;
|
use codemap::Span;
|
||||||
use rnix::ast::{self, AstToken};
|
use rnix::ast::{self, AstToken};
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
use std::collections::HashMap;
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::rc::{Rc, Weak};
|
use std::rc::{Rc, Weak};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
@ -994,7 +994,7 @@ impl Compiler<'_> {
|
||||||
// the bindings to first declare them, then populate them, and
|
// the bindings to first declare them, then populate them, and
|
||||||
// then finalise any necessary recursion into the scope.
|
// then finalise any necessary recursion into the scope.
|
||||||
let mut entries: Vec<TrackedFormal> = vec![];
|
let mut entries: Vec<TrackedFormal> = vec![];
|
||||||
let mut arguments = HashMap::default();
|
let mut arguments = BTreeMap::default();
|
||||||
|
|
||||||
for entry in pattern.pat_entries() {
|
for entry in pattern.pat_entries() {
|
||||||
let ident = entry.ident().unwrap();
|
let ident = entry.ident().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
//! This module implements the runtime representation of functions.
|
//! This module implements the runtime representation of functions.
|
||||||
use std::{collections::HashMap, hash::Hash, rc::Rc};
|
use std::{collections::BTreeMap, hash::Hash, rc::Rc};
|
||||||
|
|
||||||
use codemap::Span;
|
use codemap::Span;
|
||||||
use smol_str::SmolStr;
|
use smol_str::SmolStr;
|
||||||
|
|
@ -11,7 +11,7 @@ use super::NixString;
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub(crate) struct Formals {
|
pub(crate) struct Formals {
|
||||||
/// Map from argument name, to whether that argument is required
|
/// Map from argument name, to whether that argument is required
|
||||||
pub(crate) arguments: HashMap<NixString, bool>,
|
pub(crate) arguments: BTreeMap<NixString, bool>,
|
||||||
|
|
||||||
/// Do the formals of this function accept extra arguments
|
/// Do the formals of this function accept extra arguments
|
||||||
pub(crate) ellipsis: bool,
|
pub(crate) ellipsis: bool,
|
||||||
|
|
@ -27,7 +27,7 @@ impl Formals {
|
||||||
/// ellipsis
|
/// ellipsis
|
||||||
pub(crate) fn contains<Q>(&self, arg: &Q) -> bool
|
pub(crate) fn contains<Q>(&self, arg: &Q) -> bool
|
||||||
where
|
where
|
||||||
Q: ?Sized + Hash + Eq,
|
Q: ?Sized + Hash + Ord + Eq,
|
||||||
NixString: std::borrow::Borrow<Q>,
|
NixString: std::borrow::Borrow<Q>,
|
||||||
{
|
{
|
||||||
self.ellipsis || self.arguments.contains_key(arg)
|
self.ellipsis || self.arguments.contains_key(arg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue