@Override public boolean enterBlock(Block block) { handleDeclarations(); if (inNode.isStrict()) { if (getPath().size() > 0) { // we are in strict mode -> possible block scope declaration currentBlockScope = new DeclarationScopeImpl(currentBlockScope, currentBlockScope, new Identifier(BLOCK_OBJECT_NAME_PREFIX + block.getStart(), OffsetRange.NONE), new OffsetRange(block.getStart(), block.getFinish()), currentBlockScope.getMimeType() , currentBlockScope.getSourceLabel()); currentBlockScope.setJsKind(JsElement.Kind.BLOCK); } } isParameterBlock = block.isParameterBlock(); return super.enterBlock(block); }
treatAsAnonymous = block != null && block.isParameterBlock();
@Override public Node leaveBlock(Block block) { DeclarationScopeImpl currentScope = modelBuilder.getCurrentDeclarationScope(); if (currentScope.getJSKind() == JsElement.Kind.BLOCK && currentScope.getName().equals(BLOCK_OBJECT_NAME_PREFIX + block.getStart())) { // removing the block as declaration scope from modelBuilder.reset(); } return super.leaveBlock(block); }
@Override public boolean enterWithNode(WithNode withNode) { JsObjectImpl currentObject = modelBuilder.getCurrentObject(); Collection<TypeUsage> types = ModelUtils.resolveSemiTypeOfExpression(modelBuilder, withNode.getExpression()); JsWithObjectImpl withObject = new JsWithObjectImpl(currentObject, modelBuilder.getUnigueNameForWithObject(), types, new OffsetRange(withNode.getStart(), withNode.getFinish()), new OffsetRange(withNode.getExpression().getStart(), withNode.getExpression().getFinish()), modelBuilder.getCurrentWith(), parserResult.getSnapshot().getMimeType(), null); currentObject.addProperty(withObject.getName(), withObject); // withNode.getExpression().accept(this); // expression should be visted when the with object is the current object. modelBuilder.setCurrentObject(withObject); withNode.getBody().accept(this); modelBuilder.reset(); return false; }
if (node instanceof Block) { Block block = (Block)node; if (block.isParameterBlock() && oNode != null && bNode != null && bNode.lhs().equals(oNode) ) {
@Override public boolean enterBlock(Block block) { DeclarationScopeImpl blockScope = (DeclarationScopeImpl)modelBuilder.getCurrentDeclarationScope().getProperty(BLOCK_OBJECT_NAME_PREFIX + block.getStart()); if ( blockScope!= null) { // in this block there are a declarations that we are interested in. modelBuilder.setCurrentObject(blockScope); } return super.enterBlock(block); }
functionNode.getBody().accept(this);
if (parent instanceof JsFunctionImpl && lastVisited instanceof Block && ((Block)lastVisited).isParameterBlock()) {