protected JSType getTypeIfRefinable(Node node, FlowScope scope) {
    switch (node.getToken()) {
      case NAME:
        StaticTypedSlot nameVar = scope.getSlot(node.getString());
        if (nameVar != null) {
          JSType nameVarType = nameVar.getType();
          if (nameVarType == null) {
            nameVarType = node.getJSType();
          }
          return nameVarType;
        }
        return null;

      case GETPROP:
        String qualifiedName = node.getQualifiedName();
        if (qualifiedName == null) {
          return null;
        }
        StaticTypedSlot propVar = scope.getSlot(qualifiedName);
        JSType propVarType = null;
        if (propVar != null) {
          propVarType = propVar.getType();
        }
        if (propVarType == null) {
          propVarType = node.getJSType();
        }
        if (propVarType == null) {
          propVarType = getNativeType(UNKNOWN_TYPE);
        }
        return propVarType;
      default:
        break;
    }
    return null;
  }
protected JSType getTypeIfRefinable ( Node node , FlowScope scope ) { switch ( node . getToken ( ) ) { case NAME : StaticTypedSlot nameVar = scope . getSlot ( node . getString ( ) ) ; if ( nameVar != null ) { JSType nameVarType = nameVar . getType ( ) ; if ( nameVarType == null ) { nameVarType = node . getJSType ( ) ; } return nameVarType ; } return null ; case GETPROP : String qualifiedName = node . getQualifiedName ( ) ; if ( qualifiedName == null ) { return null ; } StaticTypedSlot propVar = scope . getSlot ( qualifiedName ) ; JSType propVarType = null ; if ( propVar != null ) { propVarType = propVar . getType ( ) ; } if ( propVarType == null ) { propVarType = node . getJSType ( ) ; } if ( propVarType == null ) { propVarType = getNativeType ( UNKNOWN_TYPE ) ; } return propVarType ; default : break ; } return null ; }
Returns the type of a node in the given scope if the node corresponds to a
name whose type is capable of being refined.
@return The current type of the node if it can be refined, null otherwise.