ani-lang / anilang-core

Core functionality of Ani language.
Other
1 stars 0 forks source link

must be statementReturn instead of returnStatement #125

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

122

https://github.com/ani-lang/anilang-core/blob/8071b4f8192733afa9ac41e16dc0fbad87da7763/anilang-context/src/main/java/com/anilang/context/listener/TypeResolveListener.java#L103


        asType(rule, identifier, scope);
    }

    @Override
    public void enterFuncDeclaration(final AniParser.FuncDeclarationContext rule) {
        final AniParser.FuncReturnTypeDeclarationContext returnType =
            rule.funcReturnTypeDeclaration();
        if (returnType != null) {
            final String typeIdentifier = new TypeIdentifier(returnType.type()).toString();
            asType(
                rule,
                typeIdentifier,
                new LookupParentContext(
                    context,
                    typeIdentifier,
                    rule
                ).getScopeString().orElse("")
            );
        }
    }

    @Override
    public void enterReturnStatement(final AniParser.ReturnStatementContext rule) {
        // @checkstyle MethodBodyCommentsCheck (2 lines)
        // TODO must be statementReturn instead of returnStatement
        // #122
        if (rule.expression() != null) {
            new ResolveExpressionType(
                rule.expression()
            ).setType(
                this.context,
                rule.expression()
            );
        }
    }

    /**
     * Resolve the type.
     * TODO 01-03-23 this is duplicated