internal Test(Module module, TestDeclarationNode node) : base(module, node) { Tree = new TreeContext(module.Loader, this, ImmutableArray <TreeParameter> .Empty, null, ImmutableArray <TreeUpvalue> .Empty); _lowerer = new SyntaxTreeLowerer(module.Loader, Tree, node.Body, node.GetAnnotation <ImmutableHashSet <SyntaxSymbol> >("Freezes")); }
public override void Visit(TestDeclarationNode node) { var scope = PushFunctionScope(); base.Visit(node); node.SetAnnotation("Freezes", scope.GetFreezes()); PopScope(); }
internal Module(ModuleLoader loader, ModulePath path, ProgramNode node) : base(node.Attributes) { Loader = loader; Path = path; var decls = ImmutableArray <Declaration> .Empty; foreach (var decl in node.Declarations) { if (decl is UseDeclarationNode) { continue; } decls = decls.Add(decl switch { ConstantDeclarationNode c => (Declaration) new Constant(this, c), FunctionDeclarationNode f => new Function(this, f), ExternalDeclarationNode e => new External(this, e), TestDeclarationNode t => new Test(this, t), _ => throw DebugAssert.Unreachable(), });
private protected Declaration(Module module, TestDeclarationNode node) : base(node.Attributes) { Module = module; Name = node.NameToken.Text; }