aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
authorGravatar Carmi Grushko <carmi@google.com>2017-02-20 22:37:15 +0000
committerGravatar Yue Gan <yueg@google.com>2017-02-21 11:48:20 +0000
commit46bf88c7e718966f7bafb720543c342d7413ae44 (patch)
tree0207d17da0cc51d0035dffaadd872b8603b11442 /src/main/java/com/google
parent54b9d2c3d514c7023948930a86db88178309149a (diff)
parseBuildString doesn't crash on files with hash lines.
-- PiperOrigin-RevId: 148042501 MOS_MIGRATED_REVID=148042501
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
index 6ad5a4897b..a0f6a33367 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuildFileAST.java
@@ -25,6 +25,7 @@ import com.google.devtools.build.lib.syntax.Parser.ParseResult;
import com.google.devtools.build.lib.syntax.SkylarkImports.SkylarkImportSyntaxException;
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.IOException;
import java.util.List;
import javax.annotation.Nullable;
@@ -299,7 +300,7 @@ public class BuildFileAST extends ASTNode {
public static BuildFileAST parseBuildString(EventHandler eventHandler, String... content) {
String str = Joiner.on("\n").join(content);
- ParserInputSource input = ParserInputSource.create(str, null);
+ ParserInputSource input = ParserInputSource.create(str, PathFragment.EMPTY_FRAGMENT);
Parser.ParseResult result = Parser.parseFile(input, eventHandler);
return create(ImmutableList.<Statement>of(), result, null, eventHandler);
}
@@ -307,7 +308,7 @@ public class BuildFileAST extends ASTNode {
// TODO(laurentlb): Merge parseSkylarkString and parseBuildString.
public static BuildFileAST parseSkylarkString(EventHandler eventHandler, String... content) {
String str = Joiner.on("\n").join(content);
- ParserInputSource input = ParserInputSource.create(str, null);
+ ParserInputSource input = ParserInputSource.create(str, PathFragment.EMPTY_FRAGMENT);
Parser.ParseResult result = Parser.parseFileForSkylark(input, eventHandler);
return create(ImmutableList.<Statement>of(), result, null, eventHandler);
}