private PolyfillInfo createPolyfillInfo ( Node call , Scope scope , String name ) { checkState ( scope . isGlobal ( ) ) ; checkState ( call . getParent ( ) . isExprResult ( ) ) ; // Make the removable and polyfill info. Add continuations for all arguments. RemovableBuilder builder = new RemovableBuilder ( ) ; for ( Node n = call . getFirstChild ( ) . getNext ( ) ; n != null ; n = n . getNext ( ) ) { builder . addContinuation ( new Continuation ( n , scope ) ) ; } Polyfill removable = builder . buildPolyfill ( call . getParent ( ) ) ; int lastDot = name . lastIndexOf ( "." ) ; if ( lastDot < 0 ) { return new GlobalPolyfillInfo ( removable , name ) ; } String owner = name . substring ( 0 , lastDot ) ; String prop = name . substring ( lastDot + 1 ) ; boolean typed = call . getJSType ( ) != null ; if ( owner . endsWith ( DOT_PROTOTYPE ) ) { owner = owner . substring ( 0 , owner . length ( ) - DOT_PROTOTYPE . length ( ) ) ; return new PrototypePropertyPolyfillInfo ( removable , prop , typed ? compiler . getTypeRegistry ( ) . getType ( scope , owner ) : null ) ; } ObjectType ownerInstanceType = typed ? ObjectType . cast ( compiler . getTypeRegistry ( ) . getType ( scope , owner ) ) : null ; JSType ownerCtorType = ownerInstanceType != null ? ownerInstanceType . getConstructor ( ) : null ; return new StaticPropertyPolyfillInfo ( removable , prop , ownerCtorType , owner ) ; }
Makes a new PolyfillInfo including the correct Removable . Parses the name to determine whether this is a global static or prototype polyfill .