@@ -363,8 +363,9 @@ func ContainsInvalidStatements(
|
||||
return false
|
||||
}
|
||||
|
||||
func ContainsInvalidStatements(block: BlockStatement, invalids: [EvaluatableStatement.Type]) -> Bool {
|
||||
return block.statements.contains() { statement in
|
||||
func ContainsInvalidStatements(block: BlockStatement, invalids: [EvaluatableStatement.Type]) -> Bool
|
||||
{
|
||||
return block.statements.contains { statement in
|
||||
for es in invalids {
|
||||
if type(of: statement) == es {
|
||||
return true
|
||||
@@ -372,4 +373,4 @@ func ContainsInvalidStatements(block: BlockStatement, invalids: [EvaluatableStat
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ extension Control: CompilableDeclaration {
|
||||
apply = (apply_statement as! ApplyStatement)
|
||||
|
||||
// The apply is the last thing in a control declaration.
|
||||
break;
|
||||
break
|
||||
} else {
|
||||
return .Error(
|
||||
ErrorOnNode(node: currentChild, withError: "Uknown node type in control declaration"))
|
||||
@@ -603,7 +603,9 @@ extension Action: Compilable {
|
||||
|
||||
return .Ok(
|
||||
(
|
||||
Action(named: action_name, withParameters: action_parameters, withBody: (action_body as! BlockStatement)),
|
||||
Action(
|
||||
named: action_name, withParameters: action_parameters,
|
||||
withBody: (action_body as! BlockStatement)),
|
||||
current_context
|
||||
))
|
||||
}
|
||||
|
||||
@@ -247,8 +247,8 @@ extension ExpressionStatement: CompilableStatement {
|
||||
let expression_node = node.child(at: 0)!
|
||||
|
||||
return switch Expression.Compile(node: expression_node, withContext: context) {
|
||||
case .Ok(let expression): .Ok((ExpressionStatement(expression), context))
|
||||
case .Error(let e): .Error(e)
|
||||
case .Ok(let expression): .Ok((ExpressionStatement(expression), context))
|
||||
case .Error(let e): .Error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,8 @@ extension ApplyStatement: CompilableStatement {
|
||||
let expression_node = node.child(at: 1)!
|
||||
|
||||
return switch BlockStatement.Compile(node: expression_node, withContext: context) {
|
||||
case .Ok((let statement, let updated_context)): .Ok((ApplyStatement(statement as! BlockStatement), updated_context))
|
||||
case .Ok((let statement, let updated_context)):
|
||||
.Ok((ApplyStatement(statement as! BlockStatement), updated_context))
|
||||
case .Error(let e): .Error(e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user