Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: codewriter-packages/UniMob
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.3.1
Choose a base ref
...
head repository: codewriter-packages/UniMob
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.3.2
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 17, 2023

  1. Copy the full SHA
    10b11e3 View commit details
  2. Up version 2.3.2

    vanifatovvlad authored Mar 17, 2023
    Copy the full SHA
    15b59d3 View commit details
Showing with 2 additions and 40 deletions.
  1. +1 −39 CodeGen/AtomWeaverV2.cs
  2. +1 −1 package.json
40 changes: 1 addition & 39 deletions CodeGen/AtomWeaverV2.cs
Original file line number Diff line number Diff line change
@@ -185,11 +185,9 @@ private struct AtomGetterMethodWeaver
private PropertyDefinition _property;

private string _atomDebugName;
private VariableDefinition _resultVariable;

private Instruction _nullCheckEndInstruction;
private Instruction _directEvalEndInstruction;
private Instruction _loadResultInstruction;

private MethodReference _atomCreateMethod;
private MethodReference _atomPullCtorMethod;
@@ -207,22 +205,16 @@ public AtomGetterMethodWeaver(AtomWeaverV2 weaver, PropertyDefinition property,
_atomDebugName = weaver._generateDebugNames
? $"{property.DeclaringType.FullName}::{property.Name}"
: null;
_resultVariable = new VariableDefinition(property.PropertyType);

_nullCheckEndInstruction = Instruction.Create(OpCodes.Nop);
_directEvalEndInstruction = Instruction.Create(OpCodes.Nop);
_loadResultInstruction = Instruction.Create(OpCodes.Ldloc, _resultVariable);

var propertyType = property.PropertyType;
_atomCreateMethod = Helpers.MakeGenericMethod(weaver._atomCreateMethod, propertyType);
_atomPullCtorMethod = Helpers.MakeHostInstanceGeneric(weaver._atomPullCtorMethod, propertyType);
_tryEnterMethod = Helpers.MakeHostInstanceGeneric(weaver._atomDirectEvalMethod, propertyType);
_atomGetMethod = Helpers.MakeHostInstanceGeneric(weaver._atomGetValueMethod, propertyType);
_throwIfDisposedMethod = weaver._throwIfDisposedMethod;

var body = property.GetMethod.Body;
body.InitLocals = true;
body.Variables.Add(_resultVariable);
}

public void Weave()
@@ -233,22 +225,6 @@ public void Weave()

Prepend(ref index, instructions);

while (index < instructions.Count)
{
var current = instructions[index++];
if (current.OpCode != OpCodes.Ret)
{
continue;
}

current.OpCode = OpCodes.Nop;
current.Operand = null;

ReplaceReturn(ref index, instructions);
}

Append(ref index, instructions);

body.OptimizeMacros();
}

@@ -300,24 +276,10 @@ private void Prepend(ref int ind, IList<Instruction> il)
il.Insert(ind++, Instruction.Create(OpCodes.Ldarg_0));
il.Insert(ind++, Instruction.Create(OpCodes.Ldfld, _atomField));
il.Insert(ind++, Instruction.Create(OpCodes.Callvirt, _atomGetMethod));
il.Insert(ind++, Instruction.Create(OpCodes.Stloc, _resultVariable));
il.Insert(ind++, Instruction.Create(OpCodes.Br, _loadResultInstruction));
il.Insert(ind++, Instruction.Create(OpCodes.Ret));

il.Insert(ind++, _directEvalEndInstruction);
}

private void ReplaceReturn(ref int ind, IList<Instruction> il)
{
il.Insert(ind++, Instruction.Create(OpCodes.Nop));
il.Insert(ind++, Instruction.Create(OpCodes.Stloc, _resultVariable));
il.Insert(ind++, Instruction.Create(OpCodes.Br, _loadResultInstruction));
}

private void Append(ref int index, IList<Instruction> il)
{
il.Insert(index++, _loadResultInstruction);
il.Insert(index++, Instruction.Create(OpCodes.Ret));
}
}

private struct AtomSetterMethodWeaver
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "com.codewriter.unimob",
"displayName": "UniMob",
"description": "Reactive state management for Unity",
"version": "2.3.1",
"version": "2.3.2",
"unity": "2019.3",
"license": "MIT",
"keywords": [