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

comment for Expression #980

Merged
merged 40 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5709e36
update
chenzhitong Mar 4, 2024
0d8976b
Update BinaryExpression.cs
chenzhitong Mar 4, 2024
2134fb1
Update AnonymousObjectCreationExpression.cs
chenzhitong Mar 4, 2024
ceb138b
Update ElementExpression.cs
chenzhitong Mar 4, 2024
7f35bfc
Update CastExpression.cs
chenzhitong Mar 4, 2024
dec24ed
Update CastExpression.cs
chenzhitong Mar 4, 2024
9249d59
Update ConditionalAccessExpression.cs
chenzhitong Mar 4, 2024
3809a63
TernaryConditional & NullConditionalAccess
chenzhitong Mar 4, 2024
6b22cfe
revert rename
chenzhitong Mar 4, 2024
566af11
update ConvertCheckedExpression.cs
chenzhitong Mar 4, 2024
48671e5
Update IdentifierNameExpression.cs
chenzhitong Mar 4, 2024
443380b
Update ImplicitArrayCreationExpression.cs
chenzhitong Mar 5, 2024
e580b19
update InterpolatedStringExpression.cs
chenzhitong Mar 5, 2024
ff9e303
update
chenzhitong Mar 5, 2024
283ee84
Update SwitchExpression.cs
chenzhitong Mar 5, 2024
139cd1a
update
chenzhitong Mar 6, 2024
6c229be
Merge branch 'master' into comment2
shargon Mar 6, 2024
bdf62ef
update
chenzhitong Mar 7, 2024
5092117
Merge branch 'comment2' of https://github.com/chenzhitong/neo-devpack…
chenzhitong Mar 7, 2024
5e9077c
update
chenzhitong Mar 7, 2024
7f3fcd4
Merge branch 'master' into comment2
Jim8y Mar 7, 2024
ea2b666
add seealso
chenzhitong Mar 7, 2024
6f8fafe
Merge branch 'comment2' of https://github.com/chenzhitong/neo-devpack…
chenzhitong Mar 7, 2024
7c9ed32
update
chenzhitong Mar 7, 2024
5831fce
update
chenzhitong Mar 7, 2024
f2c27c2
ConvertMemberBindingExpression and ConvertElementBindingExpression
chenzhitong Mar 8, 2024
637c061
ConvertInitializerExpression
chenzhitong Mar 8, 2024
3ce867a
BaseExpression and ThisExpression
chenzhitong Mar 8, 2024
fb99b89
Create Contract_Logical.cs
chenzhitong Mar 8, 2024
c4027cd
Update Contract_Logical.cs
chenzhitong Mar 8, 2024
a57885b
format
chenzhitong Mar 8, 2024
aeb9abf
add ut
chenzhitong Mar 8, 2024
d922352
Update Contract_NULL.cs
chenzhitong Mar 8, 2024
1cc369d
throw
chenzhitong Mar 8, 2024
e08b74f
Merge branch 'master' into comment2
Jim8y Mar 8, 2024
1218f3d
Merge branch 'master' into comment2
Jim8y Mar 8, 2024
c6a9ab3
fix
chenzhitong Mar 8, 2024
ad70e85
Merge branch 'comment2' of https://github.com/chenzhitong/neo-devpack…
chenzhitong Mar 8, 2024
bbcd3e0
delegate
chenzhitong Mar 8, 2024
0b8358b
Update src/Neo.Compiler.CSharp/MethodConvert/Expression/AssignmentExp…
shargon Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ private void ConvertExpression(SemanticModel model, ExpressionSyntax syntax, Syn
case ImplicitArrayCreationExpressionSyntax expression:
ConvertImplicitArrayCreationExpression(model, expression);
break;
//TODO
//Converts an initialValue attribute
//Example: [InitialValue("NVg7LjGcUSrgxgjX3zEgqaksfMaiS8Z6e1"]
case InitializerExpressionSyntax expression:
ConvertInitializerExpression(model, expression);
break;
Expand All @@ -150,7 +151,8 @@ private void ConvertExpression(SemanticModel model, ExpressionSyntax syntax, Syn
case InterpolatedStringExpressionSyntax expression:
ConvertInterpolatedStringExpression(model, expression);
break;
//TODO
//Converts Invocation, include method invocation, event invocation and delegate invocation
//Example: Runtime.Log("hello");
case InvocationExpressionSyntax expression:
ConvertInvocationExpression(model, expression);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ namespace Neo.Compiler;

partial class MethodConvert
{
/// <summary>
/// Converts an InitialValue attribute into OpCodes.
/// </summary>
/// <param name="model">The semantic model providing context and information about InitialValue expression.</param>
/// <param name="expression">The syntax representation of the InitialValue expression statement being converted.</param>
/// <example>
/// Specifies an initial value for a static field within a smart contract,
/// Example of initializing a UInt160 field with a Hash160 address
/// <code>
/// [InitialValue("NVg7LjGcUSrgxgjX3zEgqaksfMaiS8Z6e1", ContractParameterType.Hash160)]
/// static readonly UInt160 Owner = default;
/// </code>
/// </example>
/// <seealso href="https://github.com/neo-project/neo-devpack-dotnet/blob/master/src/Neo.SmartContract.Framework/Attributes/InitialValueAttribute.cs">InitialValueAttribute</seealso>
private void ConvertInitializerExpression(SemanticModel model, InitializerExpressionSyntax expression)
{
IArrayTypeSymbol type = (IArrayTypeSymbol)model.GetTypeInfo(expression).ConvertedType!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ namespace Neo.Compiler;

partial class MethodConvert
{
/// <summary>
/// Converts Invocation, include method invocation, event invocation and delegate invocation to OpCodes.
/// </summary>
/// <param name="model">The semantic model providing context and information about invocation expression.</param>
/// <param name="expression">The syntax representation of the invocation expression statement being converted.</param>
private void ConvertInvocationExpression(SemanticModel model, InvocationExpressionSyntax expression)
{
ArgumentSyntax[] arguments = expression.ArgumentList.Arguments.ToArray();
Expand All @@ -39,6 +44,13 @@ private void ConvertInvocationExpression(SemanticModel model, InvocationExpressi
}
}

/// <summary>
/// Convert the event invocation expression to OpCodes.
/// </summary>
/// <param name="model">The semantic model providing context and information about event invocation expression.</param>
/// <param name="symbol">Symbol of the event</param>
/// <param name="arguments">Arguments of the event</param>
/// <example><see href="https://github.com/neo-project/neo-devpack-dotnet/blob/master/examples/Example.SmartContract.Event/Event.cs"/></example>
private void ConvertEventInvocationExpression(SemanticModel model, IEventSymbol symbol, ArgumentSyntax[] arguments)
{
AddInstruction(OpCode.NEWARRAY0);
Expand All @@ -52,6 +64,16 @@ private void ConvertEventInvocationExpression(SemanticModel model, IEventSymbol
Call(ApplicationEngine.System_Runtime_Notify);
}

/// <summary>
/// Convert the method invocation expression to OpCodes.
/// </summary>
/// <param name="model">The semantic model providing context and information about method invocation expression.</param>
/// <param name="symbol">Symbol of the method</param>
/// <param name="expression">The syntax representation of the method invocation expression statement being converted.</param>
/// <param name="arguments">Arguments of the method</param>
/// <example>
/// <c>Runtime.Log("hello World!");</c>
/// </example>
private void ConvertMethodInvocationExpression(SemanticModel model, IMethodSymbol symbol, ExpressionSyntax expression, ArgumentSyntax[] arguments)
{
switch (expression)
Expand All @@ -73,6 +95,15 @@ private void ConvertMethodInvocationExpression(SemanticModel model, IMethodSymbo
}
}

/// <summary>
/// Convert the delegate invocation expression to OpCodes.
/// </summary>
/// <param name="model">The semantic model providing context and information about delegate invocation expression.</param>
/// <param name="expression">The syntax representation of the delegate invocation expression statement being converted.</param>
/// <param name="arguments">Arguments of the delegate</param>
/// <example>
/// TODO
/// </example>
private void ConvertDelegateInvocationExpression(SemanticModel model, ExpressionSyntax expression, ArgumentSyntax[] arguments)
{
INamedTypeSymbol type = (INamedTypeSymbol)model.GetTypeInfo(expression).Type!;
Expand Down
Loading