Package com.google.gwt.dev.jjs.ast

Examples of com.google.gwt.dev.jjs.ast.JLocal


      //    ... b...
      //   }
      // }
      // Scope 1.1 is the innermost scope that encloses the lifetime of variable a and
      // scope 1 is the innermost scope that encloses the lifetime of variable b.
      JLocal local = x.getLocal();
      Scope oldVariableScope = scopesByLocal.get(local);
      Scope newVariableScope =  Scope.getInnermostEnclosingScope(oldVariableScope, currentScope);
      newVariableScope.addUsedName(local.getName());
      if (newVariableScope != oldVariableScope) {
        scopesByLocal.put(local, newVariableScope);
      }
      localsByName.put(local.getName(), local);
    }
View Full Code Here


          currentMethod, x.label), body);
    }

    JStatement processStatement(LocalDeclaration x) {
      SourceInfo info = makeSourceInfo(x);
      JLocal local = (JLocal) typeMap.get(x.binding);
      JLocalRef localRef = new JLocalRef(program, info, local);
      JExpression initializer = dispProcessExpression(x.initialization);
      return new JLocalDeclarationStatement(program, info, localRef,
          initializer);
    }
View Full Code Here

      JBlock tryBlock = (JBlock) dispProcessStatement(x.tryBlock);
      List/* <JLocalRef> */catchArgs = new ArrayList/* <JLocalRef> */();
      List/* <JBlock> */catchBlocks = new ArrayList/* <JBlock> */();
      if (x.catchBlocks != null) {
        for (int i = 0, c = x.catchArguments.length; i < c; ++i) {
          JLocal local = (JLocal) typeMap.get(x.catchArguments[i].binding);
          catchArgs.add(createVariableRef(info, local));
        }
        for (int i = 0, c = x.catchBlocks.length; i < c; ++i) {
          catchBlocks.add(dispProcessStatement(x.catchBlocks[i]));
        }
View Full Code Here

     * Creates an appropriate JVariableRef for the polymorphic type of the
     * requested JVariable.
     */
    private JVariableRef createVariableRef(SourceInfo info, JVariable variable) {
      if (variable instanceof JLocal) {
        JLocal local = (JLocal) variable;
        if (local.getEnclosingMethod() != currentMethod) {
          throw new InternalCompilerException(
              "LocalRef referencing local in a different method.");
        }
        return new JLocalRef(program, info, local);
      } else if (variable instanceof JParameter) {
View Full Code Here

        SourceInfo info = makeSourceInfo(argument);
        LocalVariableBinding b = argument.binding;
        JType localType = (JType) typeMap.get(b.type);
        JMethodBody enclosingBody = findEnclosingMethod(scope);
        JLocal newLocal = program.createLocal(info, argument.name, localType,
            b.isFinal(), enclosingBody);
        typeMap.put(b, newLocal);
        return true;
      } catch (Throwable e) {
        throw translateException(argument, e);
View Full Code Here

      try {
        LocalVariableBinding b = localDeclaration.binding;
        JType localType = (JType) typeMap.get(localDeclaration.type.resolvedType);
        JMethodBody enclosingBody = findEnclosingMethod(scope);
        SourceInfo info = makeSourceInfo(localDeclaration);
        JLocal newLocal = program.createLocal(info, localDeclaration.name,
            localType, b.isFinal(), enclosingBody);
        typeMap.put(b, newLocal);
        return true;
      } catch (Throwable e) {
        throw translateException(localDeclaration, e);
View Full Code Here

      return false;
    }

    // @Override
    public boolean visit(JLocalRef ref, Context ctx) {
      JLocal target = ref.getLocal();
      rescue(target);
      return true;
    }
View Full Code Here

  private JLocal getTempLocal() {
    if (localIndex < tempLocals.size()) {
      return (JLocal) tempLocals.get(localIndex++);
    }
    JLocal newTemp = program.createLocal(null,
        ("$t" + localIndex++).toCharArray(), program.getTypeVoid(), false,
        currentMethodBody);
    tempLocals.add(newTemp);
    return newTemp;
  }
View Full Code Here

      if (!x.hasSideEffects()) {
        return x;
      }

      // Create a temp local
      JLocal tempLocal = getTempLocal();

      // Create an assignment for this temp and add it to multi.
      JLocalRef tempRef = new JLocalRef(program, x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
          x.getType(), JBinaryOperator.ASG, tempRef, x);
View Full Code Here

    return (JLocal) tempLocals.get(--localIndex);
  }

  private void pushTempLocal() {
    if (localIndex == tempLocals.size()) {
      JLocal newTemp = program.createLocal(null,
          ("$e" + localIndex).toCharArray(), program.getTypeJavaLangObject(),
          false, currentMethodBody);
      tempLocals.add(newTemp);
    }
    ++localIndex;
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JLocal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.