bazel syntax: lock down constructors of syntax nodes
Only the parser should create syntax nodes.
This is a preparatory step for having the parser provide file offsets of
important tokens to each node constructor, enabling more precise and compact
representation of location information.
A few nodes cannot be locked down yet because they are created directly by
tests in skyframe/serialization. Before fixing those, we must make move certain
checks from the parser to the validator (e.g. no for/def at toplevel, no **kwargs, etc).
Also:
- inline some trivial parser helpers (e.g. makeList) into Parser
- add some TODOs signposting next refactoring steps.
PiperOrigin-RevId: 262642915
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SliceExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/SliceExpression.java
index 54c194a..4fbd4b9 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SliceExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SliceExpression.java
@@ -26,7 +26,7 @@
@Nullable private final Expression end;
@Nullable private final Expression step;
- public SliceExpression(Expression object, Expression start, Expression end, Expression step) {
+ SliceExpression(Expression object, Expression start, Expression end, Expression step) {
this.object = object;
this.start = start;
this.end = end;