本文整理汇总了C#中IErrorReporter类的典型用法代码示例。如果您正苦于以下问题:C# IErrorReporter类的具体用法?C# IErrorReporter怎么用?C# IErrorReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IErrorReporter类属于命名空间,在下文中一共展示了IErrorReporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DispatcherEngine
public DispatcherEngine(ISequenceEventSelector sequencedEventSelector, IErrorQueueLoader errorQueueLoader, IHandlerExecutor handlerExecutor, IErrorReporter errorReporter)
{
_sequencedEventSelector = sequencedEventSelector;
_errorQueueLoader = errorQueueLoader;
_handlerExecutor = handlerExecutor;
_errorReporter = errorReporter;
}
示例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);
}
}
}
示例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");
}
}
}
示例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)));
}
示例5: Lexer
public Lexer(IErrorReporter errorReporter, string source)
{
_errorReporter = errorReporter;
_source = source;
_reader = new CharReader(source);
_tokenRange = SourceRange.Empty;
}
示例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;
}
示例7: ScriptSharpRuntimeLibrary
public ScriptSharpRuntimeLibrary(IScriptSharpMetadataImporter metadataImporter, IErrorReporter errorReporter, Func<ITypeParameter, string> getTypeParameterName, Func<ITypeReference, JsExpression> createTypeReferenceExpression)
{
_metadataImporter = metadataImporter;
_errorReporter = errorReporter;
_getTypeParameterName = getTypeParameterName;
_createTypeReferenceExpression = createTypeReferenceExpression;
}
示例8: Compiler
public Compiler(IMetadataImporter metadataImporter, INamer namer, IRuntimeLibrary runtimeLibrary, IErrorReporter errorReporter)
{
_metadataImporter = metadataImporter;
_namer = namer;
_errorReporter = errorReporter;
_runtimeLibrary = runtimeLibrary;
}
示例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");
}
}
}
示例10: SymbolTableBuilder
public SymbolTableBuilder(Program node, IErrorReporter errorReporter)
{
_errorReporter = errorReporter;
_syntaxTree = node;
_globalScope = new GlobalScope();
_scopeStack = new Stack<IScope>();
}
示例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;
}
示例12: Compiler
public Compiler(IMetadataImporter metadataImporter, INamer namer, IRuntimeLibrary runtimeLibrary, IErrorReporter errorReporter, bool allowUserDefinedStructs)
{
_metadataImporter = metadataImporter;
_namer = namer;
_errorReporter = errorReporter;
_runtimeLibrary = runtimeLibrary;
_allowUserDefinedStructs = allowUserDefinedStructs;
}
示例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);
}
}
示例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);
}
示例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);
}