61 references to Constants
Microsoft.Interop.JavaScript.JSImportGenerator (61)
Analyzers\JSExportDiagnosticsAnalyzer.cs (1)
18protected override string AttributeMetadataName => Constants.JSExportAttribute;
Analyzers\JSImportDiagnosticsAnalyzer.cs (1)
18protected override string AttributeMetadataName => Constants.JSImportAttribute;
JSExportGenerator.cs (24)
34.ForAttributeWithMetadataName(Constants.JSExportAttribute, 91&& attr.AttributeClass.ToDisplayString() == Constants.JSExportAttribute) 119writer.WriteLine($"[{Constants.CompilerGeneratedAttributeGlobal}]"); 123writer.WriteLine($"[{Constants.ThreadStaticGlobal}]"); 126writer.WriteLine($"[{Constants.ModuleInitializerAttributeGlobal}, {Constants.DynamicDependencyAttributeGlobal}({Constants.DynamicallyAccessedMemberTypesGlobal}.PublicMethods | {Constants.DynamicallyAccessedMemberTypesGlobal}.NonPublicMethods, {CodeWriterHelpers.StringLiteral(GeneratedNamespace + "." + InitializerClass)}, {CodeWriterHelpers.StringLiteral(assemblyName)})]"); 140writer.WriteLine($"if (initialized || {Constants.OSArchitectureGlobal} != {Constants.ArchitectureWasmGlobal})"); 159new ReferenceTypeInfo(Constants.ExceptionGlobal, Constants.ExceptionGlobal), 160new JSMarshallingInfo(NoMarshallingInfo.Instance, new JSSimpleTypeInfo(KnownManagedType.Exception, Constants.ExceptionGlobal)) 165InstanceIdentifier = Constants.ArgumentException, 201string registration = $"{Constants.JSFunctionSignatureGlobal}.{Constants.BindCSFunctionMethod}({CodeWriterHelpers.StringLiteral(signature.QualifiedMethodName)}, {signature.TypesHash.ToString(CultureInfo.InvariantCulture)}, {signatures});"; 202string attribute = $"{Constants.DynamicDependencyAttributeGlobal}({CodeWriterHelpers.StringLiteral(signature.WrapperName)}, {CodeWriterHelpers.StringLiteral(signature.StubTypeFullName)}, {CodeWriterHelpers.StringLiteral(signature.AssemblyName)})"; 213writer.WriteLine($"[{Constants.DebuggerNonUserCodeAttribute}]"); 214writer.WriteLine($"internal static unsafe void {context.SignatureContext.WrapperName}({Constants.JSMarshalerArgumentGlobal}* {Constants.ArgumentsBuffer})"); 222writer.WriteLine($"[{Constants.DebuggerNonUserCodeAttribute}]"); 243writer.Write($"{Constants.ArgumentsBuffer}[{nativeArgument.NativeIndex + 2}], "); 245writer.Write(Constants.ArgumentsBuffer); 248writer.Write($", {Constants.ArgumentsBuffer} + 1");
JSImportGenerator.cs (19)
38.ForAttributeWithMetadataName(Constants.JSImportAttribute, 91&& attr.AttributeClass.ToDisplayString() == Constants.JSImportAttribute) 125InstanceIdentifier = Constants.ArgumentException, 130InstanceIdentifier = Constants.ArgumentReturn, 180writer.WriteLine($"[{Constants.DebuggerNonUserCodeAttribute}]"); 181writer.WriteLine($"[{Constants.SupportedOSPlatformAttribute}({CodeWriterHelpers.StringLiteral(Constants.BrowserPlatform)})]"); 197writer.WriteLine($"static {Constants.JSFunctionSignatureGlobal} {context.SignatureContext.BindingName};"); 208writer.WriteLine($"{signature.BindingName} = {Constants.JSFunctionSignatureGlobal}.{Constants.BindJSFunctionMethod}({functionName}, {moduleName}, {signatures});"); 220writer.WriteLine($"[{Constants.DebuggerNonUserCodeAttribute}]"); 221writer.WriteLine($"{(hasReturn ? Constants.JSMarshalerArgumentGlobal : "void")} {functionName}{signature.ParameterList}"); 226writer.WriteLine($"{Constants.SpanGlobal}<{Constants.JSMarshalerArgumentGlobal}> {Constants.ArgumentsBuffer} = {arguments};"); 227writer.WriteLine($"{Constants.JSFunctionSignatureGlobal}.InvokeJS({signatureContext.BindingName}, {Constants.ArgumentsBuffer});"); 228writer.WriteLine($"return {Constants.ArgumentsBuffer}[1];"); 232writer.WriteLine($"{Constants.JSFunctionSignatureGlobal}.InvokeJS({signatureContext.BindingName}, {arguments});");
JSManagedTypeInfo.cs (7)
68case ITypeSymbol when fullTypeName == Constants.TaskGlobal: 70case INamedTypeSymbol { TypeArguments.Length: 1 } taskType when fullTypeName.StartsWith(Constants.TaskGlobal, StringComparison.Ordinal): 78case INamedTypeSymbol { TypeArguments.Length: 1 } spanType when fullTypeName.StartsWith(Constants.SpanGlobal, StringComparison.Ordinal): 86case INamedTypeSymbol { TypeArguments.Length: 1 } arraySegmentType when fullTypeName.StartsWith(Constants.ArraySegmentGlobal, StringComparison.Ordinal): 94case ITypeSymbol when fullTypeName == Constants.ActionGlobal: 96case INamedTypeSymbol actionType when fullTypeName.StartsWith(Constants.ActionGlobal, StringComparison.Ordinal): 107case INamedTypeSymbol funcType when fullTypeName.StartsWith(Constants.FuncGlobal, StringComparison.Ordinal):
JSMarshalAsAttributeInfoParser.cs (1)
19_jsMarshalAsAttribute = compilation.GetTypeByMetadataName(Constants.JSMarshalAsAttribute)!.ConstructUnboundGenericType();
Marshaling\BaseJSGenerator.cs (7)
10private static readonly ValueTypeInfo s_jsMarshalerArgument = new(Constants.JSMarshalerArgumentGlobal, Constants.JSMarshalerArgument, IsByRefLike: false); 44return marshalerType == MarshalerType.BigInt64 ? Constants.ToManagedBigMethod : Constants.ToManagedMethod; 49return marshalerType == MarshalerType.BigInt64 ? Constants.ToJSBigMethod : Constants.ToJSMethod; 62writer.WriteLine($"static (ref {Constants.JSMarshalerArgumentGlobal} {argumentIdentifier}, {modifier}{sourceType} {managedIdentifier}) =>");
SignatureBindingHelpers.cs (1)
40return Constants.JSMarshalerTypeGlobalDot + marshalerType;