예제 #1
0
        private static void AddDeclarationsFromAssignments(Block block, Scope scope)
        {
            var variables = block.Expressions.OfType<Assign>().Select(assign => assign.Variable as Value).Where(v => !v.HasProperties);

            foreach (var name in CompileToNames(variables))
                scope.GetOrCreate(VariableType.Variable, name);
        }
예제 #2
0
 public static Expression CompileBlock(Block node, Scope scope)
 {
     var expressions = node.Expressions.Select(expression => Compile(expression, scope)).ToArray();
     var variables = scope.DeclaredVariables;
     return Expression.Block(variables, expressions);
 }