nashorn/src/jdk/nashorn/internal/ir/Symbol.java
changeset 21685 ff0187bbe5c0
parent 19095 0b215bda525d
child 24719 f726e9d67629
equal deleted inserted replaced
21462:44238d753963 21685:ff0187bbe5c0
    73     public static final int IS_FUNCTION_SELF     = 1 << 12;
    73     public static final int IS_FUNCTION_SELF     = 1 << 12;
    74     /** Is this a specialized param? */
    74     /** Is this a specialized param? */
    75     public static final int IS_SPECIALIZED_PARAM = 1 << 13;
    75     public static final int IS_SPECIALIZED_PARAM = 1 << 13;
    76     /** Is this symbol a shared temporary? */
    76     /** Is this symbol a shared temporary? */
    77     public static final int IS_SHARED            = 1 << 14;
    77     public static final int IS_SHARED            = 1 << 14;
       
    78     /** Is this a function declaration? */
       
    79     public static final int IS_FUNCTION_DECLARATION = 1 << 15;
    78 
    80 
    79     /** Null or name identifying symbol. */
    81     /** Null or name identifying symbol. */
    80     private final String name;
    82     private final String name;
    81 
    83 
    82     /** Symbol flags. */
    84     /** Symbol flags. */
   358     public boolean isShared() {
   360     public boolean isShared() {
   359         return (flags & IS_SHARED) == IS_SHARED;
   361         return (flags & IS_SHARED) == IS_SHARED;
   360     }
   362     }
   361 
   363 
   362     /**
   364     /**
       
   365      * Check if this symbol is a function declaration
       
   366      * @return true if a function declaration
       
   367      */
       
   368     public boolean isFunctionDeclaration() {
       
   369         return (flags & IS_FUNCTION_DECLARATION) == IS_FUNCTION_DECLARATION;
       
   370     }
       
   371 
       
   372     /**
   363      * Creates an unshared copy of a symbol. The symbol must be currently shared.
   373      * Creates an unshared copy of a symbol. The symbol must be currently shared.
   364      * @param newName the name for the new symbol.
   374      * @param newName the name for the new symbol.
   365      * @return a new, unshared symbol.
   375      * @return a new, unshared symbol.
   366      */
   376      */
   367     public Symbol createUnshared(final String newName) {
   377     public Symbol createUnshared(final String newName) {
   394          }
   404          }
   395      }
   405      }
   396 
   406 
   397 
   407 
   398     /**
   408     /**
       
   409      * Mark this symbol as a function declaration.
       
   410      */
       
   411     public void setIsFunctionDeclaration() {
       
   412         if (!isFunctionDeclaration()) {
       
   413             trace("SET IS FUNCTION DECLARATION");
       
   414             flags |= IS_FUNCTION_DECLARATION;
       
   415         }
       
   416     }
       
   417 
       
   418     /**
   399      * Check if this symbol is a variable
   419      * Check if this symbol is a variable
   400      * @return true if variable
   420      * @return true if variable
   401      */
   421      */
   402     public boolean isVar() {
   422     public boolean isVar() {
   403         return (flags & KINDMASK) == IS_VAR;
   423         return (flags & KINDMASK) == IS_VAR;