Skip to content

Conversation

@aeshanw-aelf
Copy link
Owner

@aeshanw-aelf aeshanw-aelf marked this pull request as ready for review October 5, 2023 07:05
@aeshanw-aelf aeshanw-aelf requested a review from gldeng October 5, 2023 07:05
@aeshanw-aelf aeshanw-aelf changed the base branch from 16221797_contract_base to master October 5, 2023 07:23

// Act: Call the GetClassName method
var comments = ProtoUtils.GetCsharpComments(file, true);
const string expectedComments = @"//
Copy link
Collaborator

Choose a reason for hiding this comment

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

This expected output doesn't seem right. We need to fix either the code or the test case.

Copy link
Owner Author

Choose a reason for hiding this comment

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

yeah I think ill fix the code (y). the spaces are too big.

@aeshanw-aelf aeshanw-aelf requested a review from gldeng October 6, 2023 03:47
@aeshanw-aelf
Copy link
Owner Author

I've removed the redundant line-breaks + extra-spaces. so the output comments look more compact. lemme know ur thoughts. thx!


/// <summary>
/// This Util GetCsharpComments gets/generates C# comments based on the proto. Copied from the C++ original
/// https://github.com/protocolbuffers/protobuf/blob/e57166b65a6d1d55fc7b18beaae000565f617f22/src/google/protobuf/compiler/csharp/csharp_helpers.cc#L255C35-L255C50
Copy link
Collaborator

Choose a reason for hiding this comment

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

URL is wrong.


/// <summary>
/// This Util gets the GetPrefixedComments based on the proto. Copied from the C++ original
/// https://github.com/protocolbuffers/protobuf/blob/e57166b65a6d1d55fc7b18beaae000565f617f22/src/google/protobuf/compiler/csharp/csharp_helpers.cc#L255C35-L255C50
Copy link
Collaborator

Choose a reason for hiding this comment

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

URL is wrong.

Comment on lines +84 to +88
// Actions (methods that modify contract state)
// Stores the value in contract state
// Views (methods that don't modify contract state)
// Get the value stored from contract state
// An event that will be emitted from contract method call
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are not file level comments. Is this output correct? It makes no sense to print out the comments for methods and messages like this.

Copy link
Owner Author

Choose a reason for hiding this comment

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

hmm these comments are present in the file tho i suppose it would be best to just print the top-level file-proto comments? i.e just // These are test header comments! based on the example below. wdyt?

syntax = "proto3";
// These are test header comments!
import "aelf/options.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
// The namespace of this class
option csharp_namespace = "AElf.Contracts.HelloWorld";

service HelloWorld {
    // The name of the state class the smart contract is going to use to access blockchain state
    option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState";

    // Actions (methods that modify contract state)
    // Stores the value in contract state
    rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty) {
    }

    // Views (methods that don't modify contract state)
    // Get the value stored from contract state
    rpc Read (google.protobuf.Empty) returns (google.protobuf.StringValue) {
        option (aelf.is_view) = true;
    }
}

// An event that will be emitted from contract method call
message UpdatedMessage {
    option (aelf.is_event) = true;
    string value = 1;
}

@aeshanw-aelf aeshanw-aelf requested a review from gldeng October 6, 2023 08:05
@gldeng gldeng changed the title [16225092] getCsharpComments Util method [OnHold] [16225092] getCsharpComments Util method Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants