本文整理汇总了C#中IErrorReporter类的典型用法代码示例。如果您正苦于以下问题:C# IErrorReporter类的具体用法?C# IErrorReporter怎么用?C# IErrorReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IErrorReporter类属于命名空间,在下文中一共展示了IErrorReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DispatcherEngine
public DispatcherEngine(ISequenceEventSelector sequencedEventSelector, IErrorQueueLoader errorQueueLoader, IHandlerExecutor handlerExecutor, IErrorReporter errorReporter)
{
_sequencedEventSelector = sequencedEventSelector;
_errorQueueLoader = errorQueueLoader;
_handlerExecutor = handlerExecutor;
_errorReporter = errorReporter;
}
开发者ID:brucewu16899,项目名称:lacjam,代码行数:7,代码来源:DispatcherEngine.cs
示例2: ApplyTo
public override void ApplyTo(IAssembly assembly, IAttributeStore attributeStore, IErrorReporter errorReporter) {
foreach (var t in assembly.GetAllTypeDefinitions()) {
if (!attributeStore.AttributesFor(t).HasAttribute<DefaultMemberReflectabilityAttribute>()) {
ApplyTo(t, attributeStore, errorReporter);
}
}
}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:7,代码来源:DefaultMemberReflectabilityAttribute.cs
示例3: MetadataImporter
public MetadataImporter(IErrorReporter errorReporter, ICompilation compilation, CompilerOptions options) {
_errorReporter = errorReporter;
_compilation = compilation;
_minimizeNames = options.MinimizeScript;
_systemObject = compilation.MainAssembly.Compilation.FindType(KnownTypeCode.Object);
_typeSemantics = new Dictionary<ITypeDefinition, TypeSemantics>();
_delegateSemantics = new Dictionary<ITypeDefinition, DelegateScriptSemantics>();
_instanceMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
_staticMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
_methodSemantics = new Dictionary<IMethod, MethodScriptSemantics>();
_propertySemantics = new Dictionary<IProperty, PropertyScriptSemantics>();
_fieldSemantics = new Dictionary<IField, FieldScriptSemantics>();
_eventSemantics = new Dictionary<IEvent, EventScriptSemantics>();
_constructorSemantics = new Dictionary<IMethod, ConstructorScriptSemantics>();
_propertyBackingFieldNames = new Dictionary<IProperty, string>();
_eventBackingFieldNames = new Dictionary<IEvent, string>();
_backingFieldCountPerType = new Dictionary<ITypeDefinition, int>();
_internalTypeCountPerAssemblyAndNamespace = new Dictionary<Tuple<IAssembly, string>, int>();
_ignoredMembers = new HashSet<IMember>();
var sna = compilation.MainAssembly.AssemblyAttributes.SingleOrDefault(a => a.AttributeType.FullName == typeof(ScriptNamespaceAttribute).FullName);
if (sna != null) {
var data = AttributeReader.ReadAttribute<ScriptNamespaceAttribute>(sna);
if (data.Name == null || (data.Name != "" && !data.Name.IsValidNestedJavaScriptIdentifier())) {
Message(Messages._7002, sna.Region, "assembly");
}
}
}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:28,代码来源:MetadataImporter.cs
示例4: Process
protected string Process(string source, string[] typeNames = null, string entryPoint = null, IEnumerable<IAssemblyResource> resources = null, IErrorReporter errorReporter = null) {
bool assertNoErrors = errorReporter == null;
errorReporter = errorReporter ?? new MockErrorReporter(true);
var sourceFile = new MockSourceFile("file.cs", source);
var n = new Namer();
var references = new[] { Files.Mscorlib };
var compilation = PreparedCompilation.CreateCompilation("x", new[] { sourceFile }, references, null, resources);
var md = new MetadataImporter(errorReporter, compilation.Compilation, new CompilerOptions());
var rtl = new RuntimeLibrary(md, errorReporter, compilation.Compilation, n);
var l = new MockLinker();
md.Prepare(compilation.Compilation.GetAllTypeDefinitions());
var compiler = new Compiler(md, n, rtl, errorReporter);
var compiledTypes = compiler.Compile(compilation).ToList();
var obj = new OOPEmulator(compilation.Compilation, md, rtl, n, l, errorReporter);
IMethod ep;
if (entryPoint != null) {
var type = compiledTypes.Single(c => c.CSharpTypeDefinition.FullName == entryPoint.Substring(0, entryPoint.IndexOf('.')));
ep = type.CSharpTypeDefinition.Methods.Single(m => m.FullName == entryPoint);
}
else {
ep = null;
}
var rewritten = obj.Process(compiledTypes.Where(t => typeNames == null || typeNames.Contains(t.CSharpTypeDefinition.FullName)), ep);
if (assertNoErrors)
Assert.That(((MockErrorReporter)errorReporter).AllMessages, Is.Empty, "Should not have errors");
return string.Join("", rewritten.Select(s => OutputFormatter.Format(s, allowIntermediates: true)));
}
开发者ID:n9,项目名称:SaltarelleCompiler,代码行数:29,代码来源:OOPEmulatorTestBase.cs
示例5: Lexer
public Lexer(IErrorReporter errorReporter, string source)
{
_errorReporter = errorReporter;
_source = source;
_reader = new CharReader(source);
_tokenRange = SourceRange.Empty;
}
开发者ID:chenzuo,项目名称:nquery,代码行数:7,代码来源:Lexer.cs
示例6: Generate
public override TypeDefinition Generate(IErrorReporter errorReporter)
{
var t = new TypeDefinition(
providedType.Namespace,
providedType.Name + Internal.Plugins.Codegen.CodegenPlugin.IProviderSuffix,
TypeAttributes.Public,
References.Binding);
var providerOfT = References.IProviderOfT.MakeGenericInstanceType(providedType);
t.Interfaces.Add(providerOfT);
t.CustomAttributes.Add(new CustomAttribute(References.CompilerGeneratedAttribute));
var providerOfT_get = ModuleDefinition.Import(providerOfT.Resolve()
.Methods
.First(m => m.Name == "Get"))
.MakeHostInstanceGeneric(providedType);
var providerKeyField = new FieldDefinition("providerKey", FieldAttributes.Private, References.String);
var mustBeInjectableField = new FieldDefinition("mustBeInjectable", FieldAttributes.Private, References.Boolean);
var delegateBindingField = new FieldDefinition("delegateBinding", FieldAttributes.Private, References.Binding);
t.Fields.Add(providerKeyField);
t.Fields.Add(mustBeInjectableField);
t.Fields.Add(delegateBindingField);
EmitCtor(t, providerKeyField, mustBeInjectableField);
EmitResolve(t, mustBeInjectableField, providerKeyField, delegateBindingField);
EmitGet(t, providerOfT_get, delegateBindingField);
return t;
}
开发者ID:paulcbetts,项目名称:stiletto,代码行数:32,代码来源:ProviderBindingGenerator.cs
示例7: ScriptSharpRuntimeLibrary
public ScriptSharpRuntimeLibrary(IScriptSharpMetadataImporter metadataImporter, IErrorReporter errorReporter, Func<ITypeParameter, string> getTypeParameterName, Func<ITypeReference, JsExpression> createTypeReferenceExpression)
{
_metadataImporter = metadataImporter;
_errorReporter = errorReporter;
_getTypeParameterName = getTypeParameterName;
_createTypeReferenceExpression = createTypeReferenceExpression;
}
开发者ID:koczkatamas,项目名称:SaltarelleCompiler,代码行数:7,代码来源:ScriptSharpRuntimeLibrary.cs
示例8: Compiler
public Compiler(IMetadataImporter metadataImporter, INamer namer, IRuntimeLibrary runtimeLibrary, IErrorReporter errorReporter)
{
_metadataImporter = metadataImporter;
_namer = namer;
_errorReporter = errorReporter;
_runtimeLibrary = runtimeLibrary;
}
开发者ID:jack128,项目名称:SaltarelleCompiler,代码行数:7,代码来源:Compiler.cs
示例9: MetadataImporter
public MetadataImporter(IErrorReporter errorReporter, ICompilation compilation, IAttributeStore attributeStore, CompilerOptions options) {
_errorReporter = errorReporter;
_compilation = compilation;
_attributeStore = attributeStore;
_minimizeNames = options.MinimizeScript;
_systemObject = compilation.MainAssembly.Compilation.FindType(KnownTypeCode.Object);
_typeSemantics = new Dictionary<ITypeDefinition, TypeSemantics>();
_delegateSemantics = new Dictionary<ITypeDefinition, DelegateScriptSemantics>();
_instanceMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
_staticMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>();
_methodSemantics = new Dictionary<IMethod, MethodScriptSemantics>();
_propertySemantics = new Dictionary<IProperty, PropertyScriptSemantics>();
_fieldSemantics = new Dictionary<IField, FieldScriptSemantics>();
_eventSemantics = new Dictionary<IEvent, EventScriptSemantics>();
_constructorSemantics = new Dictionary<IMethod, ConstructorScriptSemantics>();
_propertyBackingFieldNames = new Dictionary<IProperty, Tuple<string, bool>>();
_eventBackingFieldNames = new Dictionary<IEvent, Tuple<string, bool>>();
_backingFieldCountPerType = new Dictionary<ITypeDefinition, int>();
_internalTypeCountPerAssemblyAndNamespace = new Dictionary<Tuple<IAssembly, string>, int>();
_ignoredMembers = new HashSet<IMember>();
var sna = _attributeStore.AttributesFor(compilation.MainAssembly).GetAttribute<ScriptNamespaceAttribute>();
if (sna != null) {
if (sna.Name == null || (sna.Name != "" && !sna.Name.IsValidNestedJavaScriptIdentifier())) {
Message(Messages._7002, default(DomRegion), "assembly");
}
}
}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:28,代码来源:MetadataImporter.cs
示例10: SymbolTableBuilder
public SymbolTableBuilder(Program node, IErrorReporter errorReporter)
{
_errorReporter = errorReporter;
_syntaxTree = node;
_globalScope = new GlobalScope();
_scopeStack = new Stack<IScope>();
}
开发者ID:Lateks,项目名称:MiniJavaCompiler,代码行数:8,代码来源:SymbolTableBuilder.cs
示例11: SemanticsChecker
public SemanticsChecker(Program program, IErrorReporter errorReporter)
{
if (program.Scope == null)
throw new ArgumentException("Global scope is undefined.");
_programRoot = program;
_symbolTable = (GlobalScope)program.Scope;
_errors = errorReporter;
}
开发者ID:Lateks,项目名称:MiniJavaCompiler,代码行数:8,代码来源:SemanticsChecker.cs
示例12: Compiler
public Compiler(IMetadataImporter metadataImporter, INamer namer, IRuntimeLibrary runtimeLibrary, IErrorReporter errorReporter, bool allowUserDefinedStructs)
{
_metadataImporter = metadataImporter;
_namer = namer;
_errorReporter = errorReporter;
_runtimeLibrary = runtimeLibrary;
_allowUserDefinedStructs = allowUserDefinedStructs;
}
开发者ID:JimmyJune,项目名称:SaltarelleCompiler,代码行数:8,代码来源:Compiler.cs
示例13: Add
/// <summary>
/// Adds <paramref name="reporter"/> to the list of error reporters.
/// </summary>
/// <param name="reporter"></param>
/// <exception cref="ArgumentNullException"><paramref name="reporter"/> is <c>null</c>.</exception>
public void Add(IErrorReporter reporter)
{
lock (reporters)
{
foreach (var asm in reporter.AssembliesHandled)
reporters.Add (asm, reporter);
}
}
开发者ID:ermau,项目名称:Gablarski,代码行数:13,代码来源:AutomaticErrorReporter.cs
示例14: RuntimeLibrary
public RuntimeLibrary(IMetadataImporter metadataImporter, IErrorReporter errorReporter, ICompilation compilation, INamer namer) {
_metadataImporter = metadataImporter;
_errorReporter = errorReporter;
_compilation = compilation;
_namer = namer;
_omitDowncasts = MetadataUtils.OmitDowncasts(compilation);
_omitNullableChecks = MetadataUtils.OmitNullableChecks(compilation);
}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:8,代码来源:RuntimeLibrary.cs
示例15: CreateEmulator
protected OOPEmulator CreateEmulator(ICompilation compilation, IErrorReporter errorReporter = null) {
var n = new Namer();
errorReporter = errorReporter ?? new MockErrorReporter();
var md = new MetadataImporter(errorReporter, compilation, new CompilerOptions());
md.Prepare(compilation.GetAllTypeDefinitions());
var rtl = new RuntimeLibrary(md, errorReporter, compilation, n);
return new OOPEmulator(compilation, md, rtl, n, new MockLinker(), errorReporter);
}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:8,代码来源:OOPEmulatorTestBase.cs
示例16: ContextFactory
public ContextFactory(
IDataEnumeratorFactory dataEnumeratorFactory,
IRepositoryFactory repositoryFactory,
IErrorReporter errorReporter)
{
_dataEnumeratorFactory = dataEnumeratorFactory;
_repositoryFactory = repositoryFactory;
_errorReporter = errorReporter;
}
开发者ID:Bikeman868,项目名称:Prius,代码行数:9,代码来源:ContextFactory.cs
示例17: ConnectionFactory
public ConnectionFactory(
IErrorReporter errorReporter,
IDataEnumeratorFactory dataEnumeratorFactory,
IDataReaderFactory dataReaderFactory)
{
_errorReporter = errorReporter;
_dataEnumeratorFactory = dataEnumeratorFactory;
_dataReaderFactory = dataReaderFactory;
}
开发者ID:Bikeman868,项目名称:Prius,代码行数:9,代码来源:ConnectionFactory.cs
示例18: Resolver
public Resolver(IErrorReporter errorReporter, Scope scope)
: base(errorReporter)
{
_scope = scope;
// Needed for IntelliSense. This ensures
// That CurrentScope always returns a legal scope.
PushNewScope(null);
}
开发者ID:chenzuo,项目名称:nquery,代码行数:9,代码来源:Resolver.cs
示例19: MapSettings
private static CompilerSettings MapSettings(CompilerOptions options, string outputAssemblyPath, string outputDocFilePath, IErrorReporter er) {
var allPaths = options.AdditionalLibPaths.Concat(new[] { Environment.CurrentDirectory }).ToList();
var result = new CompilerSettings {
Target = (options.HasEntryPoint ? Target.Exe : Target.Library),
Platform = Platform.AnyCPU,
TargetExt = (options.HasEntryPoint ? ".exe" : ".dll"),
MainClass = options.EntryPointClass,
VerifyClsCompliance = false,
Optimize = false,
Version = LanguageVersion.V_5,
EnhancedWarnings = false,
LoadDefaultReferences = false,
TabSize = 1,
WarningsAreErrors = options.TreatWarningsAsErrors,
FatalCounter = 100,
WarningLevel = options.WarningLevel,
Encoding = Encoding.UTF8,
DocumentationFile = !string.IsNullOrEmpty(options.DocumentationFile) ? outputDocFilePath : null,
OutputFile = outputAssemblyPath,
AssemblyName = GetAssemblyName(options),
StdLib = false,
StdLibRuntimeVersion = RuntimeVersion.v4,
StrongNameKeyContainer = options.KeyContainer,
StrongNameKeyFile = options.KeyFile,
};
result.SourceFiles.AddRange(options.SourceFiles.Select((f, i) => new SourceFile(f, f, i + 1)));
foreach (var r in options.References) {
string resolvedPath = ResolveReference(r.Filename, allPaths, er);
if (r.Alias == null) {
if (!result.AssemblyReferences.Contains(resolvedPath))
result.AssemblyReferences.Add(resolvedPath);
}
else
result.AssemblyReferencesAliases.Add(Tuple.Create(r.Alias, resolvedPath));
}
foreach (var c in options.DefineConstants)
result.AddConditionalSymbol(c);
foreach (var w in options.DisabledWarnings)
result.SetIgnoreWarning(w);
foreach (var w in options.WarningsAsErrors)
result.AddWarningAsError(w);
foreach (var w in options.WarningsNotAsErrors)
result.AddWarningOnly(w);
if (options.EmbeddedResources.Count > 0)
result.Resources = options.EmbeddedResources.Select(r => new AssemblyResource(r.Filename, r.ResourceName, isPrivate: !r.IsPublic) { IsEmbeded = true }).ToList();
if (result.AssemblyReferencesAliases.Count > 0) { // NRefactory does currently not support reference aliases, this check will hopefully go away in the future.
er.Region = DomRegion.Empty;
er.Message(Messages._7998, "aliased reference");
}
return result;
}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:54,代码来源:CompilerDriver.cs
示例20: CompileMethod
protected void CompileMethod(string source, IMetadataImporter metadataImporter = null, INamer namer = null, IRuntimeLibrary runtimeLibrary = null, IErrorReporter errorReporter = null, string methodName = "M", bool addSkeleton = true, IEnumerable<IAssemblyReference> references = null, bool allowUserDefinedStructs = false) {
Compile(new[] { addSkeleton ? "using System; class C { " + source + "}" : source }, metadataImporter: metadataImporter, namer: namer, runtimeLibrary: runtimeLibrary, errorReporter: errorReporter, methodCompiled: (m, res, mc) => {
if (m.Name == methodName) {
Method = m;
MethodCompiler = mc;
CompiledMethod = res;
}
}, references: references, allowUserDefinedStructs: allowUserDefinedStructs);
Assert.That(Method, Is.Not.Null, "Method " + methodName + " was not compiled");
}
开发者ID:pdavis68,项目名称:SaltarelleCompiler,代码行数:11,代码来源:MethodCompilerTestBase.cs
注:本文中的IErrorReporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论