Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request company-projects/Meadow!50
  • Loading branch information
zone117x committed Oct 9, 2018
2 parents 085c5a7 + 48fdb1d commit 2c90cae
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/Meadow.CoverageReport/Debugging/ExecutionTraceAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,12 @@ private void ParseScopeTracepoint(int traceIndex, SourceMapEntry currentEntry, E
// Create a local variable
LocalVariable localVariable = new LocalVariable(parameter, true, stackIndex, currentEntry);

// If the name is blank, override it
if (string.IsNullOrEmpty(localVariable.Name))
{
localVariable.Name = $"<ReturnVariable{parameterIndex + 1}>";
}

// Add our local variable to our scope
currentScope.AddLocalVariable(localVariable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class BaseVariable
/// <summary>
/// The name of this variable.
/// </summary>
public string Name { get; private set; }
public string Name { get; set; }
/// <summary>
/// The AST node which describes the type for this variable.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public VarAddress(AstElementaryTypeName type) : base(type)
#region Functions
public override object ParseData(Memory<byte> data)
{
// If there is no data, return a zero address.
if (data.Length == 0)
// If there is insufficient data, return a zero address.
if (data.Length < Address.SIZE)
{
return new Address(new byte[Address.SIZE]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public VarArray(AstArrayTypeName type, VarLocation location) : base(type)
#region Functions
public override object ParseDereferencedFromMemory(Memory<byte> memory, int offset)
{
// Verify our bounds
if (offset >= memory.Length)
{
return Array.Empty<object>();
}

// Define our length.
int length = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public VarDynamicBytes(AstElementaryTypeName type, VarLocation location) : base(
#region Functions
public override object ParseDereferencedFromMemory(Memory<byte> memory, int offset)
{
// Verify our bounds
if (offset >= memory.Length)
{
return default(Memory<byte>);
}

// Dynamic memory is a WORD denoting length, followed by the length in bytes of data.

// Read a length bytes (size of word) to dereference the value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public VarFixedBytes(AstElementaryTypeName type) : base(type)
#region Functions
public override object ParseData(Memory<byte> data)
{
// If our data is not the correct size, return an empty array
if (data.Length < SizeBytes)
{
return default(Memory<byte>);
}

// Slice our data off.
return data.Slice(0, SizeBytes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public VarStruct(AstUserDefinedTypeName type, VarLocation location) : base(type)
#region Functions
public override object ParseDereferencedFromMemory(Memory<byte> memory, int offset)
{
// Verify our bounds
if (offset >= memory.Length)
{
return Array.Empty<VariableValuePair>();
}

// Create our result array
var results = new VariableValuePair[Members.Length];

Expand Down

0 comments on commit 2c90cae

Please sign in to comment.