Beispiel #1
0
  private JsExpression mapObjectLit(Node objLitNode) throws JsParserException {
    JsObjectLiteral toLit = new JsObjectLiteral();
    Node fromPropInit = objLitNode.getFirstChild();
    while (fromPropInit != null) {

      Node fromLabelExpr = fromPropInit;
      JsExpression toLabelExpr = mapExpression(fromLabelExpr);

      // Advance to the initializer expression.
      //
      fromPropInit = fromPropInit.getNext();
      Node fromValueExpr = fromPropInit;
      if (fromValueExpr == null) {
        throw createParserException("Expected an init expression for: " + toLabelExpr, objLitNode);
      }
      JsExpression toValueExpr = mapExpression(fromValueExpr);

      JsPropertyInitializer toPropInit = new JsPropertyInitializer(toLabelExpr, toValueExpr);
      toLit.getPropertyInitializers().add(toPropInit);

      // Begin the next property initializer, if there is one.
      //
      fromPropInit = fromPropInit.getNext();
    }

    return toLit;
  }
 @NotNull
 private JsObjectLiteral getClassesAndNestedNamespaces() {
   JsObjectLiteral classesAndNestedNamespaces = new JsObjectLiteral();
   classesAndNestedNamespaces.getPropertyInitializers().addAll(getClassesDefined());
   classesAndNestedNamespaces.getPropertyInitializers().addAll(getNestedNamespaceDeclarations());
   return classesAndNestedNamespaces;
 }
Beispiel #3
0
 @NotNull
 public List<JsPropertyInitializer> getMembers() {
   return membersObjectLiteral.getPropertyInitializers();
 }