Example #1
0
File: Test.cs Project: alexrp/flare
 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"));
 }
Example #2
0
                public override void Visit(TestDeclarationNode node)
                {
                    var scope = PushFunctionScope();

                    base.Visit(node);

                    node.SetAnnotation("Freezes", scope.GetFreezes());

                    PopScope();
                }
Example #3
0
        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(),
                });
Example #4
0
 private protected Declaration(Module module, TestDeclarationNode node)
     : base(node.Attributes)
 {
     Module = module;
     Name   = node.NameToken.Text;
 }