idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
34,800
void fillSymbolVisibility ( Node externs , Node root ) { CollectFileOverviewVisibility collectPass = new CollectFileOverviewVisibility ( compiler ) ; collectPass . process ( externs , root ) ; ImmutableMap < StaticSourceFile , Visibility > visibilityMap = collectPass . getFileOverviewVisibilityMap ( ) ; NodeTraversal ....
Records the visibility of each symbol .
34,801
@ SuppressWarnings ( "ReferenceEquality" ) private void createPropertyScopeFor ( Symbol s ) { if ( s . propertyScope != null ) { return ; } ObjectType type = getType ( s ) == null ? null : getType ( s ) . toObjectType ( ) ; if ( type == null ) { return ; } SymbolScope parentPropertyScope = maybeGetParentPropertyScope (...
This function uses == to compare types to be exact same instances .
34,802
private SymbolScope maybeGetParentPropertyScope ( ObjectType symbolObjectType ) { ObjectType proto = symbolObjectType . getImplicitPrototype ( ) ; if ( proto == null || proto == symbolObjectType ) { return null ; } final Symbol parentSymbol ; if ( isEs6ClassConstructor ( proto ) ) { parentSymbol = getSymbolDeclaredBy (...
If this type has an implicit prototype set returns the SymbolScope corresponding to the properties of the implicit prototype . Otherwise returns null .
34,803
void fillSuperReferences ( Node externs , Node root ) { NodeTraversal . Callback collectSuper = new AbstractPostOrderCallback ( ) { public void visit ( NodeTraversal t , Node n , Node parent ) { if ( ! n . isSuper ( ) || n . getJSType ( ) == null ) { return ; } Symbol classSymbol = getSymbolForTypeHelper ( n . getJSTyp...
Fill in references to super variables .
34,804
private boolean isSymbolDuplicatedExternOnWindow ( Symbol symbol ) { Node node = symbol . getDeclarationNode ( ) ; return ! node . isIndexable ( ) && node . isGetProp ( ) && node . getFirstChild ( ) . isName ( ) && node . getFirstChild ( ) . getString ( ) . equals ( "window" ) ; }
Heuristic method to check whether symbol was created by DeclaredGlobalExternsOnWindow . java pass .
34,805
private int getLexicalScopeDepth ( SymbolScope scope ) { if ( scope . isLexicalScope ( ) || scope . isDocScope ( ) ) { return scope . getScopeDepth ( ) ; } else { checkState ( scope . isPropertyScope ( ) ) ; Symbol sym = scope . getSymbolForScope ( ) ; checkNotNull ( sym ) ; return getLexicalScopeDepth ( getScope ( sym...
For a lexical scope just returns the normal scope depth .
34,806
private void removeDuplicateDeclarations ( Node externs , Node root ) { Callback tickler = new ScopeTicklingCallback ( ) ; ScopeCreator scopeCreator = new Es6SyntacticScopeCreator ( compiler , new DuplicateDeclarationHandler ( ) ) ; NodeTraversal t = new NodeTraversal ( compiler , tickler , scopeCreator ) ; t . travers...
Remove duplicate VAR declarations .
34,807
private boolean isRemovableValue ( Node n ) { switch ( n . getToken ( ) ) { case TEMPLATELIT : case ARRAYLIT : for ( Node child = n . getFirstChild ( ) ; child != null ; child = child . getNext ( ) ) { if ( ( ! child . isEmpty ( ) ) && ! isRemovableValue ( child ) ) { return false ; } } return true ; case REGEXP : case...
So we don t need to update the graph .
34,808
private void warnAboutNamespaceAliasing ( Name nameObj , Ref ref ) { compiler . report ( JSError . make ( ref . getNode ( ) , UNSAFE_NAMESPACE_WARNING , nameObj . getFullName ( ) ) ) ; }
Reports a warning because a namespace was aliased .
34,809
private void warnAboutNamespaceRedefinition ( Name nameObj , Ref ref ) { compiler . report ( JSError . make ( ref . getNode ( ) , NAMESPACE_REDEFINED_WARNING , nameObj . getFullName ( ) ) ) ; }
Reports a warning because a namespace was redefined .
34,810
private void flattenReferencesToCollapsibleDescendantNames ( Name n , String alias ) { if ( n . props == null || n . isCollapsingExplicitlyDenied ( ) ) { return ; } for ( Name p : n . props ) { String propAlias = appendPropForAlias ( alias , p . getBaseName ( ) ) ; boolean isAllowedToCollapse = propertyCollapseLevel !=...
Flattens all references to collapsible properties of a global name except their initial definitions . Recurs on subnames .
34,811
private void flattenSimpleStubDeclaration ( Name name , String alias ) { Ref ref = Iterables . getOnlyElement ( name . getRefs ( ) ) ; Node nameNode = NodeUtil . newName ( compiler , alias , ref . getNode ( ) , name . getFullName ( ) ) ; Node varNode = IR . var ( nameNode ) . useSourceInfoIfMissingFrom ( nameNode ) ; c...
Flattens a stub declaration . This is mostly a hack to support legacy users .
34,812
private void flattenReferencesTo ( Name n , String alias ) { String originalName = n . getFullName ( ) ; for ( Ref r : n . getRefs ( ) ) { if ( r == n . getDeclaration ( ) ) { continue ; } Node rParent = r . getNode ( ) . getParent ( ) ; if ( ! NodeUtil . mayBeObjectLitKey ( r . getNode ( ) ) && ( r . getTwin ( ) == nu...
Flattens all references to a collapsible property of a global name except its initial definition .
34,813
private void flattenPrefixes ( String alias , Name n , int depth ) { String originalName = n . getFullName ( ) ; Ref decl = n . getDeclaration ( ) ; if ( decl != null && decl . getNode ( ) != null && decl . getNode ( ) . isGetProp ( ) ) { flattenNameRefAtDepth ( alias , decl . getNode ( ) , depth , originalName ) ; } f...
Flattens all occurrences of a name as a prefix of subnames beginning with a particular subname .
34,814
private void flattenNameRefAtDepth ( String alias , Node n , int depth , String originalName ) { Token nType = n . getToken ( ) ; boolean isQName = nType == Token . NAME || nType == Token . GETPROP ; boolean isObjKey = NodeUtil . mayBeObjectLitKey ( n ) ; checkState ( isObjKey || isQName ) ; if ( isQName ) { for ( int ...
Flattens a particular prefix of a single name reference .
34,815
private void collapseDeclarationOfNameAndDescendants ( Name n , String alias ) { boolean canCollapseChildNames = n . canCollapseUnannotatedChildNames ( ) ; if ( canCollapse ( n ) ) { updateGlobalNameDeclaration ( n , alias , canCollapseChildNames ) ; } if ( n . props == null ) { return ; } for ( Name p : n . props ) { ...
Collapses definitions of the collapsible properties of a global name . Recurs on subnames that also represent JavaScript objects with collapsible properties .
34,816
private void checkForHosedThisReferences ( Node function , JSDocInfo docInfo , final Name name ) { boolean isAllowedToReferenceThis = ( docInfo != null && ( docInfo . isConstructorOrInterface ( ) || docInfo . hasThisType ( ) ) ) || function . isArrowFunction ( ) ; if ( ! isAllowedToReferenceThis ) { NodeTraversal . tra...
Warns about any references to this in the given FUNCTION . The function is getting collapsed so the references will change .
34,817
private void declareVariablesForObjLitValues ( Name objlitName , String alias , Node objlit , Node varNode , Node nameToAddAfter , Node varParent ) { int arbitraryNameCounter = 0 ; boolean discardKeys = ! objlitName . shouldKeepKeys ( ) ; for ( Node key = objlit . getFirstChild ( ) , nextKey ; key != null ; key = nextK...
Declares global variables to serve as aliases for the values in an object literal optionally removing all of the object literal s keys and values .
34,818
private void addStubsForUndeclaredProperties ( Name n , String alias , Node parent , Node addAfter ) { checkState ( n . canCollapseUnannotatedChildNames ( ) , n ) ; checkArgument ( NodeUtil . isStatementBlock ( parent ) , parent ) ; checkNotNull ( addAfter ) ; if ( n . props == null ) { return ; } for ( Name p : n . pr...
Adds global variable stubs for any properties of a global name that are only set in a local scope or read but never set .
34,819
protected void report ( DiagnosticType diagnostic , Node n ) { JSError error = JSError . make ( n , diagnostic , n . toString ( ) ) ; compiler . report ( error ) ; }
Helper method for reporting an error to the compiler when applying a peephole optimization .
34,820
protected boolean areNodesEqualForInlining ( Node n1 , Node n2 ) { checkNotNull ( compiler ) ; return compiler . areNodesEqualForInlining ( n1 , n2 ) ; }
Are the nodes equal for the purpose of inlining? If type aware optimizations are on type equality is checked .
34,821
@ JsMethod ( name = "getClassJsDoc" , namespace = "jscomp" ) public static String getClassJsDoc ( String jsDoc ) { if ( Strings . isNullOrEmpty ( jsDoc ) ) { return null ; } Config config = Config . builder ( ) . setLanguageMode ( LanguageMode . ECMASCRIPT3 ) . setStrictMode ( Config . StrictMode . SLOPPY ) . setJsDocP...
Gets JS Doc that should be retained on a class . Used to upgrade ES5 to ES6 classes and separate class from constructor comments .
34,822
@ JsMethod ( name = "getConstructorJsDoc" , namespace = "jscomp" ) public static String getConstructorJsDoc ( String jsDoc ) { if ( Strings . isNullOrEmpty ( jsDoc ) ) { return null ; } Config config = Config . builder ( ) . setLanguageMode ( LanguageMode . ECMASCRIPT3 ) . setStrictMode ( Config . StrictMode . SLOPPY )...
Gets JS Doc that should be moved to a constructor . Used to upgrade ES5 to ES6 classes and separate class from constructor comments .
34,823
public ImmutableList < Require > getRequires ( ) { if ( hasFullParseDependencyInfo ) { return ImmutableList . copyOf ( orderedRequires ) ; } return getDependencyInfo ( ) . getRequires ( ) ; }
Gets a list of types depended on by this input .
34,824
ImmutableCollection < Require > getKnownRequires ( ) { return concat ( dependencyInfo != null ? dependencyInfo . getRequires ( ) : ImmutableList . of ( ) , extraRequires ) ; }
Gets a list of namespaces and paths depended on by this input but does not attempt to regenerate the dependency information . Typically this occurs from module rewriting .
34,825
ImmutableCollection < String > getKnownProvides ( ) { return concat ( dependencyInfo != null ? dependencyInfo . getProvides ( ) : ImmutableList . < String > of ( ) , extraProvides ) ; }
Gets a list of types provided but does not attempt to regenerate the dependency information . Typically this occurs from module rewriting .
34,826
public boolean addOrderedRequire ( Require require ) { if ( ! orderedRequires . contains ( require ) ) { orderedRequires . add ( require ) ; return true ; } return false ; }
Registers a type that this input depends on in the order seen in the file .
34,827
public boolean addDynamicRequire ( String require ) { if ( ! dynamicRequires . contains ( require ) ) { dynamicRequires . add ( require ) ; return true ; } return false ; }
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 .
34,828
DependencyInfo getDependencyInfo ( ) { if ( dependencyInfo == null ) { dependencyInfo = generateDependencyInfo ( ) ; } if ( ! extraRequires . isEmpty ( ) || ! extraProvides . isEmpty ( ) ) { dependencyInfo = SimpleDependencyInfo . builder ( getName ( ) , getName ( ) ) . setProvides ( concat ( dependencyInfo . getProvid...
Returns the DependencyInfo object generating it lazily if necessary .
34,829
public void setModule ( JSModule module ) { checkArgument ( module == null || this . module == null || this . module == module ) ; this . module = module ; }
Sets the module to which the input belongs .
34,830
private boolean isUnextendableNativeClass ( NodeTraversal t , String className ) { switch ( className ) { case "Array" : case "ArrayBuffer" : case "Boolean" : case "DataView" : case "Date" : case "Float32Array" : case "Function" : case "Generator" : case "GeneratorFunction" : case "Int16Array" : case "Int32Array" : cas...
Is the given class a native class for which we cannot properly transpile extension?
34,831
private boolean isDefinedInSources ( NodeTraversal t , String varName ) { Var objectVar = t . getScope ( ) . getVar ( varName ) ; return objectVar != null && ! objectVar . isExtern ( ) ; }
Is a variable with the given name defined in the source code being compiled?
34,832
static MinimizedCondition fromConditionNode ( Node n ) { checkState ( n . getParent ( ) != null ) ; switch ( n . getToken ( ) ) { case NOT : case AND : case OR : case HOOK : case COMMA : return computeMinimizedCondition ( n ) ; default : return unoptimized ( n ) ; } }
Returns a MinimizedCondition that represents the condition node after minimization .
34,833
static MeasuredNode pickBest ( MeasuredNode a , MeasuredNode b ) { if ( a . length == b . length ) { return ( b . isChanged ( ) ) ? a : b ; } return ( a . length < b . length ) ? a : b ; }
return the best prefer unchanged
34,834
private static MinimizedCondition computeMinimizedCondition ( Node n ) { switch ( n . getToken ( ) ) { case NOT : { MinimizedCondition subtree = computeMinimizedCondition ( n . getFirstChild ( ) ) ; MeasuredNode positive = pickBest ( MeasuredNode . addNode ( n , subtree . positive ) , subtree . negative ) ; MeasuredNod...
Minimize the condition at the given node .
34,835
static Node withType ( Node n , JSType t ) { if ( t != null ) { n . setJSType ( t ) ; } return n ; }
Adds the type t to Node n and returns n . Does nothing if t is null .
34,836
static JSType createType ( boolean shouldCreate , JSTypeRegistry registry , JSTypeNative typeName ) { if ( ! shouldCreate ) { return null ; } return registry . getNativeType ( typeName ) ; }
Returns the JSType as specified by the typeName . Returns null if shouldCreate is false .
34,837
static JSType createGenericType ( boolean shouldCreate , JSTypeRegistry registry , JSTypeNative typeName , JSType typeArg ) { if ( ! shouldCreate ) { return null ; } ObjectType genericType = ( ObjectType ) ( registry . getNativeType ( typeName ) ) ; ObjectType uninstantiated = genericType . getRawType ( ) ; return regi...
Returns the JSType as specified by the typeName and instantiated by the typeArg . Returns null if shouldCreate is false .
34,838
private void addToUseIfLocal ( String name , Node node , ReachingUses use ) { Var var = allVarsInFn . get ( name ) ; if ( var == null ) { return ; } if ( ! escaped . contains ( var ) ) { use . mayUseMap . put ( var , node ) ; } }
Sets the variable for the given name to the node value in the upward exposed lattice . Do nothing if the variable name is one of the escaped variable .
34,839
private void removeFromUseIfLocal ( String name , ReachingUses use ) { Var var = allVarsInFn . get ( name ) ; if ( var == null ) { return ; } if ( ! escaped . contains ( var ) ) { use . mayUseMap . removeAll ( var ) ; } }
Removes the variable for the given name from the node value in the upward exposed lattice . Do nothing if the variable name is one of the escaped variable .
34,840
static final JSType getTemplateTypeOfThenable ( JSTypeRegistry registry , JSType maybeThenable ) { return maybeThenable . restrictByNotNullOrUndefined ( ) . getInstantiatedTypeArgument ( registry . getNativeType ( JSTypeNative . I_THENABLE_TYPE ) ) ; }
If this object is known to be an IThenable returns the type it resolves to .
34,841
static final JSType wrapInIThenable ( JSTypeRegistry registry , JSType maybeThenable ) { JSType unwrapped = getResolvedType ( registry , maybeThenable ) ; return registry . createTemplatizedType ( registry . getNativeObjectType ( JSTypeNative . I_THENABLE_TYPE ) , unwrapped ) ; }
Wraps the given type in an IThenable .
34,842
private static String formatOutput ( String js , boolean export ) { StringBuilder output = new StringBuilder ( ) ; output . append ( "(function(window){" ) ; output . append ( "var $wnd=" ) . append ( export ? "this" : "{'Error':{}}" ) . append ( ";" ) ; output . append ( "var $doc={},$moduleName,$moduleBase;" ) ; outp...
Formats the application s JS code for output .
34,843
public static CharRanges withRanges ( int ... ranges ) { if ( ( ranges . length & 1 ) != 0 ) { throw new IllegalArgumentException ( ) ; } for ( int i = 1 ; i < ranges . length ; ++ i ) { if ( ranges [ i ] <= ranges [ i - 1 ] ) { throw new IllegalArgumentException ( ranges [ i ] + " > " + ranges [ i - 1 ] ) ; } } return...
Returns an instance containing the given ranges .
34,844
static boolean isStartOfIcuMessage ( String part ) { if ( ! part . startsWith ( "{" ) ) { return false ; } int commaIndex = part . indexOf ( ',' , 1 ) ; if ( commaIndex <= 1 ) { return false ; } int nextBracketIndex = part . indexOf ( '{' , 1 ) ; return ( nextBracketIndex == - 1 || nextBracketIndex > commaIndex ) && ( ...
Detects an ICU - formatted plural or select message . Any placeholders occurring inside these messages must be rewritten in ICU format .
34,845
private static SAXParser createSAXParser ( ) throws ParserConfigurationException , SAXException { SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; factory . setValidating ( false ) ; factory . setXIncludeAware ( false ) ; factory . setFeature ( "http://xml.org/sax/features/external-general-entities" , fa...
Inlined from guava - internal .
34,846
protected String locate ( String scriptAddress , String name ) { String canonicalizedPath = canonicalizePath ( scriptAddress , name ) ; String normalizedPath = canonicalizedPath ; if ( ModuleLoader . isAmbiguousIdentifier ( canonicalizedPath ) ) { normalizedPath = ModuleLoader . MODULE_SLASH + canonicalizedPath ; } if ...
Locates the module with the given name but returns null if there is no JS file in the expected location .
34,847
static Binding from ( Export boundExport , Node sourceNode ) { return new AutoValue_Binding ( boundExport . moduleMetadata ( ) , sourceNode , boundExport , false , null , CreatedBy . EXPORT ) ; }
Binding for an exported value that is not a module namespace object .
34,848
Binding copy ( Node sourceNode , CreatedBy createdBy ) { checkNotNull ( sourceNode ) ; return new AutoValue_Binding ( metadata ( ) , sourceNode , originatingExport ( ) , isModuleNamespace ( ) , closureNamespace ( ) , createdBy ) ; }
Copies the binding with a new source node and CreatedBy binding .
34,849
void reportError ( Node n , Var var , String name ) { JSDocInfo info = NodeUtil . getBestJSDocInfo ( n ) ; if ( info == null || ! info . getSuppressions ( ) . contains ( "const" ) ) { Node declNode = var . getNode ( ) ; String declaredPosition = declNode . getSourceFileName ( ) + ":" + declNode . getLineno ( ) ; compil...
Reports a reassigned constant error .
34,850
static final JSType getElementType ( JSType iterableOrIterator , JSTypeRegistry typeRegistry ) { TemplateTypeMap templateTypeMap = iterableOrIterator . autobox ( ) . getTemplateTypeMap ( ) ; if ( templateTypeMap . hasTemplateKey ( typeRegistry . getIterableTemplate ( ) ) ) { return templateTypeMap . getResolvedTemplate...
Returns the given Iterable s element type .
34,851
void putBranchNode ( int lineNumber , int branchNumber , Node block ) { Preconditions . checkArgument ( lineNumber > 0 , "Expected non-zero positive integer as line number: %s" , lineNumber ) ; Preconditions . checkArgument ( branchNumber > 0 , "Expected non-zero positive integer as branch number: %s" , branchNumber ) ...
Store a node to be instrumented later for branch coverage .
34,852
Node getBranchNode ( int lineNumber , int branchNumber ) { Preconditions . checkArgument ( lineNumber > 0 , "Expected non-zero positive integer as line number: %s" , lineNumber ) ; Preconditions . checkArgument ( branchNumber > 0 , "Expected non-zero positive integer as branch number: %s" , branchNumber ) ; return bran...
Get the block node to be instrumented for branch coverage .
34,853
void addBranches ( int lineNumber , int numberOfBranches ) { int lineIdx = lineNumber - 1 ; Integer currentValue = branchesInLine . get ( Integer . valueOf ( lineIdx ) ) ; if ( currentValue == null ) { branchesInLine . put ( lineIdx , numberOfBranches ) ; } else { branchesInLine . put ( lineIdx , currentValue + numberO...
Add a number of branches to a line .
34,854
int getNumBranches ( int lineNumber ) { Integer numBranches = branchesInLine . get ( lineNumber - 1 ) ; if ( numBranches == null ) { return 0 ; } else { return numBranches ; } }
Get the number of branches on a line
34,855
private static void populateDefaults ( JSDocInfo info ) { if ( info . getVisibility ( ) == null ) { info . setVisibility ( Visibility . INHERITED ) ; } }
Generate defaults when certain parameters are not specified .
34,856
public void markAnnotation ( String annotation , int lineno , int charno ) { JSDocInfo . Marker marker = currentInfo . addMarker ( ) ; if ( marker != null ) { JSDocInfo . TrimmedStringPosition position = new JSDocInfo . TrimmedStringPosition ( ) ; position . setItem ( annotation ) ; position . setPositionInformation ( ...
Adds a marker to the current JSDocInfo and populates the marker with the annotation information .
34,857
public void markText ( String text , int startLineno , int startCharno , int endLineno , int endCharno ) { if ( currentMarker != null ) { JSDocInfo . StringPosition position = new JSDocInfo . StringPosition ( ) ; position . setItem ( text ) ; position . setPositionInformation ( startLineno , startCharno , endLineno , e...
Adds a textual block to the current marker .
34,858
public void markTypeNode ( Node typeNode , int lineno , int startCharno , int endLineno , int endCharno , boolean hasLC ) { if ( currentMarker != null ) { JSDocInfo . TypePosition position = new JSDocInfo . TypePosition ( ) ; position . setItem ( typeNode ) ; position . setHasBrackets ( hasLC ) ; position . setPosition...
Adds a type declaration to the current marker .
34,859
public void markName ( String name , Node templateNode , int lineno , int charno ) { if ( currentMarker != null ) { JSDocInfo . TrimmedStringPosition position = new JSDocInfo . TrimmedStringPosition ( ) ; position . setItem ( name ) ; position . setPositionInformation ( lineno , charno , lineno , charno + name . length...
Adds a name declaration to the current marker .
34,860
public boolean recordVisibility ( Visibility visibility ) { if ( currentInfo . getVisibility ( ) == null ) { populated = true ; currentInfo . setVisibility ( visibility ) ; return true ; } else { return false ; } }
Records a visibility .
34,861
public boolean recordParameter ( String parameterName , JSTypeExpression type ) { if ( ! hasAnySingletonTypeTags ( ) && currentInfo . declareParam ( type , parameterName ) ) { populated = true ; return true ; } else { return false ; } }
Records a typed parameter .
34,862
public boolean recordParameterDescription ( String parameterName , String description ) { if ( currentInfo . documentParam ( parameterName , description ) ) { populated = true ; return true ; } else { return false ; } }
Records a parameter s description .
34,863
public boolean recordTemplateTypeName ( String name ) { if ( currentInfo . declareTemplateTypeName ( name ) ) { populated = true ; return true ; } else { return false ; } }
Records a template type name .
34,864
public boolean recordTypeTransformation ( String name , Node expr ) { if ( currentInfo . declareTypeTransformation ( name , expr ) ) { populated = true ; return true ; } else { return false ; } }
Records a type transformation expression together with its template type name .
34,865
public boolean recordThrowType ( JSTypeExpression type ) { if ( type != null && ! hasAnySingletonTypeTags ( ) ) { currentInfo . declareThrows ( type ) ; populated = true ; return true ; } return false ; }
Records a thrown type .
34,866
public boolean recordThrowDescription ( JSTypeExpression type , String description ) { if ( currentInfo . documentThrows ( type , description ) ) { populated = true ; return true ; } else { return false ; } }
Records a throw type s description .
34,867
public boolean addAuthor ( String author ) { if ( currentInfo . documentAuthor ( author ) ) { populated = true ; return true ; } else { return false ; } }
Adds an author to the current information .
34,868
public boolean addReference ( String reference ) { if ( currentInfo . documentReference ( reference ) ) { populated = true ; return true ; } else { return false ; } }
Adds a reference (
34,869
public boolean recordVersion ( String version ) { if ( currentInfo . documentVersion ( version ) ) { populated = true ; return true ; } else { return false ; } }
Records the version .
34,870
public boolean recordDeprecationReason ( String reason ) { if ( currentInfo . setDeprecationReason ( reason ) ) { populated = true ; return true ; } else { return false ; } }
Records the deprecation reason .
34,871
public boolean recordModifies ( Set < String > modifies ) { if ( ! hasAnySingletonSideEffectTags ( ) && currentInfo . setModifies ( modifies ) ) { populated = true ; return true ; } else { return false ; } }
Records the list of modifies warnings .
34,872
public boolean recordType ( JSTypeExpression type ) { if ( type != null && ! hasAnyTypeRelatedTags ( ) ) { currentInfo . setType ( type ) ; populated = true ; return true ; } else { return false ; } }
Records a type .
34,873
public boolean recordReturnType ( JSTypeExpression jsType ) { if ( jsType != null && currentInfo . getReturnType ( ) == null && ! hasAnySingletonTypeTags ( ) ) { currentInfo . setReturnType ( jsType ) ; populated = true ; return true ; } else { return false ; } }
Records a return type .
34,874
public boolean recordReturnDescription ( String description ) { if ( currentInfo . documentReturn ( description ) ) { populated = true ; return true ; } else { return false ; } }
Records a return description
34,875
public boolean recordDefineType ( JSTypeExpression type ) { if ( type != null && ! currentInfo . isConstant ( ) && ! currentInfo . isDefine ( ) && recordType ( type ) ) { currentInfo . setDefine ( true ) ; populated = true ; return true ; } else { return false ; } }
Records the type of a define .
34,876
public boolean recordEnumParameterType ( JSTypeExpression type ) { if ( type != null && ! hasAnyTypeRelatedTags ( ) ) { currentInfo . setEnumParameterType ( type ) ; populated = true ; return true ; } else { return false ; } }
Records a parameter type to an enum .
34,877
public boolean recordBaseType ( JSTypeExpression jsType ) { if ( jsType != null && ! hasAnySingletonTypeTags ( ) && ! currentInfo . hasBaseType ( ) ) { currentInfo . setBaseType ( jsType ) ; populated = true ; return true ; } else { return false ; } }
Records a base type .
34,878
public boolean changeBaseType ( JSTypeExpression jsType ) { if ( jsType != null && ! hasAnySingletonTypeTags ( ) ) { currentInfo . setBaseType ( jsType ) ; populated = true ; return true ; } else { return false ; } }
Changes a base type even if one has already been set on currentInfo .
34,879
public boolean recordClosurePrimitiveId ( String closurePrimitiveId ) { if ( closurePrimitiveId != null && currentInfo . getClosurePrimitiveId ( ) == null ) { currentInfo . setClosurePrimitiveId ( closurePrimitiveId ) ; populated = true ; return true ; } else { return false ; } }
Records an identifier for a Closure Primitive . function .
34,880
public boolean recordFileOverview ( String description ) { if ( currentInfo . documentFileOverview ( description ) ) { populated = true ; return true ; } else { return false ; } }
Records a fileoverview description .
34,881
public boolean recordImplementedInterface ( JSTypeExpression interfaceName ) { if ( interfaceName != null && currentInfo . addImplementedInterface ( interfaceName ) ) { populated = true ; return true ; } else { return false ; } }
Records an implemented interface .
34,882
public boolean recordExtendedInterface ( JSTypeExpression interfaceType ) { if ( interfaceType != null && currentInfo . addExtendedInterface ( interfaceType ) ) { populated = true ; return true ; } else { return false ; } }
Records an extended interface type .
34,883
public boolean recordLends ( JSTypeExpression name ) { if ( ! hasAnyTypeRelatedTags ( ) ) { currentInfo . setLendsName ( name ) ; populated = true ; return true ; } else { return false ; } }
Records that we re lending to another name .
34,884
public boolean recordDisposesParameter ( List < String > parameterNames ) { for ( String parameterName : parameterNames ) { if ( ( currentInfo . hasParameter ( parameterName ) || parameterName . equals ( "*" ) ) && currentInfo . setDisposedParameter ( parameterName ) ) { populated = true ; } else { return false ; } } r...
Records a parameter that gets disposed .
34,885
private void reusePreviouslyUsedVariableMap ( SortedSet < Assignment > varsToRename ) { checkNotNull ( prevUsedRenameMap . getNewNameToOriginalNameMap ( ) ) ; for ( Assignment a : varsToRename ) { String prevNewName = prevUsedRenameMap . lookupNewName ( a . oldName ) ; if ( prevNewName == null || reservedNames . contai...
Runs through the assignments and reuses as many names as possible from the previously used variable map . Updates reservedNames with the set of names that were reused .
34,886
private void assignNames ( SortedSet < Assignment > varsToRename ) { NameGenerator globalNameGenerator = null ; NameGenerator localNameGenerator = null ; globalNameGenerator = nameGenerator ; nameGenerator . reset ( reservedNames , prefix , reservedCharacters ) ; localNameGenerator = prefix . isEmpty ( ) ? globalNameGe...
Determines which new names to substitute for the original names .
34,887
private void finalizeNameAssignment ( Assignment a , String newName ) { a . setNewName ( newName ) ; renameMap . put ( a . oldName , newName ) ; }
Makes a final name assignment .
34,888
public String version ( ) { if ( ES3 . contains ( this ) ) { return "es3" ; } if ( ES5 . contains ( this ) ) { return "es5" ; } if ( ES6_MODULES . contains ( this ) ) { return "es6" ; } if ( ES7_MODULES . contains ( this ) ) { return "es7" ; } if ( ES8_MODULES . contains ( this ) ) { return "es8" ; } if ( ES2018_MODULE...
Returns a string representation suitable for encoding in depgraph and deps . js files .
34,889
public static FeatureSet valueOf ( String name ) { switch ( name ) { case "es3" : return ES3 ; case "es5" : return ES5 ; case "es6-impl" : case "es6" : return ES6 ; case "typeCheckSupported" : return TYPE_CHECK_SUPPORTED ; case "es7" : return ES7 ; case "es8" : return ES8 ; case "es2018" : case "es9" : return ES2018 ; ...
Parses known strings into feature sets .
34,890
public String computeDependencyCalls ( ) throws IOException { Map < String , DependencyInfo > depsFiles = parseDepsFiles ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "preparsedFiles: " + depsFiles ) ; } Map < String , DependencyInfo > jsFiles = parseSources ( depsFiles . keySet ( ) ) ; if ( error...
Performs the parsing inputs and writing of outputs .
34,891
protected void cleanUpDuplicatedFiles ( Map < String , DependencyInfo > depsFiles , Map < String , DependencyInfo > jsFiles ) { Set < String > depsPathsCopy = new HashSet < > ( depsFiles . keySet ( ) ) ; for ( String path : depsPathsCopy ) { if ( mergeStrategy != InclusionStrategy . WHEN_IN_SRCS ) { jsFiles . remove ( ...
Removes duplicated depsInfo from jsFiles if this info already present in some of the parsed deps . js
34,892
private void addToProvideMap ( Iterable < DependencyInfo > depInfos , Map < String , DependencyInfo > providesMap , boolean isFromDepsFile ) { for ( DependencyInfo depInfo : depInfos ) { List < String > provides = new ArrayList < > ( depInfo . getProvides ( ) ) ; if ( isFromDepsFile ) { provides . add ( loader . resolv...
Adds the given DependencyInfos to the given providesMap . Also checks for and reports duplicate provides .
34,893
private Map < String , DependencyInfo > parseDepsFiles ( ) throws IOException { DepsFileParser depsParser = createDepsFileParser ( ) ; Map < String , DependencyInfo > depsFiles = new LinkedHashMap < > ( ) ; for ( SourceFile file : deps ) { if ( ! shouldSkipDepsFile ( file ) ) { List < DependencyInfo > depInfos = depsPa...
Parses all deps . js files in the deps list and creates a map of closure - relative path - > DependencyInfo .
34,894
private Map < String , DependencyInfo > parseSources ( Set < String > preparsedFiles ) throws IOException { Map < String , DependencyInfo > parsedFiles = new LinkedHashMap < > ( ) ; JsFileParser jsParser = new JsFileParser ( errorManager ) . setModuleLoader ( loader ) ; Compiler compiler = new Compiler ( ) ; compiler ....
Parses all source files for dependency information .
34,895
private void writeDepsContent ( Map < String , DependencyInfo > depsFiles , Map < String , DependencyInfo > jsFiles , PrintStream out ) throws IOException { writeDepInfos ( out , jsFiles . values ( ) ) ; if ( mergeStrategy == InclusionStrategy . ALWAYS ) { Multimap < String , DependencyInfo > infosIndex = Multimaps . i...
Creates the content to put into the output deps . js file . If mergeDeps is true then all of the dependency information in the providedDeps will be included in the output .
34,896
private void addReturnTypeIfMissing ( PolymerClassDefinition cls , String getterPropName , JSTypeExpression jsType ) { Node classMembers = NodeUtil . getClassMembers ( cls . definition ) ; Node getter = NodeUtil . getFirstGetterMatchingKey ( classMembers , getterPropName ) ; if ( getter != null ) { JSDocInfo info = Nod...
Adds return type information to class getters
34,897
private void addPropertiesConfigObjectReflection ( PolymerClassDefinition cls , Node propertiesLiteral ) { checkNotNull ( propertiesLiteral ) ; checkState ( propertiesLiteral . isObjectLit ( ) ) ; Node parent = propertiesLiteral . getParent ( ) ; Node objReflectCall = IR . call ( NodeUtil . newQName ( compiler , "$jsco...
Wrap the properties config object in an objectReflect call
34,898
private void appendPropertiesToBlock ( List < MemberDefinition > props , Node block , String basePath ) { for ( MemberDefinition prop : props ) { Node propertyNode = IR . exprResult ( NodeUtil . newQName ( compiler , basePath + prop . name . getString ( ) ) ) ; if ( prop . name . isQuotedString ( ) ) { continue ; } pro...
Appends all of the given properties to the given block .
34,899
private void removePropertyDocs ( final Node objLit , PolymerClassDefinition . DefinitionType defType ) { for ( MemberDefinition prop : PolymerPassStaticUtils . extractProperties ( objLit , defType , compiler , null ) ) { prop . name . removeProp ( Node . JSDOC_INFO_PROP ) ; } }
Remove all JSDocs from properties of a class definition