Examples of JProgram


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

        "  int i1 = 1;",
        "  Integer i2 = new Integer(1);",
        "  final int fi1 = 1;",
        "  final Integer fi2 = new Integer(1);",
        "}");
    JProgram program = compileSnippet("void", "return;");
    assertAnalysisCorrect(program,
        ImmutableList.of("EntryPoint$B.i1", "EntryPoint$B.i2", "EntryPoint$B.fi2"),
        ImmutableList.of("EntryPoint$B.fi1"));
  }
View Full Code Here

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

        "  int i1 = 1;",
        "  Integer i2 = new Integer(1);",
        "  final int fi1 = 1;",
        "  final Integer fi2 = new Integer(1);",
        "}");
    JProgram program = compileSnippet("void", "return;");
    assertAnalysisCorrect(program,
        ImmutableList.of("EntryPoint$B.i1", "EntryPoint$B.i2", "EntryPoint$B.fi2"),
        ImmutableList.of("EntryPoint$B.fi1"));
    MakeCallsStatic.exec(program, false); // required so that method is static
    assertAnalysisCorrect(program,
View Full Code Here

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

  private void testSnippet(String codeSnippet) {
    UnitTestTreeLogger testLogger = testLoggerBuilder.createLogger();
    logger = testLogger;

    try {
      JProgram program = compileSnippet("void", codeSnippet);
      ReplaceRunAsyncs.exec(logger, program);
      fail("Expected a compile error");
    } catch (UnableToCompleteException e) {
      // expected
    }
View Full Code Here

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

    compilerContext.getOptions().setSourceLevel(sourceLevel);
    compilerContext.getOptions().setStrict(true);
    CompilationState state =
        CompilationStateBuilder.buildFrom(logger, compilerContext,
            sourceOracle.getResources(), getAdditionalTypeProviderDelegate());
    JProgram program =
        JavaAstConstructor.construct(logger, state, compilerContext.getOptions(),
            null, "test.EntryPoint", "com.google.gwt.lang.Exceptions");
    return program;
  }
View Full Code Here

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

   */
  protected SourceLevel sourceLevel = SourceLevel.DEFAULT_SOURCE_LEVEL;

  public Result assertTransform(String codeSnippet, JVisitor visitor)
      throws UnableToCompleteException {
    JProgram program = compileSnippet("void", codeSnippet);
    JMethod mainMethod = findMainMethod(program);
    visitor.accept(mainMethod);
    return new Result("void", codeSnippet, mainMethod.getBody().toSource());
  }
View Full Code Here

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

      this.userCode = userCode;
      this.optimized = optimized;
    }

    public void into(String expected) throws UnableToCompleteException {
      JProgram program = compileSnippet(returnType, expected);
      expected = getMainMethodSource(program);
      assertEquals(userCode, expected, optimized);
    }
View Full Code Here

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

    return x;
  }

  private void createSampleProgram(MinimalRebuildCache minimalRebuildCache) {
    // Make the program itself
    program = new JProgram(minimalRebuildCache);
    typeOracle = program.typeOracle;
    synthSource = SourceOrigin.UNKNOWN;

    classObject = createClass("java.lang.Object", null, false, false);
    classString = createClass("java.lang.String", classObject, false, true);
View Full Code Here

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

  }

  public void testBuildLocalRuntimeRebindRules() throws UnableToCompleteException {
    // Sets up environment.
    Set<String> allRootTypes = Sets.newHashSet();
    compiler.jprogram = new JProgram(new MinimalRebuildCache());
    Map<String, String> runtimeRebindRuleSourcesByShortName =
        RuntimeRebindRuleGenerator.RUNTIME_REBIND_RULE_SOURCES_BY_SHORT_NAME;
    Rules rules = new Rules();
    RuleFail ruleFail = new RuleFail();
    ruleFail.getRootCondition().getConditions().add(new ConditionWhenPropertyIs("foo", "bar"));
View Full Code Here

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

    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Vanilla");
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Chocolate");
    ConfigurationProperty emulateStackProperty =
        properties.createConfiguration("emulateStack", false);
    emulateStackProperty.setValue("TRUE");
    compiler.jprogram = new JProgram(new MinimalRebuildCache());

    // Builds property provider classes and a property provider registrator to register them.
    precompiler.buildPropertyProviderRegistrator(allRootTypes,
        Sets.newTreeSet(Lists.newArrayList(userAgentProperty, flavorProperty)),
        Sets.newTreeSet(Lists.newArrayList(emulateStackProperty)));
View Full Code Here

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

      }
    });
  }

  public void testBasic() throws UnableToCompleteException {
    JProgram program = compileSnippet("void", "test.Simple.FOO.toString();");

    JDeclaredType simple = findDeclaredType(program, "test.Simple");
    Set<JEnumField> enumFields = new HashSet<JEnumField>();
    for (JField field : simple.getFields()) {
      if (field instanceof JEnumField) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.