public CompilerInput(SourceAst ast, InputId inputId, boolean isExtern) {
    this.ast = ast;
    this.id = inputId;

    // TODO(nicksantos): Add a precondition check here. People are passing
    // in null, but they should not be.
    if (ast != null && ast.getSourceFile() != null) {
      ast.getSourceFile().setIsExtern(isExtern);
    }
  }
 @Override
 public Node getAstRoot(AbstractCompiler compiler) {
   Node root = ast.getAstRoot(compiler);
   // The root maybe null if the AST can not be created.
   if (root != null) {
     Preconditions.checkState(root.isScript());
     Preconditions.checkNotNull(root.getInputId());
   }
   return root;
 }
 public CompilerInput(SourceAst ast, boolean isExtern) {
   this(ast, ast.getInputId(), isExtern);
 }
 public CompilerInput(SourceAst ast) {
   this(ast, ast.getSourceFile().getName(), false);
 }
 /** @return The number of lines in this input. */
 public int getNumLines() {
   return ast.getSourceFile().getNumLines();
 }
 public int getLineOffset(int lineno) {
   return ast.getSourceFile().getLineOffset(lineno);
 }
 void setIsExtern(boolean isExtern) {
   if (ast == null || ast.getSourceFile() == null) {
     return;
   }
   ast.getSourceFile().setIsExtern(isExtern);
 }
 public boolean isExtern() {
   if (ast == null || ast.getSourceFile() == null) {
     return false;
   }
   return ast.getSourceFile().isExtern();
 }
 @Override
 public void setSourceFile(SourceFile file) {
   ast.setSourceFile(file);
 }
 @Override
 public SourceFile getSourceFile() {
   return ast.getSourceFile();
 }
 @Override
 public void clearAst() {
   ast.clearAst();
 }