protected IScope createLocalVarScopeForBlock( XBlockExpression block, int indexOfContextExpressionInBlock, boolean referredFromClosure, IScope parentScope) { List<IValidatedEObjectDescription> descriptions = Lists.newArrayList(); for (int i = 0; i < indexOfContextExpressionInBlock; i++) { XExpression expression = block.getExpressions().get(i); if (expression instanceof XVariableDeclaration) { XVariableDeclaration varDecl = (XVariableDeclaration) expression; if (varDecl.getName() != null) { IValidatedEObjectDescription desc = createLocalVarDescription(varDecl); if (referredFromClosure && varDecl.isWriteable()) desc.setIssueCode(IssueCodes.INVALID_MUTABLE_VARIABLE_ACCESS); descriptions.add(desc); } } } return new JvmFeatureScope(parentScope, "XBlockExpression", descriptions); }
protected IValidatedEObjectDescription createLocalVarDescription(XVariableDeclaration varDecl) { return new LocalVarDescription(QualifiedName.create(varDecl.getName()), varDecl); }