public class CompilerInput extends DependencyInfo.Base implements SourceAst
SourceAst
and maintain state such as module for the input and whether the input is an extern. Also
calculates provided and required types.| Modifier and Type | Class and Description |
|---|---|
static class |
CompilerInput.ModuleType
JavaScript module type.
|
DependencyInfo.Base, DependencyInfo.Require, DependencyInfo.Util| 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 |
|---|---|
boolean |
addDynamicRequire(java.lang.String require)
Registers a type that this input depends on in the order seen in the file.
|
boolean |
addOrderedRequire(DependencyInfo.Require require)
Registers a type that this input depends on in the order seen in the file.
|
void |
addProvide(java.lang.String provide)
Registers a type that this input defines.
|
void |
addRequire(DependencyInfo.Require 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.
|
java.lang.String |
getCode() |
com.google.common.collect.ImmutableList<java.lang.String> |
getDynamicRequires()
Returns the types that this input dynamically depends on in the order seen in the file.
|
boolean |
getHasExternsAnnotation()
Whether the file '@externs' annotation.
|
boolean |
getHasNoCompileAnnotation()
Whether the file has the '@nocompile' annotation.
|
InputId |
getInputId()
Returns a name for this input.
|
CompilerInput.ModuleType |
getJsModuleType() |
int |
getLineOffset(int lineno) |
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
getLoadFlags()
Gets the loading information for this file.
|
JSModule |
getModule()
Returns the module to which the input belongs.
|
java.lang.String |
getName()
Returns a name for this input.
|
int |
getNumLines() |
ModuleLoader.ModulePath |
getPath() |
java.lang.String |
getPathRelativeToClosureBase()
Gets the path relative to closure-base, if one is available.
|
com.google.common.collect.ImmutableList<java.lang.String> |
getProvides()
Gets a list of types provided by this input.
|
com.google.common.collect.ImmutableList<DependencyInfo.Require> |
getRequires()
Gets a list of types depended on by this input.
|
SourceFile |
getSourceFile()
Returns the source file the generated AST represents.
|
com.google.common.collect.ImmutableList<java.lang.String> |
getTypeRequires()
Gets the symbols type-required by this file (i.e.
|
boolean |
isExtern() |
void |
setCompiler(AbstractCompiler compiler)
Sets an abstract compiler for doing parsing.
|
void |
setHasFullParseDependencyInfo(boolean hasFullParseDependencyInfo) |
void |
setJsModuleType(CompilerInput.ModuleType moduleType) |
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() |
getRequiredSymbols, isModulepublic 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 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 void setCompiler(AbstractCompiler compiler)
public com.google.common.collect.ImmutableList<DependencyInfo.Require> getRequires()
getRequires in interface DependencyInfopublic com.google.common.collect.ImmutableList<java.lang.String> getTypeRequires()
DependencyInfogetTypeRequires in interface DependencyInfopublic com.google.common.collect.ImmutableList<java.lang.String> getProvides()
getProvides in interface DependencyInfopublic boolean getHasExternsAnnotation()
DependencyInfogetHasExternsAnnotation in interface DependencyInfopublic boolean getHasNoCompileAnnotation()
DependencyInfogetHasNoCompileAnnotation in interface DependencyInfopublic void addProvide(java.lang.String provide)
public boolean addOrderedRequire(DependencyInfo.Require require)
public com.google.common.collect.ImmutableList<java.lang.String> getDynamicRequires()
public boolean addDynamicRequire(java.lang.String require)
public void setHasFullParseDependencyInfo(boolean hasFullParseDependencyInfo)
public CompilerInput.ModuleType getJsModuleType()
public void setJsModuleType(CompilerInput.ModuleType moduleType)
public void addRequire(DependencyInfo.Require require)
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.Objectpublic com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> getLoadFlags()
DependencyInfogetLoadFlags in interface DependencyInfopublic ModuleLoader.ModulePath getPath()
Copyright © 2009-2020 Google. All Rights Reserved.