本文整理汇总了C#中Boo.Lang.Compiler.CompilerContext类的典型用法代码示例。如果您正苦于以下问题:C# CompilerContext类的具体用法?C# CompilerContext怎么用?C# CompilerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerContext类属于Boo.Lang.Compiler命名空间,在下文中一共展示了CompilerContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DslFactoryFixture
public DslFactoryFixture()
{
factory = new DslFactory();
mocks = new MockRepository();
mockedDslEngine = mocks.DynamicMock<DslEngine>();
mockCache = mocks.DynamicMock<IDslEngineCache>();
mockCache.WriteLock(null);
LastCall.Repeat.Any()
.IgnoreArguments()
.Do((Action<CacheAction>) ExecuteCachedAction);
mockCache.ReadLock(null);
LastCall.Repeat.Any()
.IgnoreArguments()
.Do((Action<CacheAction>)ExecuteCachedAction);
IDslEngineStorage mockStorage = mocks.DynamicMock<IDslEngineStorage>();
Assembly assembly = Assembly.GetCallingAssembly();
context = new CompilerContext();
context.GeneratedAssembly = assembly;
mockedDslEngine.Storage = mockStorage;
mockedDslEngine.Cache = mockCache;
SetupResult.For(mockStorage.GetMatchingUrlsIn("", ref testUrl)).Return(new string[] { testUrl });
SetupResult.For(mockStorage.IsUrlIncludeIn(null, null, null))
.IgnoreArguments()
.Return(true);
}
示例2: GeneratorExpressionProcessor
public GeneratorExpressionProcessor(CompilerContext context,
ForeignReferenceCollector collector,
GeneratorExpression node)
{
_collector = collector;
_generator = node;
Initialize(context);
}
示例3: GetScriptClass
public static ClassDefinition GetScriptClass(CompilerContext context)
{
object obj1 = context.get_Item("ScriptClass");
if (!(obj1 is ClassDefinition))
{
}
return (ClassDefinition) RuntimeServices.Coerce(obj1, typeof(ClassDefinition));
}
示例4: RunThroughPreProcessor
private static string RunThroughPreProcessor(string code)
{
var ppc = new BrailPreProcessor(new BooViewEngine());
var context = new CompilerContext();
context.Parameters.Input.Add(new StringInput("test", code));
ppc.Initialize(context);
ppc.Run();
return context.Parameters.Input[0].Open().ReadToEnd();
}
示例5: Initialize
public override void Initialize(CompilerContext context)
{
base.Initialize(context);
Type type = typeof(UnityRuntimeServices.MemberValueTypeChange);
this._valueTypeChangeConstructor = this.get_TypeSystemServices().Map(type.GetConstructors()[0]);
this._valueTypeChangeType = this.get_TypeSystemServices().Map(typeof(UnityRuntimeServices.ValueTypeChange));
Type type2 = typeof(UnityRuntimeServices.SliceValueTypeChange);
this._sliceValueTypeChangeConstructor = this.get_TypeSystemServices().Map(type2.GetConstructors()[0]);
this._propagateChanges = this.get_TypeSystemServices().Map(new __ProcessAssignmentToDuckMembers_Initialize$callable0$25_95__(UnityRuntimeServices.PropagateValueTypeChanges).Method);
}
示例6: GeneratorMethodProcessor
public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
{
_labels = new List();
_mapping = new Hashtable();
_generator = method;
_generatorItemType = (IType)_generator.Method["GeneratorItemType"];
_enumerable = (BooClassBuilder)_generator.Method["GeneratorClassBuilder"];
Debug.Assert(null != _generatorItemType);
Debug.Assert(null != _enumerable);
Initialize(context);
}
示例7: Run
public CompilerContext Run(CompileUnit compileUnit)
{
if (null == compileUnit)
throw new ArgumentNullException("compileUnit");
if (null == _parameters.Pipeline)
throw new InvalidOperationException(Boo.Lang.Resources.StringResources.BooC_CantRunWithoutPipeline);
var context = new CompilerContext(_parameters, compileUnit);
_parameters.Pipeline.Run(context);
return context;
}
示例8: MapParsedNodes
public static void MapParsedNodes(Dictionary<string, CompileResults> results, CompilerContext compilerContext)
{
foreach (var module in compilerContext.CompileUnit.Modules)
results[module.LexicalInfo.FileName].MapParsedNodes(module);
foreach (var error in compilerContext.Errors)
results[error.LexicalInfo.FileName].MapParsingMessage(error);
foreach (var warning in compilerContext.Warnings)
results[warning.LexicalInfo.FileName].MapParsingMessage(warning);
}
示例9: ThrowError
/// <summary>
/// Throws the error.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="context">The context.</param>
internal static void ThrowError(string filename, CompilerContext context)
{
var errors = new List<string>();
using (StreamWriter errorFile = File.CreateText(filename + ".errors")) {
foreach (CompilerError error in context.Errors) {
errorFile.WriteLine("= ERROR ========================================================================");
errorFile.WriteLine(error);
errorFile.WriteLine("================================================================================");
errorFile.WriteLine();
errors.Add(error.ToString());
}
errorFile.Flush();
}
throw new ScriptErrorException(filename, errors.ToArray());
}
示例10: getmacronamespaces
private IEnumerable<Tuple<Assembly,string >> getmacronamespaces(CompilerContext context) {
if (context["macronamespaces"] == null)
{
var macronamespaces = new List<Tuple<Assembly, string>>();
context["macronamespaces"] = macronamespaces;
foreach (ICompileUnit reference in context.References) {
try {
var a = reference.getPropertySafe<Assembly>("Assembly");
// импортирует автоматически макросы только из библиотек Comdiv - иначе жестокие тормоза и смысла главное никакого
if (a != null) {
var n = a.GetName().Name;
//HACK: due to performance issues uses only comdiv based libriries
if (!n.StartsWith("Comdiv.")) continue;
if (n.EndsWith(".Test")||n.EndsWith(".Tests")) continue;
var attrs = a.GetCustomAttributes(typeof(AssemblyBooMacroNamespaceAttribute), false);
if (attrs.Length != 0)
{
foreach (
string ns in
attrs.Cast<AssemblyBooMacroNamespaceAttribute>().Select(x => x.Namespace))
{
macronamespaces.Add(Tuple.Create(a, ns));
}
}
}
}
catch (Exception ex) {
context.TraceInfo("ошибка импорта пространства имен " + ex.Message);
}
}
}
return (IEnumerable<Tuple<Assembly, string>>) context["macronamespaces"];
}
示例11: Initialize
override public void Initialize(CompilerContext context)
{
base.Initialize(context);
NameResolutionService.Reset();
}
示例12: CompilationResult
public CompilationResult(CompilerContext context, BrailPreProcessor processor)
{
this.context = context;
this.processor = processor;
}
示例13: Run
}
protected string Run(string stdin, out CompilerContext context)
{
var oldStdOut = Console.Out;
var oldStdIn = Console.In;
try
{
Console.SetOut(_output);
if (stdin != null)
Console.SetIn(new StringReader(stdin));
context = _compiler.Run();
if (HasErrors(context) && !IgnoreErrors)
{
Assert.Fail(GetFirstInputName(context)
+ ": "
+ context.Errors.ToString(true)
+ context.Warnings);
}
return _output.ToString().Replace("\r\n", "\n");
}
finally
{
_output.GetStringBuilder().Length = 0;
Console.SetOut(oldStdOut);
Console.SetIn(oldStdIn);
示例14: GetFirstInputName
}
string GetFirstInputName(CompilerContext context)
{
示例15: OnAfter
protected override void OnAfter(CompilerContext context)
{
RunStep(context, new Boo.Lang.Compiler.Steps.PrintErrors());
}