Exemple #1
0
        public override LatteParser.TypeContext VisitENewObject(LatteParser.ENewObjectContext context)
        {
            switch (context.type())
            {
            case LatteParser.TTypeNameContext typeContext:
                if (!_environment.NameToClassDef.ContainsKey(typeContext.GetText()))
                {
                    _errorState.AddErrorMessage(new ErrorMessage(
                                                    context.start.Line,
                                                    ErrorMessages.ClassNotDefinedException(typeContext.GetText())));
                }
                break;

            default:
                _errorState.AddErrorMessage(new ErrorMessage(
                                                context.start.Line,
                                                ErrorMessages.IncorrectNewException));
                break;
            }

            return(context.type());
        }
Exemple #2
0
 public NewObject(LatteParser.ENewObjectContext context)
 {
     Type = context.type();
 }