예제 #1
0
        public NativeTypeRef(IDeclarationContext parent, Type type, bool external = false, Type redirectbase = null)
            : base(parent, type)
        {
            if(null == type)
            {
                throw new ArgumentNullException("type");
            }

            if(external)
            {
                SetExternal();
            }

            if(type.IsSubclassOf(typeof(Delegate)))
            {
                _isdelegate = true;
            }
            else if (!type.IsValueType)
            {
                var rbase = redirectbase ?? type.BaseType;
                if (null != rbase)
                {
                    _lbase = parent.TranslateRType(rbase, TranslateOptions.Add);
                    //_typedependencies.Add(lbase);
                    AddDepdendency(_lbase, DependencyLevel.Constructor);

                    _isdelegate = _lbase.IsDelegate;
                }
            }

            parent.RegisterType(this);
        }
예제 #2
0
        public Class(IDeclarationContext parent, Type type)
            : base(parent, type)
        {
            // save the underlying runtime type
            _rtype = type;
            _thisvar = new Variable(this, "this", this);

            Parent.RegisterType(this);

            ExtractBaseType();
            ExtractNestedTypes();

            if (IsConstructed)
            {
                ExtractMembers();
            }
        }
예제 #3
0
 protected ItemBase(IDeclarationContext parent, Type rtype)
     : this(parent)
 {
     _rtype = rtype;
     _id = rtype.GetRName();
 }
예제 #4
0
 protected ItemBase(IDeclarationContext parent, string name)
     : this(parent)
 {
     _id = name;
 }
예제 #5
0
 private ItemBase(IDeclarationContext parent)
 {
     _parent = parent;
 }
예제 #6
0
 /// <summary>
 /// Creates a method context.
 /// </summary>
 /// <param name="dc">The declaration context on which to base the method context, must be a class.</param>
 /// <returns>The method context.</returns>
 public static IMethodContext CreateMethodContext(IDeclarationContext dc)
 {
     return new MethodContext(dc);
 }
예제 #7
0
 public GenericTypeRef(IDeclarationContext parent, ITypeItem generic, Type instance)
     : base(parent, instance.GetRName())
 {
     _ltype = generic;
     _rtype = instance;
 }
예제 #8
0
 public Constant(IDeclarationContext parent, ITypeItem type, object value)
     : base(parent, value.ToString())
 {
     _ltype = type;
 }
 private CSharpToJScriptRewriter CreateRewriter(DeclarationEmitContext dgc, IDeclarationContext context = null)
 {
     return new CSharpToJScriptRewriter(dgc, context ?? _context as IDeclarationContext);
 }
예제 #10
0
 public NativeTypeRef(IDeclarationContext parent, string typename)
     : base(parent, typename)
 {
     SetExternal();
     parent.RegisterType(this);
 }
예제 #11
0
 public ItemWithType(IDeclarationContext parent, string id, ITypeItem type)
     : base(parent, id)
 {
     _container = parent;
     _type = type;
 }
예제 #12
0
 public MethodContext(IDeclarationContext parent)
     : this()
 {
     Runtime.Assert(null != parent);
     _parent = parent;
 }
예제 #13
0
 public Method(IDeclarationContext parent, string id, ITypeItem ltype)
     : base(parent, id, ltype)
 {
 }
        internal static void AddMethodParameters(IDeclarationContext context, IEnumerable<ParameterSyntax> parameters)
        {
            if (null != parameters)
            {
                foreach (var par in parameters)
                {
                    ITypeItem ltype = null;
                    string typename = null;
                    if (null != par.Type)
                    {
                        typename = ResolveLType(par.Type);
                        ltype = context.ResolveLType(typename);
                    }

                    if (null == ltype && null != par.Type)
                    {
                        // TraceTarget.Trace("WARNING: unresolved parameter type '{0}'.", typename);
                    }

                    context.AddVariable(par.Identifier.ToString(), ltype);
                }
            }
        }
예제 #15
0
 public Container(IDeclarationContext parent, string name)
     : base(parent, name)
 {
     _variables = new VariableCollection(this);
     _types = new ItemsCollection();
 }
 public CSharpSyntaxRewriter CreateRewriter(IDeclarationContext context = null)
 {
     return CreateRewriter(null, context);
 }
예제 #17
0
 public Container(IDeclarationContext parent, Type rtype)
     : this(parent, rtype.GetRName())
 { }
예제 #18
0
 public Enumeration(IDeclarationContext parent, Type enumtype)
     : base(parent, enumtype)
 {
     parent.RegisterType(this);
 }
예제 #19
0
 public VariableCollection(IDeclarationContext parent)
 {
     _parent = parent;
 }