private void addAliasDeclarationNodes ( ) { for ( Entry < String , StringInfo > entry : stringInfoMap . entrySet ( ) ) { StringInfo info = entry . getValue ( ) ; if ( ! info . isAliased ) { continue ; } String alias = info . getVariableName ( entry . getKey ( ) ) ; Node var = IR . var ( IR . name ( alias ) , IR . string ( entry . getKey ( ) ) ) ; var . useSourceInfoFromForTree ( info . parentForNewVarDecl ) ; if ( info . siblingToInsertVarDeclBefore == null ) { info . parentForNewVarDecl . addChildToFront ( var ) ; } else { info . parentForNewVarDecl . addChildBefore ( var , info . siblingToInsertVarDeclBefore ) ; } compiler . reportChangeToEnclosingScope ( var ) ; } }
Creates a var declaration for each aliased string . Var declarations are inserted as close to the first use of the string as possible .