Esempio n. 1
0
 @Override
 public List<SNode> getVariables() {
   LinkedList<SNode> nodes = new LinkedList<SNode>();
   if (TypesUtil.isVariable(myChild)) {
     nodes.add(myChild);
   }
   if (TypesUtil.isVariable(myParent)) {
     nodes.add(myParent);
   }
   return nodes;
 }
Esempio n. 2
0
  @Nullable
  /*package*/ SNode getTypeOf(final SNode node) {
    ModelAccess.assertLegalRead();
    if (node == null) return null;

    if (myTypeChecker.isGenerationMode()) {
      TypeCheckingContext context =
          myTypeChecker.hasPerformanceTracer()
              ? new TargetTypecheckingContext_Tracer(node, myTypeChecker)
              : new TargetTypecheckingContext(node, myTypeChecker);
      try {
        return context.getTypeOf_generationMode(node);
      } finally {
        context.dispose();
      }
    }
    // now we are not in generation mode

    final ITypeContextOwner contextOwner = myTypecheckingContextOwner.get();
    TypeCheckingContext context = acquireTypecheckingContext(node, contextOwner);
    if (context == null) {
      return TypesUtil.createRuntimeErrorType();
    }

    try {
      return context.getTypeOf(node, myTypeChecker);
    } finally {
      releaseTypecheckingContext(node, contextOwner);
    }
  }
Esempio n. 3
0
 public static boolean hasVariablesInside(SNode node) {
   if (isRuntimeTypeVariable(node)) {
     return true;
   }
   for (SNode child : node.getChildren()) {
     if (hasVariablesInside(child)) {
       return true;
     }
   }
   for (SNode referent : TypesUtil.getNodeReferents(node)) {
     if (referent != null && HUtil.isRuntimeTypeVariable(referent)) {
       return true;
     }
   }
   return false;
 }