Example #1
0
        protected override void DoEmitCode(CompilerTarget target, StackSemantics stackSemantics)
        {
            if(stackSemantics == StackSemantics.Effect)
                return;

            target.EmitNull(Position);
        }
Example #2
0
        protected override void DoEmitCode(CompilerTarget target, StackSemantics stackSemantics)
        {
            if(stackSemantics == StackSemantics.Effect)
                return;

            if (Constant == null)
                target.EmitNull(Position);
            else
                switch (Type.GetTypeCode(Constant.GetType()))
                {
                    case TypeCode.Boolean:
                        target.EmitConstant(Position, (bool) Constant);
                        break;
                    case TypeCode.Int16:
                    case TypeCode.Byte:
                    case TypeCode.Int32:
                    case TypeCode.UInt16:
                    case TypeCode.UInt32:
                        target.EmitConstant(Position, (int) Constant);
                        break;
                    case TypeCode.Single:
                    case TypeCode.Double:
                        target.EmitConstant(Position, (double) Constant);
                        break;
                    case TypeCode.String:
                        target.EmitConstant(Position, (string) Constant);
                        break;
                    default:
                        var moduleName = Constant as ModuleName;

                        if (moduleName != null)
                        {
                            target.EmitConstant(Position, moduleName);
                        }
                        else
                        {
                            throw new PrexoniteException(
                                "Prexonite does not support constants of type " +
                                    Constant.GetType().Name + ".");
                        }
                        break;
                }
        }
Example #3
0
 protected override void EmitGetCode(CompilerTarget target, StackSemantics stackSemantics)
 {
     _reportUnresolved(target);
     target.EmitNull(Position);
 }
Example #4
0
 protected override void EmitGetCode(CompilerTarget target, StackSemantics stackSemantics)
 {
     target.Loader.ReportMessage(Message.Error(Resources.Parser_ExpectedEntityFoundNamespace, Position, MessageClasses.ExpectedEntityFoundNamespace));
     if(stackSemantics == StackSemantics.Value)
         target.EmitNull(Position);
 }