Package com.github.sommeri.less4j.core.ast

Examples of com.github.sommeri.less4j.core.ast.Body


  }

  private List<ASTCssNode> compileBody(Body body, IScope scopeSnapshot) {
    semiCompiledNodes.push(body.getParent());
    try {
      Body bodyClone = body.clone();
      parentSolver.unsafeDoSolveReferences(bodyClone, scopeSnapshot);
      return bodyClone.getMembers();
    } finally {
      semiCompiledNodes.pop();
    }
  }
View Full Code Here


    astManipulator.removeFromBody(media);
    BodiesStorage bodiesStorage = new BodiesStorage();

    //move all kids of media into the empty clone. It is wasteful, they are going to be cloned but does not need to.
    Body oldBody = parentChainIterator.getParentAsBody();
    ASTCssNode currentNode = parentChainIterator.getCurrentNode();
    parentChainIterator.moveUpToNextBody();

    Body emptyClone = bodiesStorage.storeAndReplaceBySingleMemberClone(oldBody, null);
    astManipulator.moveMembersBetweenBodies(media.getBody(), emptyClone);

    while (!parentChainIterator.finished()) {
      //store current node and
      oldBody = parentChainIterator.getParentAsBody();
View Full Code Here

    bodyOwner.setBody(body);
    body.setParent((ASTCssNode) bodyOwner);
  }

  public Body storeAndReplaceBySingleMemberClone(Body body, ASTCssNode keepChild) {
    Body newBody = body.emptyClone();
    @SuppressWarnings("unchecked")
    BodyOwner<Body> bodyOwner = (BodyOwner<Body>) body.getParent();

    store(body, bodyOwner);
    replaceBody(bodyOwner, newBody);
View Full Code Here

    Iterator<BodyOwner<Body>> parentsIterator = originalBodiesParents.iterator();
    Iterator<ASTCssNode> keepChildsIterator = keepChilds.iterator();

    while (bodiesIterator.hasNext()) {
      BodyOwner<Body> bodyOwner = parentsIterator.next();
      Body body = bodiesIterator.next();
      ASTCssNode keepChild = keepChildsIterator.next();

      bodyOwner.getBody().setParent(null);
      replaceBody(bodyOwner, body);
      moveToBody(body, keepChild);
View Full Code Here

    ASTCssNode parent = node.getParent();
    if (!(parent instanceof Body)) {
      throw new BugHappened("Parent is not a body instance. " + parent, parent);
    }

    Body pBody = (Body) parent;
    pBody.removeMember(node);
    node.setParent(null);
  }
View Full Code Here

    ASTCssNode parent = oldNode.getParent();
    if (!(parent instanceof Body)) {
      throw new BugHappened("Parent is not a body instance. " + parent, parent);
    }

    Body pBody = (Body) parent;
    pBody.replaceMember(oldNode, newNode);
  }
View Full Code Here

    ASTCssNode parent = oldNode.getParent();
    if (!(parent instanceof Body)) {
      throw new BugHappened("Parent is not a body instance. " + parent, parent);
    }

    Body pBody = (Body) parent;
    pBody.replaceMember(oldNode, newNodes);
  }
View Full Code Here

    ASTCssNode parent = afterNode.getParent();
    if (!(parent instanceof Body)) {
      throw new BugHappened("Parent is not a body instance. " + parent, parent);
    }

    Body pBody = (Body) parent;
    pBody.addMemberAfter(newNode, afterNode);
    newNode.setParent(parent);
  }
View Full Code Here

    ASTCssNode parent = afterNode.getParent();
    if (!(parent instanceof Body)) {
      throw new BugHappened("Parent is not a body instance. " + parent, parent);
    }

    Body pBody = (Body) parent;
    pBody.addMembersAfter(newNodes, afterNode);
    for (ASTCssNode newNode : newNodes) {
      newNode.setParent(pBody);
    }
  }
View Full Code Here

TOP

Related Classes of com.github.sommeri.less4j.core.ast.Body

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.