This PR adjusts the experimental module system to make `private` the default visibility modifier in `module`s, introducing `public` as a new modifier instead. `public section` can be used to revert the default for an entire section, though this is more intended to ease gradual adoption of the new semantics such as in `Init` (and soon `Std`) where they should be replaced by a future decl-by-decl re-review of visibilities.
40 lines
937 B
Text
40 lines
937 B
Text
/-
|
|
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
Authors: Leonardo de Moura, Mario Carneiro
|
|
-/
|
|
|
|
module
|
|
|
|
prelude
|
|
public import Init.Data.Array.Set
|
|
|
|
public section
|
|
|
|
/-!
|
|
# Helper functions for `Syntax`.
|
|
|
|
These are delayed here to allow some time to bootstrap `Array`.
|
|
-/
|
|
|
|
namespace Lean.Syntax
|
|
|
|
/--
|
|
Updates the argument list without changing the node kind.
|
|
Does nothing for non-`node` nodes.
|
|
-/
|
|
def setArgs (stx : Syntax) (args : Array Syntax) : Syntax :=
|
|
match stx with
|
|
| node info k _ => node info k args
|
|
| stx => stx
|
|
|
|
/--
|
|
Updates the `i`'th argument of the syntax.
|
|
Does nothing for non-`node` nodes, or if `i` is out of bounds of the node list.
|
|
-/
|
|
def setArg (stx : Syntax) (i : Nat) (arg : Syntax) : Syntax :=
|
|
match stx with
|
|
| node info k args => node info k (args.setIfInBounds i arg)
|
|
| stx => stx
|
|
|
|
end Lean.Syntax
|