Commit 75ea2d79 authored by Sebastian Biewer's avatar Sebastian Biewer

Fixed bug, thanks to Lena

parent ecdc74ef
# Change Log for PseuCo to CCS Compiler
##0.8.10 - 2020-06-09
### Fixed
- Send expressions with unbuffered channels could not be used as RHS expression of assignments. The container holding the sent value was not protected during transition to the followup process.
##0.8.9 - 2019-05-31
### Fixed
......
......@@ -133,7 +133,18 @@ class PCCCompiler # ToDo: Allow assigning a recently used program controller (
sysDefs.push(def)
procDefs[0].insertLinesBefore = 1 if procDefs.length > 0 and sysDefs.length > 0
mainAgentDefs[0].insertLinesBefore = 1 if mainAgentDefs.length > 0 and (procDefs.length > 0 or sysDefs.length > 0)
new CCS.CCS(sysDefs.concat(procDefs).concat(mainAgentDefs), @_getSystem())
allPdefs = sysDefs.concat(procDefs).concat(mainAgentDefs)
system = @_getSystem()
#@__dumpUncheckedCCS(allPdefs, system)
new CCS.CCS(allPdefs, system)
__dumpUncheckedCCS: (pdefs, system) ->
console.log('Dumping unchecked CCS.')
res = ''
(res += pd.toString() + "\n") for pd in pdefs
res += "\n#{system.toString()}"
console.log(res)
res
__assertEmptyGroupStack: ->
if @groupElements.length > 0
......
......@@ -154,7 +154,7 @@ PC.StartExpression::compile = (compiler) ->
PC.AssignExpression::compile = (compiler) ->
c = compiler.compile(@getExpression())
c = compiler.compile(@getExpression())
if @operator == "+="
c = new PCCBinaryContainer(compiler.compile(@getDestination()), c, "+")
else if @operator == "-="
......@@ -221,6 +221,7 @@ PC.SendExpression::compile = (compiler) ->
c = compiler.compile(@children[0])
v = compiler.compile(@children[1])
if @children[0].getType(compiler).capacity <= 0
compiler.protectContainer(v)
control = compiler.emitChoice()
compiler.emitCondition(new PCCBinaryContainer(c, new PCCConstantContainer(0), ">="))
compiler.emitOutput("put", c, v) # Buffered
......@@ -231,6 +232,7 @@ PC.SendExpression::compile = (compiler) ->
p2 = compiler.emitProcessApplicationPlaceholder()
control.setBranchFinished()
compiler.emitMergeOfProcessFramesOfPlaceholders([p1, p2])
v = compiler.unprotectContainer()
else
compiler.emitOutput("put", c, v) # Buffered
v
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment