lang: Add a for loop statement for iterating over a list
This adds a for statement which is used to iterate over a list with a body of statements. This is an important data transformation tool which should be used sparingly, but is important to have. An import statement inside of a for loop is not currently supported. We have a simple hack to detect the obvious cases, but more deeply nested scenarios probably won't be caught, and you'll get an obscure error message if you try to do this. This was incredibly challenging to get right, and it's all thanks to Sam for his brilliance. Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
This commit is contained in:
@@ -1240,6 +1240,8 @@ func (obj *Engine) Run(ctx context.Context) (reterr error) {
|
||||
}
|
||||
|
||||
fn := func(nodeCtx context.Context) (reterr error) {
|
||||
// NOTE: Comment out this defer to make
|
||||
// debugging a lot easier.
|
||||
defer func() {
|
||||
// catch programming errors
|
||||
if r := recover(); r != nil {
|
||||
|
||||
Reference in New Issue
Block a user