public class CompilerInput extends 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.DependencyInfo.Base, DependencyInfo.Util
Constructor and Description |
---|
CompilerInput(SourceAst ast) |
CompilerInput(SourceAst ast,
boolean isExtern) |
CompilerInput(SourceAst ast,
InputId inputId,
boolean isExtern) |
CompilerInput(SourceAst ast,
String inputId,
boolean isExtern) |
CompilerInput(SourceFile file) |
CompilerInput(SourceFile file,
boolean isExtern) |
Modifier and Type | Method and Description |
---|---|
void |
addProvide(String provide)
Registers a type that this input defines.
|
void |
addRequire(String require)
Registers a type that this input depends on.
|
void |
clearAst()
Removes any references to root node of the AST.
|
Node |
getAstRoot(AbstractCompiler compiler)
Gets the root node of the AST for the source file this represents.
|
String |
getCode() |
InputId |
getInputId()
Returns a name for this input.
|
int |
getLineOffset(int lineno) |
com.google.common.collect.ImmutableMap<String,String> |
getLoadFlags()
Gets the loading information for this file.
|
JSModule |
getModule()
Returns the module to which the input belongs.
|
String |
getName()
Returns a name for this input.
|
int |
getNumLines() |
String |
getPathRelativeToClosureBase()
Gets the path relative to closure-base, if one is available.
|
Collection<String> |
getProvides()
Gets a list of types provided by this input.
|
Collection<String> |
getRequires()
Gets a list of types depended on by this input.
|
SourceFile |
getSourceFile()
Returns the source file the generated AST represents.
|
boolean |
isExtern() |
boolean |
isModule()
Whether the symbol is provided by a module
|
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.
|
String |
toString() |
public CompilerInput(SourceAst ast)
public CompilerInput(SourceAst ast, boolean isExtern)
public CompilerInput(SourceFile file)
public CompilerInput(SourceFile file, boolean isExtern)
public InputId getInputId()
getInputId
in interface SourceAst
public String getName()
getName
in interface DependencyInfo
public String getPathRelativeToClosureBase()
getPathRelativeToClosureBase
in interface DependencyInfo
public Node getAstRoot(AbstractCompiler compiler)
SourceAst
getAstRoot
in interface SourceAst
public void clearAst()
SourceAst
public SourceFile getSourceFile()
SourceAst
getSourceFile
in interface SourceAst
public void setSourceFile(SourceFile file)
SourceAst
setSourceFile
in interface SourceAst
public void setCompiler(AbstractCompiler compiler)
public Collection<String> getRequires()
getRequires
in interface DependencyInfo
public Collection<String> getProvides()
getProvides
in interface DependencyInfo
public void addProvide(String provide)
public void addRequire(String require)
public String getCode() throws IOException
IOException
public JSModule getModule()
public void setModule(JSModule module)
public boolean isExtern()
public int getLineOffset(int lineno)
public int getNumLines()
public com.google.common.collect.ImmutableMap<String,String> getLoadFlags()
DependencyInfo
getLoadFlags
in interface DependencyInfo
public boolean isModule()
DependencyInfo
isModule
in interface DependencyInfo
Copyright © 2009-2016 Google. All Rights Reserved.