Inheritance: IEmitVal
Exemple #1
0
        public IEmitVal AddParameter(IEmitType type, string name)
        {
            bool first = _parameters.Count == 0;

            var param = new EmitValCPP(Target, name, type);

            _parameters.Add(param);

            WriteParameter(type, name, first, _headerParamsSpan);
            WriteParameter(type, name, first, _sourceParamsSpan);

            return(param);
        }
        public IEmitVal AddParameter(IEmitType type, string name)
        {
            bool first = _parameters.Count == 0;

            var param = new EmitValCPP(Target, name, type);
            _parameters.Add(param);

            WriteParameter(type, name, first, _headerParamsSpan);
            WriteParameter(type, name, first, _sourceParamsSpan);

            return param;
        }
        public EmitMethodCPP(
            EmitClassCPP clazz,
            string prefix,
            string name,
            string cconv,
            IEmitType resultType,
            Span headerSpan,
            Span sourceSpan)
        {
            _class = clazz;
            _name = name;
            _cconv = cconv;
            _resultType = resultType;
            _headerSpan = headerSpan;
            _sourceSpan = sourceSpan;

            _headerSpan.Write( "static " );
            _headerParamsSpan = CreateSignatureSpan(
                _name,
                _headerSpan);
            _headerSpan.WriteLine(";");

            _fullName = prefix + _name;

            _sourceParamsSpan = CreateSignatureSpan(
                prefix + _name,
                _sourceSpan);
            _sourceSpan.WriteLine();
            _sourceSpan.WriteLine("{");
            _bodySpan = _sourceSpan.IndentSpan();
            _sourceSpan.WriteLine("}");

            _thisParameter = (EmitValCPP) AddParameter(
                Target.Pointer( clazz ),
                "self" );
            _entryBlock = new EmitBlockCPP(this, _bodySpan.InsertSpan());
        }