Package com.google.javascript.jscomp
Class CompilerInput
java.lang.Object
com.google.javascript.jscomp.CompilerInput
- All Implemented Interfaces:
DependencyInfo
A class for the internal representation of an input to the compiler. Wraps a
CompilerInput.JsAst
and
maintain state such as module for the input and whether the input is an extern. Also calculates
provided and required types.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.google.javascript.jscomp.deps.DependencyInfo
DependencyInfo.Require, DependencyInfo.Util
-
Constructor Summary
ConstructorsConstructorDescriptionCompilerInput
(SourceFile file) CompilerInput
(SourceFile file, boolean isExtern) CompilerInput
(SourceFile file, InputId inputId) CompilerInput
(SourceFile sourceFile, InputId inputId, boolean isExtern) Deprecated.the inputId is read from the SourceFile.CompilerInput
(SourceFile sourceFile, String inputId, boolean isExtern) Deprecated.the inputId is read from the SourceFile. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addDynamicRequire
(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
(String provide) Registers a type that this input defines.void
addRequire
(DependencyInfo.Require require) Registers a type that this input depends on.void
addRequireDynamicImports
(String require) Registers a type that this input depends on in the order seen in the file.void
clearAst()
getAstRoot
(AbstractCompiler compiler) getChunk()
Returns the chunk to which the input belongs.getCode()
com.google.common.collect.ImmutableList
<String> Returns the types that this input dynamically depends on in the order seen in the file.getFeatures
(AbstractCompiler compiler) boolean
Whether the file '@externs' annotation.boolean
Whether the file has the '@nocompile' annotation.Returns a name for this input.int
getLineOffset
(int lineno) Gets the loading information for this file.getName()
Returns a name for this input.getPath()
Gets the path relative to closure-base, if one is available.com.google.common.collect.ImmutableList
<String> Gets a list of types provided by this input.com.google.common.collect.ImmutableList
<String> Returns the types that this input dynamically imports by goog.requireDynamic() in the order seen in the file.com.google.common.collect.ImmutableList
<DependencyInfo.Require> Gets a list of types depended on by this input.@Nullable TypedScope
com.google.common.collect.ImmutableList
<String> Gets the symbols type-required by this file (i.e.boolean
Whether the symbol is provided by an ES6 moduleboolean
isExtern()
boolean
Whether the symbol is provided by a goog modulevoid
Sets the chunk to which the input belongs.void
setCompiler
(AbstractCompiler compiler) Sets an abstract compiler for doing parsing.void
setHasFullParseDependencyInfo
(boolean hasFullParseDependencyInfo) void
setJsModuleType
(CompilerInput.ModuleType moduleType) void
setTypedScope
(@Nullable TypedScope typedScope) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.javascript.jscomp.deps.DependencyInfo
getRequiredSymbols
-
Constructor Details
-
CompilerInput
-
CompilerInput
Deprecated.the inputId is read from the SourceFile. Use CompilerInput(file, isExtern) -
CompilerInput
Deprecated.the inputId is read from the SourceFile. Use CompilerInput(file, isExtern) -
CompilerInput
-
CompilerInput
-
-
Method Details
-
setTypedScope
-
getTypedScope
-
getInputId
Returns a name for this input. Must be unique across all inputs. -
getName
Returns a name for this input. Must be unique across all inputs.- Specified by:
getName
in interfaceDependencyInfo
-
getPathRelativeToClosureBase
Gets the path relative to closure-base, if one is available.- Specified by:
getPathRelativeToClosureBase
in interfaceDependencyInfo
-
getAstRoot
-
clearAst
public void clearAst() -
getSourceFile
-
setCompiler
Sets an abstract compiler for doing parsing. -
getRequires
Gets a list of types depended on by this input.- Specified by:
getRequires
in interfaceDependencyInfo
-
getTypeRequires
Description copied from interface:DependencyInfo
Gets the symbols type-required by this file (i.e. for typechecking only).- Specified by:
getTypeRequires
in interfaceDependencyInfo
-
getProvides
Gets a list of types provided by this input.- Specified by:
getProvides
in interfaceDependencyInfo
-
getHasExternsAnnotation
public boolean getHasExternsAnnotation()Description copied from interface:DependencyInfo
Whether the file '@externs' annotation.- Specified by:
getHasExternsAnnotation
in interfaceDependencyInfo
-
getHasNoCompileAnnotation
public boolean getHasNoCompileAnnotation()Description copied from interface:DependencyInfo
Whether the file has the '@nocompile' annotation.- Specified by:
getHasNoCompileAnnotation
in interfaceDependencyInfo
-
addProvide
Registers a type that this input defines. Includes both explicitly declared namespaces via goog.provide and goog.module calls as well as implicit namespaces provided by module rewriting. -
addOrderedRequire
Registers a type that this input depends on in the order seen in the file. -
getDynamicRequires
Returns the types that this input dynamically depends on in the order seen in the file. The returned types were loaded dynamically so while they are part of the dependency graph, they do not need sorted before this input. -
addDynamicRequire
Registers a type that this input depends on in the order seen in the file. The type was loaded dynamically so while it is part of the dependency graph, it does not need sorted before this input. -
getRequireDynamicImports
Returns the types that this input dynamically imports by goog.requireDynamic() in the order seen in the file. The returned types were loaded dynamically so while they are part of the dependency graph, they do not need sorted before this input. -
addRequireDynamicImports
Registers a type that this input depends on in the order seen in the file. The type was loaded by goog.requireDynamic() so while it is part of the dependency graph, it does not need sorted before this input. -
setHasFullParseDependencyInfo
public void setHasFullParseDependencyInfo(boolean hasFullParseDependencyInfo) -
getJsModuleType
-
setJsModuleType
-
addRequire
Registers a type that this input depends on. -
getCode
- Throws:
IOException
-
getChunk
Returns the chunk to which the input belongs. -
setChunk
Sets the chunk to which the input belongs. -
isExtern
public boolean isExtern() -
getLineOffset
public int getLineOffset(int lineno) -
toString
-
isEs6Module
public boolean isEs6Module()Description copied from interface:DependencyInfo
Whether the symbol is provided by an ES6 module- Specified by:
isEs6Module
in interfaceDependencyInfo
-
isGoogModule
public boolean isGoogModule()Description copied from interface:DependencyInfo
Whether the symbol is provided by a goog module- Specified by:
isGoogModule
in interfaceDependencyInfo
-
getLoadFlags
Description copied from interface:DependencyInfo
Gets the loading information for this file.- Specified by:
getLoadFlags
in interfaceDependencyInfo
-
getPath
-
getFeatures
-