public class CompilerInput extends java.lang.Object implements SourceAst, DependencyInfo
SourceAst and maintain state such as module for the input and
whether the input is an extern. Also calculates provided and required types.| Constructor and Description |
|---|
CompilerInput(SourceAst ast) |
CompilerInput(SourceAst ast,
boolean isExtern) |
CompilerInput(SourceAst ast,
InputId inputId,
boolean isExtern) |
CompilerInput(SourceAst ast,
java.lang.String inputId,
boolean isExtern) |
CompilerInput(SourceFile file) |
CompilerInput(SourceFile file,
boolean isExtern) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAst()
Removes any references to root node of the AST.
|
SourceAst |
getAst() |
Node |
getAstRoot(AbstractCompiler compiler)
Gets the root node of the AST for the source file this represents.
|
java.lang.String |
getCode() |
InputId |
getInputId()
Returns a name for this input.
|
java.lang.String |
getLine(int lineNumber)
Gets the source line for the indicated line number.
|
int |
getLineOffset(int lineno) |
JSModule |
getModule()
Returns the module to which the input belongs.
|
java.lang.String |
getName()
Returns a name for this input.
|
int |
getNumLines() |
java.lang.String |
getPathRelativeToClosureBase()
Gets the path relative to closure-base, if one is available.
|
java.util.Collection<java.lang.String> |
getProvides()
Gets a list of types provided by this input.
|
Region |
getRegion(int lineNumber)
Get a region around the indicated line number.
|
java.util.Collection<java.lang.String> |
getRequires()
Gets a list of types depended on by this input.
|
SourceAst |
getSourceAst()
Returns the SourceAst object on which this input is based.
|
SourceFile |
getSourceFile()
Returns the source file the generated AST represents.
|
boolean |
isExtern() |
void |
removeRequire(java.lang.String require) |
void |
setCompiler(AbstractCompiler compiler)
Sets an abstract compiler for doing parsing.
|
void |
setModule(JSModule module)
Sets the module to which the input belongs.
|
void |
setSourceFile(SourceFile file)
Sets the source file the generated AST represents.
|
java.lang.String |
toString() |
public CompilerInput(SourceAst ast)
public CompilerInput(SourceAst ast, boolean isExtern)
public CompilerInput(SourceAst ast, java.lang.String inputId, boolean isExtern)
public CompilerInput(SourceFile file)
public CompilerInput(SourceFile file, boolean isExtern)
public InputId getInputId()
getInputId in interface SourceAstpublic java.lang.String getName()
getName in interface DependencyInfopublic SourceAst getAst()
public java.lang.String getPathRelativeToClosureBase()
getPathRelativeToClosureBase in interface DependencyInfopublic Node getAstRoot(AbstractCompiler compiler)
SourceAstgetAstRoot in interface SourceAstpublic void clearAst()
SourceAstpublic SourceFile getSourceFile()
SourceAstgetSourceFile in interface SourceAstpublic void setSourceFile(SourceFile file)
SourceAstsetSourceFile in interface SourceAstpublic SourceAst getSourceAst()
public void setCompiler(AbstractCompiler compiler)
public java.util.Collection<java.lang.String> getRequires()
getRequires in interface DependencyInfopublic java.util.Collection<java.lang.String> getProvides()
getProvides in interface DependencyInfopublic void removeRequire(java.lang.String require)
public java.lang.String getLine(int lineNumber)
lineNumber - the line number, 1 being the first line of the file.null if it does not exist,
or if there was an IO exception.public Region getRegion(int lineNumber)
lineNumber - the line number, 1 being the first line of the file.null if it does not exist,
or if there was an IO exception.public java.lang.String getCode()
throws java.io.IOException
java.io.IOExceptionpublic JSModule getModule()
public void setModule(JSModule module)
public boolean isExtern()
public int getLineOffset(int lineno)
public int getNumLines()
public java.lang.String toString()
toString in class java.lang.Object