Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify object method scope and object field scope #25966

Merged

Conversation

rdhananjaya
Copy link
Member

Purpose

With this change, we can extract out object methods as standalone functions, the receiver will be stored as a closure variable.

class A {
    int i = 0;
    function foo(int i) returns int {
        returns self.i + i;
    }
}

A a = new();
function (int) returns int bar = a.foo;
int i = bar(1);

Fixes #25769

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@rdhananjaya rdhananjaya added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Sep 21, 2020
… into unify-obj-method-field-scopes

� Conflicts:
�	compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/bir/codegen/interop/JMethodResolver.java
… into unify-obj-method-field-scopes

� Conflicts:
�	language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/common/utils/FilterUtils.java
�	language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/signature/SignatureHelpUtil.java
�	tests/ballerina-compiler-api-test/src/test/java/io/ballerina/semantic/api/test/SymbolLookupTest.java
Copy link
Contributor

@hasithaa hasithaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@hasithaa hasithaa merged commit 6252d16 into ballerina-platform:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify method and field symbol spaces on objects
2 participants