Example #1
0
        /* (non-Javadoc)
         * @see br.ufrj.cos.lens.odyssey.tools.psw.parser.cst.CSTVisitor#visitDefOperationExpressionEnd(br.ufrj.cos.lens.odyssey.tools.psw.parser.cst.context.CSTDefOperationExpressionCS)
         */
        public override void visitDefOperationExpressionEnd(CSTDefOperationExpressionCS defOperationDeclaration)
        {
            Environment    currentEnvironment = (Environment)stackOfEnvironments.Peek();
            CSTOperationCS operation          = defOperationDeclaration.getOperationNodeCS();

            checkForWrongOperationName(operation.getNameNodeCS());

            string        operationName = operation.getNameNodeCS().ToString();
            List <object> paramTypes    = getParamTypesForOperation(operation, currentEnvironment, defOperationDeclaration);
            List <object> paramNames    = getParamNamesForOperation(operation, currentEnvironment, defOperationDeclaration);

            CoreClassifier returnType;

            if (operation.getTypeNodeCS() != null)
            {
                returnType = (CoreClassifier)operation.getTypeNodeCS().getAst();
            }
            else
            {
                returnType = null;
            }

            checkForOperationRedefinition(contextClassifier.lookupSameSignatureOperation(
                                              operationName, paramTypes, returnType), operation,
                                          contextClassifier.getName());

            contextClassifier.addDefinedOperation(defOperationDeclaration.getToken().getFilename(),
                                                  operationName, paramNames, paramTypes, returnType);
            constraintSourceTracker.addOwnerToSource(defOperationDeclaration.getToken().getFilename(), contextClassifier);

            stackOfEnvironments.Pop();
        }
Example #2
0
 /* (non-Javadoc)
  * @see br.ufrj.cos.lens.odyssey.tools.psw.parser.cst.CSTVisitor#visitDefOperationExpressionBegin(br.ufrj.cos.lens.odyssey.tools.psw.parser.cst.context.CSTDefOperationExpressionCS)
  */
 public override void visitDefOperationExpressionBegin(CSTDefOperationExpressionCS defOperationDeclaration)
 {
     base.visitDefOperationExpressionBegin(defOperationDeclaration);
 }