JsMode GetJsMode(ITypeDefinition ce) { var isGlobal = JMeta.IsGlobalType(ce); if (isGlobal) { return(JsMode.Global); } var isNative = JMeta.IsNativeType(ce); if (isNative) { return(JsMode.Prototype); } return(JsMode.Clr); }
private JTypeImporter GetTypeImporter(ITypeDefinition ce) { JTypeImporter export; var isExtJs = JMeta.IsExtJsType(ce); var isGlobal = JMeta.IsGlobalType(ce) && !isExtJs; var isNative = JMeta.IsNativeType(ce) && !isExtJs; isNative = true; isGlobal = false; isExtJs = false; if (isGlobal) { throw new NotSupportedException(); } else if (isNative) { if (NativeExport == null) { NativeExport = new JTypeImporter { Compiler = Compiler } } ; export = NativeExport; } else if (isExtJs) { throw new NotSupportedException(); } else { throw new NotSupportedException(); } ConfigureTypeExport(export); return(export); }
/// <summary> /// Returns base type of a type, only if base type is Clr or Prototype /// </summary> /// <param name="ce"></param> /// <returns></returns> protected virtual IType GetBaseClassIfValid(ITypeDefinition ce, bool recursive) { var baseClass = ce.GetBaseType(); while (baseClass != null) { if (JMeta.IsClrType(baseClass.GetDefinition()) || (JMeta.IsNativeType(baseClass.GetDefinition()) && !JMeta.IsGlobalType(baseClass.GetDefinition())) || !recursive) { return(baseClass); } baseClass = baseClass.GetBaseType(); } return(null); }