Beispiel #1
0
        protected virtual bool ExecutePerInterface(InterfaceWithAttributeResult a)
        {
            // Load Macro
            var macroname = GetMacroName(a.TypeName, a.Attribute, out var args, out var outputname);
            var macro     = MacroFactory.GetMacro <MacroTypeVariables>(macroname, a.FsPath, out var errores);

            // Check for errors in macro
            if (macro == null)
            {
                OutputEngine.LogConsoleErrorWrite($"{a.TypeName} : {macroname}");
                foreach (var e in errores)
                {
                    OutputEngine.LogConsoleErrorWrite(e);
                }
                return(false);
            }

            // Execute macro
            var refinterface = args[0].StartsWith("I") ? args[0] : "";
            var refdata      = Engine.GetRecordForSymbol(refinterface);
            var variables    = CreateVariables(a, outputname, a.AttributeList, refdata);
            var res          = macro.Execute(variables, out var error);

            // Check for errors
            if (!res)
            {
                OutputEngine.LogConsoleErrorWrite(error);
            }

            // Write Results

            CurrentProject.WriteResults(variables);
            return(res);
        }
Beispiel #2
0
        protected virtual bool ExecutePerInterface(InterfaceWithAttributeResult a)
        {
            var walker2 = new ClassImplementsInterfaceWalker(Engine, a.TypeName);
            // Visit syntaxtrees

            var sts = Engine.GetSyntaxTrees(Files);

            foreach (var st in sts)
            {
                walker2.Visit(st);
            }
            foreach (var cl in walker2.Results)
            {
                if (!ExecutePerClass(cl, a))
                {
                    return(false); // Return if error on macro compilation
                }
            }

            return(true);
        }