Commit ff7d977a authored by Sebastian Biewer's avatar Sebastian Biewer

Fixes Redmine 260

parent 2d584b63
......@@ -789,6 +789,7 @@ class PCCConstructor
emit: ->
envName = @delegate.constructorGetName(@, @context)
variables = @delegate.constructorGetArguments(@, @compiler, @context)
hasEnvironment = @delegate.hasEnvironment()
@compiler.beginProcessGroup(new PCCGroupable(envName+"_cons"), variables)
entry = @compiler.getProcessFrame()
variables = (@compiler.getVariableWithNameOfClass(v.getName(), null, v.isInternal) for v in variables) # local variables
......@@ -797,13 +798,16 @@ class PCCConstructor
vars.unshift(@compiler.unprotectContainer()) for i in [0...envArgCount]
recursion = @delegate.constructorShouldCallRecursively?(@, @context)
control = null
control = @compiler.emitParallel() if recursion
@compiler.emitProcessApplication(envName, vars)
control = @compiler.emitParallel() if recursion and hasEnvironment
if hasEnvironment
@compiler.emitProcessApplication(envName, vars)
if recursion
control.setBranchFinished() if hasEnvironment
@delegate.constructorUpdateVariablesForRecursiveCall(@, @compiler, entry, variables, @context)
entry.emitCallProcessFromFrame(@compiler, @compiler.getProcessFrame())
control.setBranchFinished() if hasEnvironment
if not hasEnvironment and not recursion
PCCConstructor.emitConstructor = (compiler, delegate, context) -> (new PCCConstructor(compiler, delegate, context)).emit()
......@@ -44,8 +44,14 @@ class PCCGlobal extends PC.EnvironmentNode
class PCCClass extends PC.Class
constructor: ->
@_hasVariables = undefined
@addChild(new PCCInternalReadOnlyField(null, "guard", new PC.Type(PC.Type.LOCK), true)) if @isMonitor()
hasEnvironment: ->
if @_hasVariables == undefined
@_hasVariables = false
(@_hasVariables = true; break) for n of @variables
return @_hasVariables
getAllConditions: ->
result = []
for n, v of @variables
......@@ -73,10 +79,8 @@ class PCCClass extends PC.Class
@variables[names[names.length-1]].emitAccessors(compiler, variables, variables[0].getContainer(compiler))
emitConstructor: (compiler) ->
hasVariables = false
(hasVariables = true; break) for n of @variables
return if not hasVariables
if @hasEnvironment()
PCCConstructor.emitConstructor(compiler, @)
compiler.emitSystemProcessApplication(@getProcessName(), [new PCCConstantContainer(1)], PCCSysEnvironment)
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