Пример #1
0
            public void AddForeignMethod(ForeignMethod fm, ExpandInterceptor expandInterceptor)
            {
                var jmtd = new JavaMethod(fm, _helpers, _convert, expandInterceptor, _environment);

                _methods.Add(jmtd);
                _blockHost.NativeJavaMethods.Add(jmtd.GenJavaEntrypointMethod(this));
            }
Пример #2
0
 public MacroContext(
     Function func,
     Namescope[] usings,
     ExpandInterceptor interceptor = null)
 {
     Function    = func;
     Usings      = usings;
     Interceptor = interceptor;
 }
Пример #3
0
 void EnsureInitialized()
 {
     if (!_initialized)
     {
         ExpandInterceptor    = new ExpandInterceptor(InterceptEntity);
         BoxedJavaObject      = ILFactory.GetType("Java.Object");
         _initialized         = true;
         Convert              = new Converters.Converter(BoxedJavaObject, Essentials, ILFactory, Helpers);
         BlockHost            = new Entrypoints(Environment, Disk, ILFactory, Convert);
         UnoToJavaBoxingClass = ILFactory.GetType("Uno.Compiler.ExportTargetInterop.Foreign.Android.JavaUnoObject");
     }
 }
Пример #4
0
 string GenJavaMethod(Function f, string javaMethodName, ExpandInterceptor expandInterceptor)
 {
     using (var tw = new StringWriter())
     {
         using (var ftw = new TextFormatter(tw))
         {
             // We have a special case here which is ugly
             //var returnType = f.ReturnType
             foreach (var annotation in _foreignMethod.Annotations)
             {
                 ftw.WriteLine("@" + annotation);
             }
             ftw.WriteLine("public static " + _convert.Type.UnoToJavaType(f.ReturnType, true) + " " + javaMethodName + "(" + _argsWithTypes + ")");
             ftw.Indent("{");
             ftw.WriteLines(_environment.Expand(f.Source, expandInterceptor, _helpers.GetForeignCodeFromFunction(f), false, f, _helpers.GetExternFunctionScopes(f)));
             ftw.Unindent("}");
             return(tw.ToString());
         }
     }
 }
Пример #5
0
 public JavaMethod(ForeignMethod fm, ForeignHelpers helpers, Converters.Converter convert, ExpandInterceptor expandInterceptor, IEnvironment env)
 {
     _convert       = convert;
     _helpers       = helpers;
     _environment   = env;
     _foreignMethod = fm;
     _argsWithTypes = JavaMethodArgs(fm.InitialUnoMethod);
     _argsNoTypes   = JavaMethodArgs(fm.InitialUnoMethod, false);
     Source         = GenJavaMethod(fm.InitialUnoMethod, fm.JavaName, expandInterceptor);
 }
Пример #6
0
 public string Expand(Source src, ExpandInterceptor intercept, string text, bool escape, Function context, params Namescope[] usings)
 {
     return(MacroExpander.ExpandMacrosAndDirectives(src, text, escape, context, usings, intercept));
 }