本文整理汇总了C#中Boo.Lang.Compiler.CompilerContext类的典型用法代码示例。如果您正苦于以下问题:C# CompilerContext类的具体用法?C# CompilerContext怎么用?C# CompilerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerContext类属于Boo.Lang.Compiler命名空间,在下文中一共展示了CompilerContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:JackWangCUMT,项目名称:rhino-dsl,代码行数:29,代码来源:DslFactoryFixture.cs
示例2: GeneratorExpressionProcessor
public GeneratorExpressionProcessor(CompilerContext context,
ForeignReferenceCollector collector,
GeneratorExpression node)
{
_collector = collector;
_generator = node;
Initialize(context);
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:8,代码来源:GeneratorExpressionProcessor.cs
示例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));
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:8,代码来源:UtilitiesModule.cs
示例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();
}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:9,代码来源:BrailPreProcessorFixture.cs
示例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);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:10,代码来源:ProcessAssignmentToDuckMembers.cs
示例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);
}
开发者ID:boo,项目名称:boo-lang,代码行数:11,代码来源:GeneratorMethodProcessor.cs
示例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;
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:11,代码来源:BooCompiler.cs
示例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);
}
开发者ID:pshiryaev,项目名称:Boo-Plugin,代码行数:11,代码来源:CompilerManager.cs
示例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());
}
开发者ID:HaKDMoDz,项目名称:InVision,代码行数:24,代码来源:BooScript.cs
示例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"];
}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:38,代码来源:ExtensionsPreprocessor.cs
示例11: Initialize
override public void Initialize(CompilerContext context)
{
base.Initialize(context);
NameResolutionService.Reset();
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:5,代码来源:AbstractNamespaceSensitiveCompilerStep.cs
示例12: CompilationResult
public CompilationResult(CompilerContext context, BrailPreProcessor processor)
{
this.context = context;
this.processor = processor;
}
开发者ID:ralescano,项目名称:castle,代码行数:5,代码来源:BooViewEngine.cs
示例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);
开发者ID:Rfvgyhn,项目名称:boo,代码行数:30,代码来源:AbstractCompilerTestCase.cs
示例14: GetFirstInputName
}
string GetFirstInputName(CompilerContext context)
{
开发者ID:Rfvgyhn,项目名称:boo,代码行数:4,代码来源:AbstractCompilerTestCase.cs
示例15: OnAfter
protected override void OnAfter(CompilerContext context)
{
RunStep(context, new Boo.Lang.Compiler.Steps.PrintErrors());
}
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:AbstractCompilerErrorsTestFixture.cs
示例16: HasErrors
}
private bool HasErrors(CompilerContext context)
{
开发者ID:Rfvgyhn,项目名称:boo,代码行数:4,代码来源:AbstractCompilerTestCase.cs
示例17: LoadCompilerContext
private CompilerContext LoadCompilerContext(string file)
{
if (!File.Exists(file))
return null;
Assembly assembly = null;
ReadLock(delegate
{
if (assemblyCache.TryGetValue(file, out assembly) == false)
{
WriteLock(delegate
{
byte[] bytes = File.ReadAllBytes(file);
assembly = Assembly.Load(bytes);
assemblyCache[file] = assembly;
AssemblyLoaded(file, assembly, true);
});
}
});
CompilerContext context = new CompilerContext();
context.GeneratedAssembly = assembly;
return context;
}
开发者ID:nigthwatch,项目名称:rhino-dsl,代码行数:24,代码来源:DslCompilerContextCache.cs
示例18: CompilerStepEventArgs
public CompilerStepEventArgs(CompilerContext context, ICompilerStep step)
{
this.Context = context;
this.Step = step;
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:5,代码来源:CompilerPipeline.cs
示例19: AbstractAstGeneratorMacro
protected AbstractAstGeneratorMacro(CompilerContext context) : base (context)
{
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:3,代码来源:AbstractAstGeneratorMacro.cs
示例20: Run
public override void Run(CompilerContext context)
{
base.Run(context);
RunStep(context, new Boo.Lang.Compiler.Steps.PrintErrors());
}
开发者ID:w4x,项目名称:boolangstudio,代码行数:5,代码来源:AbstractCompilerErrorsTestFixture.cs
注:本文中的Boo.Lang.Compiler.CompilerContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论