aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-09-18 08:18:11 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-21 08:56:12 +0000
commitd9e733d8cd64450ab8690ab3227bba6b254e5898 (patch)
tree7c22fd2c399ce7d5ba00344c73bd9eb74146a343 /src/main/java/com/google/devtools/build/lib/syntax/Environment.java
parent47cb916ec6f41b8ecbd377ed875f842c3d349b12 (diff)
Remove support for the deprecated include() statement in order to be able to separate Skylark from the rest of the code so that Label parsing can be simplified.
This is another go at []: now that the tests were fixed in [] and [] it can be submitted again. -- MOS_MIGRATED_REVID=103364881
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/Environment.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/Environment.java40
1 files changed, 4 insertions, 36 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
index 89360a765a..266c2c79aa 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
@@ -19,17 +19,14 @@ import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.Location;
-import com.google.devtools.build.lib.packages.CachingPackageLocator;
import com.google.devtools.build.lib.syntax.Mutability.Freezable;
import com.google.devtools.build.lib.syntax.Mutability.MutabilityException;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.Pair;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.Serializable;
@@ -911,45 +908,16 @@ public final class Environment implements Freezable {
}
};
- /** Mock package locator class */
- private static final class EmptyPackageLocator implements CachingPackageLocator {
- @Override
- public Path getBuildFileForPackage(PackageIdentifier packageName) {
- return null;
- }
- }
-
- /** A mock package locator */
- @VisibleForTesting
- static final CachingPackageLocator EMPTY_PACKAGE_LOCATOR = new EmptyPackageLocator();
-
- /**
- * Creates a Lexer without a supporting file.
- * @param input a list of lines of code
- */
- @VisibleForTesting
- Lexer createLexer(String... input) {
- return new Lexer(ParserInputSource.create(Joiner.on("\n").join(input), null),
- eventHandler);
- }
-
/**
* Parses some String input without a supporting file, returning statements and comments.
* @param input a list of lines of code
*/
@VisibleForTesting
- Parser.ParseResult parseFileWithComments(String... input) {
+ Parser.ParseResult parseFileWithComments(String... inputLines) {
+ ParserInputSource input = ParserInputSource.create(Joiner.on("\n").join(inputLines), null);
return isSkylark
- ? Parser.parseFileForSkylark(
- createLexer(input),
- eventHandler,
- EMPTY_PACKAGE_LOCATOR,
- new ValidationEnvironment(this))
- : Parser.parseFile(
- createLexer(input),
- eventHandler,
- EMPTY_PACKAGE_LOCATOR,
- /*parsePython=*/false);
+ ? Parser.parseFileForSkylark(input, eventHandler, new ValidationEnvironment(this))
+ : Parser.parseFile(input, eventHandler, /*parsePython=*/false);
}
/**