-
Notifications
You must be signed in to change notification settings - Fork 114
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
Implement for(k,v in L)
syntax
#2241
base: master
Are you sure you want to change the base?
Conversation
Requires #2240 for CI to pass. |
Co-authored-by: wixoa <[email protected]>
Co-authored-by: wixoa <[email protected]>
Co-authored-by: wixoa <[email protected]>
Co-authored-by: wixoa <[email protected]>
Co-authored-by: wixoa <[email protected]>
var outputVal = state.GetReferenceValue(outputRef); | ||
state.GetReferenceValue(assocRef); | ||
var listVal = state.GetReferenceValue(listRef); | ||
var indexVal = state.GetIndex(listVal, outputVal, state); | ||
|
||
state.AssignReference(assocRef, indexVal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AssignReference()
needs done in the correct order same as GetReferenceValue()
. You're gonna need to reorder the opcode's arguments to have assocRef
last.
@@ -453,7 +453,60 @@ | |||
ProcessStatementVarDeclaration(new DMASTProcStatementVarDeclaration(statementFor.Location, decl.DeclPath, null, DMValueType.Anything)); | |||
} | |||
|
|||
if (statementFor.Expression2 != null || statementFor.Expression3 != null) { | |||
if (statementFor.Expression2 is DMASTExpressionIn dmastIn && statementFor.Expression3 is null) { |
Check notice
Code scanning / InspectCode
Merge null/pattern checks into complex pattern Note
@@ -598,16 +651,29 @@ | |||
proc.AddLabel(endLabel2); | |||
} else { | |||
DMReference outputRef = lValue.EmitReference(ExprContext, null); | |||
proc.Enumerate(outputRef); | |||
if (assocValue != null && list != null) { | |||
DMReference assocRef = assocValue.EmitReference(ExprContext, null); |
Check warning
Code scanning / InspectCode
Cannot convert null literal to non-nullable reference type. Warning
proc.Enumerate(outputRef); | ||
if (assocValue != null && list != null) { | ||
DMReference assocRef = assocValue.EmitReference(ExprContext, null); | ||
DMReference listRef = list.EmitReference(ExprContext, null); |
Check warning
Code scanning / InspectCode
Cannot convert null literal to non-nullable reference type. Warning
lValue = new BadLValue(outputAssocVar.Location); | ||
} | ||
|
||
LValue? outputValue = (LValue)outputAssocVar!; |
Check warning
Code scanning / InspectCode
Variable can be declared as non-nullable Warning
#2203
https://www.byond.com/docs/ref/#/proc/for/list