idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
34,200 | boolean addImplementedInterface ( JSTypeExpression interfaceName ) { lazyInitInfo ( ) ; if ( info . implementedInterfaces == null ) { info . implementedInterfaces = new ArrayList < > ( 2 ) ; } if ( info . implementedInterfaces . contains ( interfaceName ) ) { return false ; } info . implementedInterfaces . add ( interf... | Adds an implemented interface . Returns whether the interface was added . If the interface was already present in the list it won t get added again . |
34,201 | public List < JSTypeExpression > getExtendedInterfaces ( ) { if ( info == null || info . extendedInterfaces == null ) { return ImmutableList . of ( ) ; } return Collections . unmodifiableList ( info . extendedInterfaces ) ; } | Returns the interfaces extended by an interface |
34,202 | public Set < String > getSuppressions ( ) { Set < String > suppressions = info == null ? null : info . suppressions ; return suppressions == null ? Collections . < String > emptySet ( ) : suppressions ; } | Returns the set of suppressed warnings . |
34,203 | public Set < String > getModifies ( ) { Set < String > modifies = info == null ? null : info . modifies ; return modifies == null ? Collections . < String > emptySet ( ) : modifies ; } | Returns the set of sideeffect notations . |
34,204 | public boolean hasDescriptionForParameter ( String name ) { if ( documentation == null || documentation . parameters == null ) { return false ; } return documentation . parameters . containsKey ( name ) ; } | Returns whether a description exists for the parameter with the specified name . |
34,205 | public String getDescriptionForParameter ( String name ) { if ( documentation == null || documentation . parameters == null ) { return null ; } return documentation . parameters . get ( name ) ; } | Returns the description for the parameter with the given name if its exists . |
34,206 | public Collection < Marker > getMarkers ( ) { return ( documentation == null || documentation . markers == null ) ? ImmutableList . < Marker > of ( ) : documentation . markers ; } | Gets the list of all markers for the documentation in this JSDoc . |
34,207 | public ImmutableMap < String , Node > getTypeTransformations ( ) { if ( info == null || info . typeTransformations == null ) { return ImmutableMap . < String , Node > of ( ) ; } return ImmutableMap . copyOf ( info . typeTransformations ) ; } | Gets the type transformations . |
34,208 | void removeScopesForScript ( String scriptName ) { memoized . keySet ( ) . removeIf ( n -> scriptName . equals ( NodeUtil . getSourceName ( n ) ) ) ; } | Removes all scopes with root nodes from a given script file . |
34,209 | TypedScope createScope ( Node n ) { TypedScope s = memoized . get ( n ) ; return s != null ? s : createScope ( n , createScope ( NodeUtil . getEnclosingScopeRoot ( n . getParent ( ) ) ) ) ; } | Create a scope if it doesn t already exist looking up in the map for the parent scope . |
34,210 | public TypedScope createScope ( Node root , AbstractScope < ? , ? > parent ) { checkArgument ( parent == null || parent instanceof TypedScope ) ; TypedScope typedParent = ( TypedScope ) parent ; TypedScope scope = memoized . get ( root ) ; if ( scope != null ) { checkState ( typedParent == scope . getParent ( ) ) ; } e... | Creates a scope with all types declared . Declares newly discovered types and type properties in the type registry . |
34,211 | private void initializeModuleScope ( Node moduleBody , Module module , TypedScope moduleScope ) { if ( module . metadata ( ) . isGoogModule ( ) ) { declareExportsInModuleScope ( module , moduleBody , moduleScope ) ; markGoogModuleExportsAsConst ( module ) ; } } | Builds the beginning of a module - scope . This can be an ES module or a goog . module . |
34,212 | private void declareExportsInModuleScope ( Module googModule , Node moduleBody , TypedScope moduleScope ) { if ( ! googModule . namespace ( ) . containsKey ( Export . NAMESPACE ) ) { moduleScope . declare ( "exports" , googModule . metadata ( ) . rootNode ( ) , typeRegistry . createAnonymousObjectType ( null ) , compil... | Ensures that the name exports is declared in goog . module scope . |
34,213 | private void gatherAllProvides ( Node root ) { if ( ! processClosurePrimitives ) { return ; } Node externs = root . getFirstChild ( ) ; Node js = root . getSecondChild ( ) ; Map < String , ProvidedName > providedNames = new ProcessClosureProvidesAndRequires ( compiler , null , CheckLevel . OFF , true ) . collectProvide... | Gathers all namespaces created by goog . provide and any definitions in code . |
34,214 | void patchGlobalScope ( TypedScope globalScope , Node scriptRoot ) { checkState ( scriptRoot . isScript ( ) ) ; checkNotNull ( globalScope ) ; checkState ( globalScope . isGlobal ( ) ) ; String scriptName = NodeUtil . getSourceName ( scriptRoot ) ; checkNotNull ( scriptName ) ; Predicate < Node > inScript = n -> script... | Patches a given global scope by removing variables previously declared in a script and re - traversing a new version of that script . |
34,215 | void setDeferredType ( Node node , JSType type ) { node . setJSType ( type ) ; deferredSetTypes . add ( new DeferredSetType ( node , type ) ) ; } | Set the type for a node now and enqueue it to be updated with a resolved type later . |
34,216 | CharPriority [ ] reserveCharacters ( char [ ] chars , char [ ] reservedCharacters ) { if ( reservedCharacters == null || reservedCharacters . length == 0 ) { CharPriority [ ] result = new CharPriority [ chars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { result [ i ] = priorityLookupMap . get ( chars [ i... | Provides the array of available characters based on the specified arrays . |
34,217 | private void checkPrefix ( String prefix ) { if ( prefix . length ( ) > 0 ) { if ( ! contains ( firstChars , prefix . charAt ( 0 ) ) ) { char [ ] chars = new char [ firstChars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { chars [ i ] = firstChars [ i ] . name ; } throw new IllegalArgumentException ( "pre... | Validates a name prefix . |
34,218 | public String generateNextName ( ) { String name ; do { name = prefix ; int i = nameCount ; if ( name . isEmpty ( ) ) { int pos = i % firstChars . length ; name = String . valueOf ( firstChars [ pos ] . name ) ; i /= firstChars . length ; } while ( i > 0 ) { i -- ; int pos = i % nonFirstChars . length ; name += nonFirs... | Generates the next short name . |
34,219 | private boolean fastAllPathsReturnCheck ( ControlFlowGraph < Node > cfg ) { for ( DiGraphEdge < Node , Branch > s : cfg . getImplicitReturn ( ) . getInEdges ( ) ) { Node n = s . getSource ( ) . getValue ( ) ; if ( ! n . isReturn ( ) && ! convention . isFunctionCallThatAlwaysThrows ( n ) ) { return false ; } } return tr... | Fast check to see if all execution paths contain a return statement . May spuriously report that a return statement is missing . |
34,220 | private JSType getExplicitReturnTypeIfExpected ( Node scopeRoot ) { if ( ! scopeRoot . isFunction ( ) ) { return null ; } FunctionType scopeType = JSType . toMaybeFunctionType ( scopeRoot . getJSType ( ) ) ; if ( scopeType == null ) { return null ; } if ( isEmptyFunction ( scopeRoot ) ) { return null ; } if ( scopeType... | Determines if the given scope should explicitly return . All functions with non - void or non - unknown return types must have explicit returns . |
34,221 | private void convertAsyncGenerator ( NodeTraversal t , Node originalFunction ) { checkNotNull ( originalFunction ) ; checkState ( originalFunction . isAsyncGeneratorFunction ( ) ) ; Node asyncGeneratorWrapperRef = astFactory . createAsyncGeneratorWrapperReference ( originalFunction . getJSType ( ) , t . getScope ( ) ) ... | Moves the body of an async generator function into a nested generator function and removes the async and generator props from the original function . |
34,222 | private void convertAwaitOfAsyncGenerator ( NodeTraversal t , LexicalContext ctx , Node awaitNode ) { checkNotNull ( awaitNode ) ; checkState ( awaitNode . isAwait ( ) ) ; checkState ( ctx != null && ctx . function != null ) ; checkState ( ctx . function . isAsyncGeneratorFunction ( ) ) ; Node expression = awaitNode . ... | Converts an await into a yield of an ActionRecord to perform AWAIT . |
34,223 | private void convertYieldOfAsyncGenerator ( NodeTraversal t , LexicalContext ctx , Node yieldNode ) { checkNotNull ( yieldNode ) ; checkState ( yieldNode . isYield ( ) ) ; checkState ( ctx != null && ctx . function != null ) ; checkState ( ctx . function . isAsyncGeneratorFunction ( ) ) ; Node expression = yieldNode . ... | Converts a yield into a yield of an ActionRecord to perform YIELD or YIELD_STAR . |
34,224 | private int getIntForType ( JSType type ) { if ( type != null && type . isGenericObjectType ( ) ) { type = type . toMaybeObjectType ( ) . getRawType ( ) ; } if ( intForType . containsKey ( type ) ) { return intForType . get ( type ) . intValue ( ) ; } int newInt = intForType . size ( ) + 1 ; intForType . put ( type , n... | Returns an integer that uniquely identifies a JSType . |
34,225 | @ SuppressWarnings ( "ReferenceEquality" ) private void computeRelatedTypesForNonUnionType ( JSType type ) { checkState ( ! type . isUnionType ( ) , type ) ; if ( relatedBitsets . containsKey ( type ) ) { return ; } JSTypeBitSet related = new JSTypeBitSet ( intForType . size ( ) ) ; relatedBitsets . put ( type , relate... | Adds subtypes - and implementors in the case of interfaces - of the type to its JSTypeBitSet of related types . |
34,226 | private void addRelatedInstance ( FunctionType constructor , JSTypeBitSet related ) { checkArgument ( constructor . hasInstanceType ( ) , "Constructor %s without instance type." , constructor ) ; ObjectType instanceType = constructor . getInstanceType ( ) ; addRelatedType ( instanceType , related ) ; } | Adds the instance of the given constructor its implicit prototype and all its related types to the given bit set . |
34,227 | private void addRelatedType ( JSType type , JSTypeBitSet related ) { computeRelatedTypesForNonUnionType ( type ) ; related . or ( relatedBitsets . get ( type ) ) ; } | Adds the given type and all its related types to the given bit set . |
34,228 | private void checkDescendantNames ( Name name , boolean nameIsDefined ) { if ( name . props != null ) { for ( Name prop : name . props ) { boolean propIsDefined = false ; if ( nameIsDefined ) { propIsDefined = ( ! propertyMustBeInitializedByFullName ( prop ) || prop . getGlobalSets ( ) + prop . getLocalSets ( ) > 0 ) ;... | Checks to make sure all the descendants of a name are defined if they are referenced . |
34,229 | private boolean checkForBadModuleReference ( Name name , Ref ref ) { JSModuleGraph moduleGraph = compiler . getModuleGraph ( ) ; if ( name . getGlobalSets ( ) == 0 || ref . type == Ref . Type . SET_FROM_GLOBAL ) { return false ; } if ( name . getGlobalSets ( ) == 1 ) { Ref declaration = checkNotNull ( name . getDeclara... | Returns true if this name is potentially referenced before being defined in a different module |
34,230 | private static boolean isSetFromPrecedingModule ( Ref originalRef , Ref set , JSModuleGraph moduleGraph ) { return set . type == Ref . Type . SET_FROM_GLOBAL && ( originalRef . getModule ( ) == set . getModule ( ) || moduleGraph . dependsOn ( originalRef . getModule ( ) , set . getModule ( ) ) ) ; } | Whether the set is in the global scope and occurs in a module the original ref depends on |
34,231 | private boolean propertyMustBeInitializedByFullName ( Name name ) { if ( name . getParent ( ) == null ) { return false ; } if ( isNameUnsafelyAliased ( name . getParent ( ) ) ) { return false ; } if ( objectPrototypeProps . contains ( name . getBaseName ( ) ) ) { return false ; } if ( name . getParent ( ) . isObjectLit... | The input name is a property . Check whether this property must be initialized with its full qualified name . |
34,232 | private boolean hasSuperclass ( Name es6Class ) { Node decl = es6Class . getDeclaration ( ) . getNode ( ) ; Node classNode = NodeUtil . getRValueOfLValue ( decl ) ; checkState ( classNode . isClass ( ) , classNode ) ; Node superclass = classNode . getSecondChild ( ) ; return ! superclass . isEmpty ( ) ; } | Returns whether the given ES6 class extends something . |
34,233 | ScopedName getClosureNamespaceTypeFromCall ( Node googRequire ) { if ( moduleMap == null ) { return null ; } String moduleId = googRequire . getSecondChild ( ) . getString ( ) ; Module module = moduleMap . getClosureModule ( moduleId ) ; if ( module == null ) { return null ; } switch ( module . metadata ( ) . moduleTyp... | Attempts to look up the type of a Closure namespace from a require call |
34,234 | private Node initTemplate ( Node templateFunctionNode ) { Node prepped = templateFunctionNode . cloneTree ( ) ; prepTemplatePlaceholders ( prepped ) ; Node body = prepped . getLastChild ( ) ; Node startNode ; if ( body . hasOneChild ( ) && body . getFirstChild ( ) . isExprResult ( ) ) { startNode = body . getFirstFirst... | Prepare an template AST to use when performing matches . |
34,235 | private void prepTemplatePlaceholders ( Node fn ) { final List < String > locals = templateLocals ; final List < String > params = templateParams ; final Map < String , JSType > paramTypes = new HashMap < > ( ) ; String fnName = fn . getFirstChild ( ) . getString ( ) ; fn . getFirstChild ( ) . setString ( "" ) ; Node t... | Build parameter and local information for the template and replace the references in the template fn with placeholder nodes use to facility matching . |
34,236 | private Node createTemplateParameterNode ( int index , JSType type , boolean isStringLiteral ) { checkState ( index >= 0 ) ; checkNotNull ( type ) ; Node n = Node . newNumber ( index ) ; if ( isStringLiteral ) { n . setToken ( TEMPLATE_STRING_LITERAL ) ; } else { n . setToken ( TEMPLATE_TYPE_PARAM ) ; } n . setJSType (... | Creates a template parameter or string literal template node . |
34,237 | private boolean matchesTemplateShape ( Node template , Node ast ) { while ( template != null ) { if ( ast == null || ! matchesNodeShape ( template , ast ) ) { return false ; } template = template . getNext ( ) ; ast = ast . getNext ( ) ; } return true ; } | Returns whether the template matches an AST structure node starting with node taking into account the template parameters that were provided to this matcher . Here only the template shape is checked template local declarations and parameters are checked later . |
34,238 | private boolean matchesNode ( Node template , Node ast ) { if ( isTemplateParameterNode ( template ) ) { int paramIndex = ( int ) ( template . getDouble ( ) ) ; Node previousMatch = paramNodeMatches . get ( paramIndex ) ; if ( previousMatch != null ) { return ast . isEquivalentTo ( previousMatch ) ; } JSType templateTy... | Returns whether two nodes are equivalent taking into account the template parameters that were provided to this matcher . If the template comparison node is a parameter node then only the types of the node must match . If the template node is a string literal only match string literals . Otherwise the node must be equa... |
34,239 | private boolean hasOverriddenNativeProperty ( String propertyName ) { if ( isNativeObjectType ( ) ) { return false ; } JSType propertyType = getPropertyType ( propertyName ) ; ObjectType nativeType = isFunctionType ( ) ? registry . getNativeObjectType ( JSTypeNative . FUNCTION_PROTOTYPE ) : registry . getNativeObjectTy... | Given the name of a native object property checks whether the property is present on the object and different from the native one . |
34,240 | private static boolean isSubtype ( ObjectType typeA , RecordType typeB , ImplCache implicitImplCache , SubtypingMode subtypingMode ) { MatchStatus cached = implicitImplCache . checkCache ( typeA , typeB ) ; if ( cached != null ) { return cached . subtypeValue ( ) ; } boolean result = isStructuralSubtypeHelper ( typeA ,... | Determines if typeA is a subtype of typeB |
34,241 | public synchronized SourceMapConsumerV3 getSourceMap ( ErrorManager errorManager ) { if ( ! cached ) { cached = true ; String sourceMapPath = sourceFile . getOriginalPath ( ) ; try { String sourceMapContents = sourceFile . getCode ( ) ; SourceMapConsumerV3 consumer = new SourceMapConsumerV3 ( ) ; consumer . parse ( sou... | Gets the source map reading from disk and parsing if necessary . Returns null if the sourcemap cannot be resolved or is malformed . |
34,242 | private static String getLastPartOfQualifiedName ( Node n ) { if ( n . isName ( ) ) { return n . getString ( ) ; } else if ( n . isGetProp ( ) ) { return n . getLastChild ( ) . getString ( ) ; } return null ; } | or null for this and super . |
34,243 | private void moveGlobalSymbols ( Collection < GlobalSymbol > globalSymbols ) { for ( GlobalSymbolCycle globalSymbolCycle : new OrderAndCombineGlobalSymbols ( globalSymbols ) . orderAndCombine ( ) ) { globalSymbolCycle . moveDeclarationStatements ( ) ; } } | Moves all of the declaration statements that can move to their best possible chunk location . |
34,244 | public void loadRefasterJsTemplate ( String refasterjsTemplate ) throws IOException { checkState ( templateJs == null , "Can't load RefasterJs template since a template is already loaded." ) ; this . templateJs = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( refasterjsTemplate ) != null ? Resou... | Loads the RefasterJs template . This must be called before the scanner is used . |
34,245 | private Node transformNode ( Node templateNode , Map < String , Node > templateNodeToMatchMap , Map < String , String > shortNames ) { Node clone = templateNode . cloneNode ( ) ; if ( templateNode . isName ( ) ) { String name = templateNode . getString ( ) ; if ( templateNodeToMatchMap . containsKey ( name ) ) { Node t... | Transforms the template node to a replacement node by mapping the template names to the ones that were matched against in the JsSourceMatcher . |
34,246 | public JSType build ( ) { if ( isEmpty ) { return registry . getNativeObjectType ( JSTypeNative . OBJECT_TYPE ) ; } ImmutableSortedMap . Builder < String , RecordProperty > m = ImmutableSortedMap . naturalOrder ( ) ; m . putAll ( this . properties ) ; return new RecordType ( registry , m . build ( ) , isDeclared ) ; } | Creates a record . Fails if any duplicate property names were added . |
34,247 | private List < Node > createDependenciesList ( Node n ) { checkArgument ( n . isFunction ( ) ) ; Node params = NodeUtil . getFunctionParameters ( n ) ; if ( params != null ) { return createStringsFromParamList ( params ) ; } return new ArrayList < > ( ) ; } | Given a FUNCTION node returns array of STRING nodes representing function parameters . |
34,248 | private List < Node > createStringsFromParamList ( Node params ) { Node param = params . getFirstChild ( ) ; ArrayList < Node > names = new ArrayList < > ( ) ; while ( param != null ) { if ( param . isName ( ) ) { names . add ( IR . string ( param . getString ( ) ) . srcref ( param ) ) ; } else if ( param . isDestructu... | Given a PARAM_LIST node creates an array of corresponding STRING nodes . |
34,249 | private void addNode ( Node n ) { Node target = null ; Node fn = null ; String name = null ; switch ( n . getToken ( ) ) { case ASSIGN : if ( ! n . getFirstChild ( ) . isQualifiedName ( ) ) { compiler . report ( JSError . make ( n , INJECTED_FUNCTION_ON_NON_QNAME ) ) ; return ; } name = n . getFirstChild ( ) . getQuali... | Add node to the list of injectables . |
34,250 | @ GwtIncompatible ( "Unnecessary" ) private boolean isOutputInJson ( ) { return config . jsonStreamMode == JsonStreamMode . OUT || config . jsonStreamMode == JsonStreamMode . BOTH ; } | Returns whether output should be a JSON stream . |
34,251 | @ GwtIncompatible ( "Unnecessary" ) private List < SourceFile > createInputs ( List < FlagEntry < JsSourceType > > files , boolean allowStdIn , List < JsModuleSpec > jsModuleSpecs ) throws IOException { return createInputs ( files , null , allowStdIn , jsModuleSpecs ) ; } | Creates inputs from a list of files . |
34,252 | @ GwtIncompatible ( "Unnecessary" ) private List < SourceFile > createInputs ( List < FlagEntry < JsSourceType > > files , List < JsonFileSpec > jsonFiles , List < JsModuleSpec > jsModuleSpecs ) throws IOException { return createInputs ( files , jsonFiles , false , jsModuleSpecs ) ; } | Creates inputs from a list of source files and json files . |
34,253 | @ GwtIncompatible ( "Unnecessary" ) private List < SourceFile > createSourceInputs ( List < JsModuleSpec > jsModuleSpecs , List < FlagEntry < JsSourceType > > files , List < JsonFileSpec > jsonFiles , List < String > moduleRoots ) throws IOException { if ( isInTestMode ( ) ) { return inputsSupplierForTesting != null ? ... | Creates JS source code inputs from a list of files . |
34,254 | @ GwtIncompatible ( "Unnecessary" ) private List < SourceFile > createExternInputs ( List < String > files ) throws IOException { List < FlagEntry < JsSourceType > > externFiles = new ArrayList < > ( ) ; for ( String file : files ) { externFiles . add ( new FlagEntry < JsSourceType > ( JsSourceType . EXTERN , file ) ) ... | Creates JS extern inputs from a list of files . |
34,255 | public static List < JSModule > createJsModules ( List < JsModuleSpec > specs , List < SourceFile > inputs ) throws IOException { checkState ( specs != null ) ; checkState ( ! specs . isEmpty ( ) ) ; checkState ( inputs != null ) ; List < String > moduleNames = new ArrayList < > ( specs . size ( ) ) ; Map < String , JS... | Creates module objects from a list of js module specifications . |
34,256 | public static Map < String , String > parseModuleWrappers ( List < String > specs , Iterable < JSModule > chunks ) { checkState ( specs != null ) ; Map < String , String > wrappers = new HashMap < > ( ) ; for ( JSModule c : chunks ) { wrappers . put ( c . getName ( ) , "" ) ; } for ( String spec : specs ) { int pos = s... | Parses module wrapper specifications . |
34,257 | @ GwtIncompatible ( "Unnecessary" ) private static void maybeCreateDirsForPath ( String pathPrefix ) { if ( ! Strings . isNullOrEmpty ( pathPrefix ) ) { String dirName = pathPrefix . charAt ( pathPrefix . length ( ) - 1 ) == File . separatorChar ? pathPrefix . substring ( 0 , pathPrefix . length ( ) - 1 ) : new File ( ... | Creates any directories necessary to write a file that will have a given path prefix . |
34,258 | @ GwtIncompatible ( "Unnecessary" ) int processResults ( Result result , List < JSModule > modules , B options ) throws IOException { if ( config . printPassGraph ) { if ( compiler . getRoot ( ) == null ) { return 1 ; } else { Appendable jsOutput = createDefaultOutput ( ) ; jsOutput . append ( DotFormatter . toDot ( co... | Processes the results of the compile job and returns an error code . |
34,259 | @ GwtIncompatible ( "Unnecessary" ) JsonFileSpec createJsonFile ( B options , String outputMarker , Function < String , String > escaper ) throws IOException { Appendable jsOutput = new StringBuilder ( ) ; writeOutput ( jsOutput , compiler , ( JSModule ) null , config . outputWrapper , outputMarker , escaper ) ; JsonFi... | Save the compiler output to a JsonFileSpec to be later written to stdout |
34,260 | @ GwtIncompatible ( "Unnecessary" ) private JsonFileSpec createJsonFileFromModule ( JSModule module ) throws IOException { compiler . resetAndIntitializeSourceMap ( ) ; StringBuilder output = new StringBuilder ( ) ; writeModuleOutput ( output , module ) ; JsonFileSpec jsonFile = new JsonFileSpec ( output . toString ( )... | Given an output module convert it to a JSONFileSpec with associated sourcemap |
34,261 | @ GwtIncompatible ( "Unnecessary" ) private Charset getInputCharset ( ) { if ( ! config . charset . isEmpty ( ) ) { if ( ! Charset . isSupported ( config . charset ) ) { throw new FlagUsageException ( config . charset + " is not a valid charset name." ) ; } return Charset . forName ( config . charset ) ; } return UTF_8... | Query the flag for the input charset and return a Charset object representing the selection . |
34,262 | @ GwtIncompatible ( "Unnecessary" ) private Charset getLegacyOutputCharset ( ) { if ( ! config . charset . isEmpty ( ) ) { if ( ! Charset . isSupported ( config . charset ) ) { throw new FlagUsageException ( config . charset + " is not a valid charset name." ) ; } return Charset . forName ( config . charset ) ; } retur... | Query the flag for the output charset . |
34,263 | @ GwtIncompatible ( "Unnecessary" ) private boolean shouldGenerateMapPerModule ( B options ) { return options . sourceMapOutputPath != null && options . sourceMapOutputPath . contains ( "%outname%" ) ; } | Returns true if and only if a source map file should be generated for each module as opposed to one unified map . This is specified by having the source map pattern include the %outname% variable . |
34,264 | @ GwtIncompatible ( "Unnecessary" ) private Writer openExternExportsStream ( B options , String path ) throws IOException { if ( options . externExportsPath == null ) { return null ; } String exPath = options . externExportsPath ; if ( ! exPath . contains ( File . separator ) ) { File outputFile = new File ( path ) ; e... | Returns a stream for outputting the generated externs file . |
34,265 | @ GwtIncompatible ( "Unnecessary" ) private String expandCommandLinePath ( String path , JSModule forModule ) { String sub ; if ( forModule != null ) { sub = config . moduleOutputPathPrefix + forModule . getName ( ) + ".js" ; } else if ( ! config . module . isEmpty ( ) ) { sub = config . moduleOutputPathPrefix ; } else... | Expand a file path specified on the command - line . |
34,266 | @ GwtIncompatible ( "Unnecessary" ) String expandSourceMapPath ( B options , JSModule forModule ) { if ( Strings . isNullOrEmpty ( options . sourceMapOutputPath ) ) { return null ; } return expandCommandLinePath ( options . sourceMapOutputPath , forModule ) ; } | Expansion function for source map . |
34,267 | @ GwtIncompatible ( "Unnecessary" ) protected OutputStream filenameToOutputStream ( String fileName ) throws IOException { if ( fileName == null ) { return null ; } return new FileOutputStream ( fileName ) ; } | Converts a file name into a Outputstream . Returns null if the file name is null . |
34,268 | @ GwtIncompatible ( "Unnecessary" ) private Writer streamToLegacyOutputWriter ( OutputStream stream ) throws IOException { if ( legacyOutputCharset == null ) { return new BufferedWriter ( new OutputStreamWriter ( stream , UTF_8 ) ) ; } else { return new BufferedWriter ( new OutputStreamWriter ( stream , legacyOutputCha... | Create a writer with the legacy output charset . |
34,269 | @ GwtIncompatible ( "Unnecessary" ) private Writer streamToOutputWriter2 ( OutputStream stream ) { if ( outputCharset2 == null ) { return new BufferedWriter ( new OutputStreamWriter ( stream , UTF_8 ) ) ; } else { return new BufferedWriter ( new OutputStreamWriter ( stream , outputCharset2 ) ) ; } } | Create a writer with the newer output charset . |
34,270 | @ GwtIncompatible ( "Unnecessary" ) private void outputSourceMap ( B options , String associatedName ) throws IOException { if ( Strings . isNullOrEmpty ( options . sourceMapOutputPath ) || options . sourceMapOutputPath . equals ( "/dev/null" ) ) { return ; } String outName = expandSourceMapPath ( options , null ) ; ma... | Outputs the source map found in the compiler to the proper path if one exists . |
34,271 | @ GwtIncompatible ( "Unnecessary" ) private void outputNameMaps ( ) throws IOException { String propertyMapOutputPath = null ; String variableMapOutputPath = null ; if ( config . createNameMapFiles ) { String basePath = getMapPath ( config . jsOutputFile ) ; propertyMapOutputPath = basePath + "_props_map.out" ; variabl... | Outputs the variable and property name maps for the specified compiler if the proper FLAGS are set . |
34,272 | public static void createDefineOrTweakReplacements ( List < String > definitions , CompilerOptions options , boolean tweaks ) { for ( String override : definitions ) { String [ ] assignment = override . split ( "=" , 2 ) ; String defName = assignment [ 0 ] ; if ( defName . length ( ) > 0 ) { String defValue = assignmen... | Create a map of constant names to constant values from a textual description of the map . |
34,273 | @ GwtIncompatible ( "Unnecessary" ) private boolean shouldGenerateOutputPerModule ( String output ) { return ! config . module . isEmpty ( ) && output != null && output . contains ( "%outname%" ) ; } | Returns true if and only if a manifest or bundle should be generated for each module as opposed to one unified manifest . |
34,274 | @ GwtIncompatible ( "Unnecessary" ) private void outputModuleGraphJson ( ) throws IOException { if ( config . outputModuleDependencies != null && config . outputModuleDependencies . length ( ) != 0 ) { try ( Writer out = fileNameToOutputWriter2 ( config . outputModuleDependencies ) ) { printModuleGraphJsonTo ( out ) ; ... | Creates a file containing the current module graph in JSON serialization . |
34,275 | @ GwtIncompatible ( "Unnecessary" ) void printModuleGraphJsonTo ( Appendable out ) throws IOException { out . append ( compiler . getModuleGraph ( ) . toJson ( ) . toString ( ) ) ; } | Prints the current module graph as JSON . |
34,276 | @ GwtIncompatible ( "Unnecessary" ) void printModuleGraphManifestOrBundleTo ( JSModuleGraph graph , Appendable out , boolean isManifest ) throws IOException { Joiner commas = Joiner . on ( "," ) ; boolean requiresNewline = false ; for ( JSModule module : graph . getAllModules ( ) ) { if ( requiresNewline ) { out . appe... | Prints a set of modules to the manifest or bundle file . |
34,277 | @ GwtIncompatible ( "Unnecessary" ) private Map < String , String > constructRootRelativePathsMap ( ) { Map < String , String > rootRelativePathsMap = new LinkedHashMap < > ( ) ; for ( String mapString : config . manifestMaps ) { int colonIndex = mapString . indexOf ( ':' ) ; checkState ( colonIndex > 0 ) ; String exec... | Construct and return the input root path map . The key is the exec path of each input file and the value is the corresponding root relative path . |
34,278 | void expectValidTypeofName ( Node n , String found ) { report ( JSError . make ( n , UNKNOWN_TYPEOF_VALUE , found ) ) ; } | a warning and attempt to correct the mismatch when possible . |
34,279 | boolean expectObject ( Node n , JSType type , String msg ) { if ( ! type . matchesObjectContext ( ) ) { mismatch ( n , msg , type , OBJECT_TYPE ) ; return false ; } return true ; } | Expect the type to be an object or a type convertible to object . If the expectation is not met issue a warning at the provided node s source code position . |
34,280 | void expectActualObject ( Node n , JSType type , String msg ) { if ( ! type . isObject ( ) ) { mismatch ( n , msg , type , OBJECT_TYPE ) ; } } | Expect the type to be an object . Unlike expectObject a type convertible to object is not acceptable . |
34,281 | void expectAnyObject ( Node n , JSType type , String msg ) { JSType anyObjectType = getNativeType ( NO_OBJECT_TYPE ) ; if ( ! anyObjectType . isSubtypeOf ( type ) && ! type . isEmptyType ( ) ) { mismatch ( n , msg , type , anyObjectType ) ; } } | Expect the type to contain an object sometimes . If the expectation is not met issue a warning at the provided node s source code position . |
34,282 | boolean expectAutoboxesToIterable ( Node n , JSType type , String msg ) { if ( type . isUnionType ( ) ) { for ( JSType alt : type . toMaybeUnionType ( ) . getAlternates ( ) ) { alt = alt . isBoxableScalar ( ) ? alt . autoboxesTo ( ) : alt ; if ( ! alt . isSubtypeOf ( getNativeType ( ITERABLE_TYPE ) ) ) { mismatch ( n ,... | Expect the type to autobox to be an Iterable . |
34,283 | Optional < JSType > expectAutoboxesToIterableOrAsyncIterable ( Node n , JSType type , String msg ) { MaybeBoxedIterableOrAsyncIterable maybeBoxed = JsIterables . maybeBoxIterableOrAsyncIterable ( type , typeRegistry ) ; if ( maybeBoxed . isMatch ( ) ) { return Optional . of ( maybeBoxed . getTemplatedType ( ) ) ; } mis... | Expect the type to autobox to be an Iterable or AsyncIterable . |
34,284 | void expectGeneratorSupertype ( Node n , JSType type , String msg ) { if ( ! getNativeType ( GENERATOR_TYPE ) . isSubtypeOf ( type ) ) { mismatch ( n , msg , type , GENERATOR_TYPE ) ; } } | Expect the type to be a Generator or supertype of Generator . |
34,285 | void expectAsyncGeneratorSupertype ( Node n , JSType type , String msg ) { if ( ! getNativeType ( ASYNC_GENERATOR_TYPE ) . isSubtypeOf ( type ) ) { mismatch ( n , msg , type , ASYNC_GENERATOR_TYPE ) ; } } | Expect the type to be a AsyncGenerator or supertype of AsyncGenerator . |
34,286 | void expectValidAsyncReturnType ( Node n , JSType type ) { if ( promiseOfUnknownType . isSubtypeOf ( type ) ) { return ; } JSError err = JSError . make ( n , INVALID_ASYNC_RETURN_TYPE , type . toString ( ) ) ; registerMismatch ( type , promiseOfUnknownType , err ) ; report ( err ) ; } | Expect the type to be a supertype of Promise . |
34,287 | void expectITemplateArraySupertype ( Node n , JSType type , String msg ) { if ( ! getNativeType ( I_TEMPLATE_ARRAY_TYPE ) . isSubtypeOf ( type ) ) { mismatch ( n , msg , type , I_TEMPLATE_ARRAY_TYPE ) ; } } | Expect the type to be an ITemplateArray or supertype of ITemplateArray . |
34,288 | void expectString ( Node n , JSType type , String msg ) { if ( ! type . matchesStringContext ( ) ) { mismatch ( n , msg , type , STRING_TYPE ) ; } } | Expect the type to be a string or a type convertible to string . If the expectation is not met issue a warning at the provided node s source code position . |
34,289 | void expectNumber ( Node n , JSType type , String msg ) { if ( ! type . matchesNumberContext ( ) ) { mismatch ( n , msg , type , NUMBER_TYPE ) ; } else { expectNumberStrict ( n , type , msg ) ; } } | Expect the type to be a number or a type convertible to number . If the expectation is not met issue a warning at the provided node s source code position . |
34,290 | void expectNumberStrict ( Node n , JSType type , String msg ) { if ( ! type . isSubtypeOf ( getNativeType ( NUMBER_TYPE ) ) ) { registerMismatchAndReport ( n , INVALID_OPERAND_TYPE , msg , type , getNativeType ( NUMBER_TYPE ) , null , null ) ; } } | Expect the type to be a number or a subtype . |
34,291 | void expectNumberOrSymbol ( Node n , JSType type , String msg ) { if ( ! type . matchesNumberContext ( ) && ! type . matchesSymbolContext ( ) ) { mismatch ( n , msg , type , NUMBER_SYMBOL ) ; } } | Expect the type to be a number or string or a type convertible to a number or symbol . If the expectation is not met issue a warning at the provided node s source code position . |
34,292 | void expectStringOrSymbol ( Node n , JSType type , String msg ) { if ( ! type . matchesStringContext ( ) && ! type . matchesSymbolContext ( ) ) { mismatch ( n , msg , type , STRING_SYMBOL ) ; } } | Expect the type to be a string or symbol or a type convertible to a string . If the expectation is not met issue a warning at the provided node s source code position . |
34,293 | boolean expectNotNullOrUndefined ( NodeTraversal t , Node n , JSType type , String msg , JSType expectedType ) { if ( ! type . isNoType ( ) && ! type . isUnknownType ( ) && type . isSubtypeOf ( nullOrUndefined ) && ! containsForwardDeclaredUnresolvedName ( type ) ) { if ( n . isGetProp ( ) && ! t . inGlobalScope ( ) &&... | Expect the type to be anything but the null or void type . If the expectation is not met issue a warning at the provided node s source code position . Note that a union type that includes the void type and at least one other type meets the expectation . |
34,294 | void expectSwitchMatchesCase ( Node n , JSType switchType , JSType caseType ) { if ( ! switchType . canTestForShallowEqualityWith ( caseType ) && ( caseType . autoboxesTo ( ) == null || ! caseType . autoboxesTo ( ) . isSubtypeOf ( switchType ) ) ) { mismatch ( n . getFirstChild ( ) , "case expression doesn't match swit... | Expect that the type of a switch condition matches the type of its case condition . |
34,295 | void expectIndexMatch ( Node n , JSType objType , JSType indexType ) { checkState ( n . isGetElem ( ) || n . isComputedProp ( ) , n ) ; Node indexNode = n . isGetElem ( ) ? n . getLastChild ( ) : n . getFirstChild ( ) ; if ( indexType . isSymbolValueType ( ) ) { return ; } if ( objType . isStruct ( ) ) { report ( JSErr... | Expect that the first type can be addressed with GETELEM syntax and that the second type is the right type for an index into the first type . |
34,296 | void expectArgumentMatchesParameter ( Node n , JSType argType , JSType paramType , Node callNode , int ordinal ) { if ( ! argType . isSubtypeOf ( paramType ) ) { mismatch ( n , SimpleFormat . format ( "actual parameter %d of %s does not match formal parameter" , ordinal , typeRegistry . getReadableTypeNameNoDeref ( cal... | Expect that the type of an argument matches the type of the parameter that it s fulfilling . |
34,297 | void expectSuperType ( Node n , ObjectType superObject , ObjectType subObject ) { FunctionType subCtor = subObject . getConstructor ( ) ; ObjectType implicitProto = subObject . getImplicitPrototype ( ) ; ObjectType declaredSuper = implicitProto == null ? null : implicitProto . getImplicitPrototype ( ) ; if ( declaredSu... | Expect that the first type is the direct superclass of the second type . |
34,298 | void expectExtends ( Node n , FunctionType subCtor , FunctionType astSuperCtor ) { if ( astSuperCtor == null || ( ! astSuperCtor . isConstructor ( ) && ! astSuperCtor . isInterface ( ) ) ) { return ; } if ( astSuperCtor . isConstructor ( ) != subCtor . isConstructor ( ) ) { return ; } ObjectType astSuperInstance = astS... | Expect that an ES6 class s extends clause is actually a supertype of the given class . Compares the registered supertype which is taken from the JSDoc if present otherwise from the AST with the type in the extends node of the AST . |
34,299 | void expectCanAssignToPrototype ( JSType ownerType , Node node , JSType rightType ) { if ( ownerType . isFunctionType ( ) ) { FunctionType functionType = ownerType . toMaybeFunctionType ( ) ; if ( functionType . isConstructor ( ) ) { expectObject ( node , rightType , "cannot override prototype with non-object" ) ; } } ... | Expect that it s valid to assign something to a given type s prototype . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.