protected void verifyVariableModifiers(VariableNode v) { ModifiersSet modifiersSet = v.getModifiers(); if (modifiersSet == null) return; ASModifier[] modifiers = modifiersSet.getAllModifiers(); IExpressionNode site = v.getNameExpressionNode(); for (ASModifier modifier : modifiers) { if (modifier == ASModifier.NATIVE) { classScope.addProblem(new NativeVariableProblem(site)); } else if (modifier == ASModifier.DYNAMIC) { classScope.addProblem(new DynamicNotOnClassProblem(site)); } else if (modifier == ASModifier.FINAL) { classScope.addProblem(new FinalOutsideClassProblem(site)); } else if (modifier == ASModifier.OVERRIDE) { classScope.addProblem(new InvalidOverrideProblem(site)); } else if (modifier == ASModifier.VIRTUAL) { classScope.addProblem(new VirtualOutsideClassProblem(site)); } } classScope.getMethodBodySemanticChecker().checkForDuplicateModifiers(v); }
protected void verifyFunctionModifiers(FunctionNode f) { ModifiersSet modifiersSet = f.getModifiers(); if (modifiersSet == null) return; IExpressionNode site = f.getNameExpressionNode(); if (modifiersSet.hasModifier(ASModifier.STATIC)) { if (modifiersSet.hasModifier(ASModifier.FINAL)) { classScope.addProblem(new FinalOutsideClassProblem(site)); } if (modifiersSet.hasModifier(ASModifier.OVERRIDE)) { classScope.addProblem(new StaticAndOverrideProblem(site)); } if (modifiersSet.hasModifier(ASModifier.DYNAMIC)) { classScope.addProblem(new DynamicNotOnClassProblem(site)); } if (modifiersSet.hasModifier(ASModifier.VIRTUAL)) { classScope.addProblem(new VirtualOutsideClassProblem(site)); } } classScope.getMethodBodySemanticChecker().checkForDuplicateModifiers(f); // Functions in a class allow all modifiers return; }