本文整理汇总了C#中TypeSystem类的典型用法代码示例。如果您正苦于以下问题:C# TypeSystem类的具体用法?C# TypeSystem怎么用?C# TypeSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeSystem类属于命名空间,在下文中一共展示了TypeSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JintEngine
public JintEngine()
{
PermissionSet = new PermissionSet(PermissionState.None);
TypeSystem = new TypeSystem();
_runtime = new JintRuntime(this);
}
示例2: ReferenceImporter
public ReferenceImporter(TableStream tableStreamBuffer, SignatureComparer signatureComparer)
{
if (tableStreamBuffer == null)
throw new ArgumentNullException("tableStreamBuffer");
_tableStreamBuffer = tableStreamBuffer;
_signatureComparer = signatureComparer;
_typeSystem = tableStreamBuffer.StreamHeader.MetadataHeader.TypeSystem;
}
示例3: Interpreter
public Interpreter(TypeSystem typeSystem, MethodDefinition method)
{
this.ExternalMethods = new HashSet<MethodReference>();
this.StaticFieldsSet = new HashSet<FieldDefinition>();
this.typeSystem = typeSystem;
this.method = method;
this.typeEvaluator = new CodeTypeEvaluator(this.typeSystem, this.method);
}
示例4: Initialize
public void Initialize(TypeSystem system, ITypeSystemController controller)
{
TypeSystem = system;
Controller = controller;
Cache = new MetadataCache();
Loader = new MetadataLoader(this);
Resolver = new MetadataResolver(this);
}
示例5: Checker
internal Checker(ErrorHandler errorHandler, TypeSystem typeSystem, TrivialHashtable scopeFor, // LJW: added scopeFor
TrivialHashtable ambiguousTypes, TrivialHashtable referencedLabels)
: base(errorHandler, typeSystem, scopeFor, ambiguousTypes, referencedLabels)
{
this.validChooses = new Hashtable();
this.validMethodCalls = new Hashtable();
this.validSetOperations = new Hashtable();
this.validSelfAccess = new Hashtable();
}
示例6: Init
protected override void Init(TypeSystem t, Node node, bool interProcedural, bool fixpoint, int maxDepth)
{
base.Init(t, node, interProcedural, fixpoint, maxDepth);
factory = new ConsistentyElementFactory(this);
if (ContractDeserializerContainer.ContractDeserializer == null)
{
IContractDeserializer cd = new Omni.Parser.ContractDeserializer();
ContractDeserializerContainer.ContractDeserializer = cd;
}
}
示例7: GetDefaultValueExpression
public static Expression GetDefaultValueExpression(this TypeReference typeReference, TypeSystem typeSystem)
{
if (typeReference.IsPrimitive)
{
string typeName = typeReference.FullName;
switch (typeName)
{
case "System.Boolean":
{
return new LiteralExpression(false, typeSystem, null);
}
case "System.Char":
{
return new LiteralExpression((char)0, typeSystem, null);
}
case "System.IntPtr":
{
return new DefaultObjectExpression(typeReference, null);
}
default:
{
return new LiteralExpression(Activator.CreateInstance(Type.GetType(typeName)), typeSystem, null);
}
}
}
if (typeReference.IsGenericParameter)
{
return new DefaultObjectExpression(typeReference, null);
}
if (typeReference.IsArray)
{
//return GetLiteralExpression(typeReference.GetElementType(), typeSystem);
return new LiteralExpression(null, typeSystem, null);
}
if (typeReference.IsValueType)
{
var typeDefinition = typeReference.Resolve();
if (typeDefinition != null && typeDefinition.IsEnum)
{
return new LiteralExpression(0, typeSystem, null);
}
else
{
return new ObjectCreationExpression(typeReference.GetEmptyConstructorReference(), typeReference, null, null);
}
}
if (typeReference.IsRequiredModifier)
{
RequiredModifierType typeReferenceAsReqMod = typeReference as RequiredModifierType;
return typeReferenceAsReqMod.ElementType.GetDefaultValueExpression(typeSystem);
}
return new LiteralExpression(null, typeSystem, null);
}
示例8: Normalizer
public Normalizer(TypeSystem typeSystem){
this.typeSystem = typeSystem;
this.exitTargets = new StatementList();
this.continueTargets = new StatementList();
this.currentTryStatements = new Stack();
this.exceptionBlockFor = new TrivialHashtable();
this.visitedCompleteTypes = new TrivialHashtable();
this.EndIfLabel = new TrivialHashtable();
this.foreachLength = 7;
this.WrapToBlockExpression = true;
this.useGenerics = TargetPlatform.UseGenerics;
}
示例9: Checker
public Checker(ErrorHandler errorHandler, TypeSystem typeSystem, TrivialHashtable scopeFor, TrivialHashtable ambiguousTypes, TrivialHashtable referencedLabels)
: base(errorHandler) {
this.typeSystem = typeSystem;
this.Errors = errorHandler == null ? null : errorHandler.Errors;
this.scopeFor = scopeFor;
this.ambiguousTypes = ambiguousTypes;
this.referencedLabels = referencedLabels;
this.MayNotReferenceThisFromFieldInitializer = true;
this.allowedExceptions = new TypeNodeList();
this.useGenerics = TargetPlatform.UseGenerics;
this.AllowPropertiesIndexersAsRef = true;
}
示例10: Analyzer
public Analyzer(TypeSystem t, Compilation c)
: base(t, c)
{
if (c != null)
{
SpecSharpCompilerOptions ssco = c.CompilerParameters as SpecSharpCompilerOptions;
if (ssco != null)
{
if (ssco.Compatibility)
this.NonNullChecking = false; // i.e., turn it off if we need to be compatible
this.WeakPurityAnalysis = ssco.CheckPurity;
// Diego said it is important that the same instance of the purity analysis is used across all
// methods in the compilation unit. So create it here and just call it for each method in
// the override for language specific analysis.
// PointsToAnalysis.verbose = true;
if (this.WeakPurityAnalysis)
{
// InterProcedural bottom up traversal with fixpoint
//this.WeakPurityAnalyzer = new WeakPurityAndWriteEffectsAnalysis(this,typeSystem, c,true,true);
// Only Intraprocedural (in this mode doesnot support delegates...)
//this.WeakPurityAnalyzer = new WeakPurityAndWriteEffectsAnalysis(this, typeSystem, c, false);
// Interprocedural top-down inlining simulation (with max-depth)
this.WeakPurityAnalyzer = new WeakPurityAndWriteEffectsAnalysis(this, typeSystem, c, true,false,2);
this.WeakPurityAnalyzer.StandAloneApp = false;
this.WeakPurityAnalyzer.BoogieMode = true;
}
/// Reentrancy ANALYSIS
this.ObjectExposureAnalysis = false;
ObjectConsistencyAnalysis.verbose = false;
if (ObjectExposureAnalysis)
{
this.ObjectExposureAnalyzer = new ObjectExposureAnalysis(this, typeSystem, c, true, false, 4);
}
this.ReentrancyAnalysis = false;
if (ReentrancyAnalysis)
{
this.ReentrancyAnalyzer = new ReentrancyAnalysis(this, typeSystem, c, true, false, 4);
}
}
}
}
示例11: AddProgramVerifierPlugin
public void AddProgramVerifierPlugin(TypeSystem typeSystem, Compilation compilation){
#if Exp
string boogieDir = System.Environment.GetEnvironmentVariable("BOOGIE");
if (boogieDir == null)
boogieDir = "C:\\boogie";
string boogiePlugin = boogieDir + "\\Binaries\\BoogiePlugin.dll";
string errorInfo = boogiePlugin + " (Set BOOGIE environment variable)";
#else
string codebase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
codebase = codebase.Replace("#", "%23");
Uri codebaseUri = new Uri(codebase);
Uri uri = new Uri(codebaseUri, "BoogiePlugin.dll");
string boogiePlugin = uri.LocalPath;
string errorInfo = boogiePlugin;
#endif
this.AddPlugin(boogiePlugin, "Microsoft.Boogie.BoogiePlugin", "Microsoft.Boogie.BoogiePlugin from assembly " + errorInfo, typeSystem, compilation);
}
示例12: Compile
private static object Compile(string script)
{
var program = JintEngine.ParseProgram(script);
if (program == null)
return JsUndefined.Instance;
var typeSystem = new TypeSystem();
var scriptBuilder = typeSystem.CreateScriptBuilder(null);
var bindingVisitor = new BindingVisitor(scriptBuilder);
program.Accept(bindingVisitor);
var boundProgram = bindingVisitor.Program;
var interpreter = new JsonInterpreter(new JintEngine().Global);
if (boundProgram.Body.Accept(interpreter))
return interpreter.Result;
return null;
}
示例13: Looker
public Looker(Scope scope, ErrorHandler errorHandler, TrivialHashtable scopeFor, TypeSystem typeSystem, TrivialHashtable ambiguousTypes, TrivialHashtable referencedLabels)
: base(errorHandler){
//TODO: verify that crucial system types have either been imported or defined by the Parser
this.scope = scope;
this.AddToAllScopes(this.scope);
this.scopeFor = scopeFor;
this.ambiguousTypes = ambiguousTypes;
this.referencedLabels = referencedLabels;
this.alreadyReported = new TrivialHashtable();
this.hasExplicitBaseClass = new TrivialHashtable();
this.typesToKeepUninstantiated = new TrivialHashtable();
this.UsedNamespaces = new UsedNamespaceList();
this.targetFor = new TrivialHashtable();
this.labelList = new IdentifierList();
this.AbstractSealedUsedAsType = Error.NotAType;
Debug.Assert(typeSystem != null);
this.typeSystem = typeSystem;
this.useGenerics = TargetPlatform.UseGenerics;
this.inMethodParameter = false;
this.inEventContext = false;
}
示例14: BuiltInTypes
public BuiltInTypes(TypeSystem typeSystem, MosaModule corlib)
{
Void = typeSystem.GetTypeByName(corlib, "System", "Void");
Boolean = typeSystem.GetTypeByName(corlib, "System", "Boolean");
Char = typeSystem.GetTypeByName(corlib, "System", "Char");
I1 = typeSystem.GetTypeByName(corlib, "System", "SByte");
U1 = typeSystem.GetTypeByName(corlib, "System", "Byte");
I2 = typeSystem.GetTypeByName(corlib, "System", "Int16");
U2 = typeSystem.GetTypeByName(corlib, "System", "UInt16");
I4 = typeSystem.GetTypeByName(corlib, "System", "Int32");
U4 = typeSystem.GetTypeByName(corlib, "System", "UInt32");
I8 = typeSystem.GetTypeByName(corlib, "System", "Int64");
U8 = typeSystem.GetTypeByName(corlib, "System", "UInt64");
R4 = typeSystem.GetTypeByName(corlib, "System", "Single");
R8 = typeSystem.GetTypeByName(corlib, "System", "Double");
String = typeSystem.GetTypeByName(corlib, "System", "String");
Object = typeSystem.GetTypeByName(corlib, "System", "Object");
I = typeSystem.GetTypeByName(corlib, "System", "IntPtr");
U = typeSystem.GetTypeByName(corlib, "System", "UIntPtr");
TypedRef = typeSystem.GetTypeByName(corlib, "System", "TypedReference");
Pointer = Void.ToUnmanagedPointer();
}
示例15: EmitAssignedButNotReferencedErrors
public void EmitAssignedButNotReferencedErrors(TypeSystem ts) {
IWorkList wl = this.Variables;
while ( !wl.IsEmpty()) {
Variable v = (Variable)wl.Pull();
if (v is Local && v.Name != StandardIds.NewObj && ((RStatus)this.referenceStatus[v]) == RStatus.Assigned) {
ts.HandleError(v,Error.UnreferencedVarAssg,v.Name.Name);
}
}
}