Exemple #1
0
        // Delete once migrated to PastelContext
        internal string GetFunctionDeclarationsTEMP(Transpilers.TranspilerContext ctx, string indent)
        {
            foreach (FunctionDefinition fd in this.GetFunctionDefinitions())
            {
                ctx.Transpiler.GenerateCodeForFunctionDeclaration(ctx, fd, true);
                ctx.Append(ctx.Transpiler.NewLine);
            }

            return(Indent(ctx.FlushAndClearBuffer().Trim(), ctx.Transpiler.NewLine, indent));
        }
        // Delete once migrated to PastelContext
        internal Dictionary <string, string> GetStructCodeByClassTEMP(Transpilers.TranspilerContext ctx, string indent)
        {
            Dictionary <string, string> output = new Dictionary <string, string>();

            foreach (StructDefinition sd in this.GetStructDefinitions())
            {
                string name = sd.NameToken.Value;
                ctx.Transpiler.GenerateCodeForStruct(ctx, sd);
                output[name] = ctx.FlushAndClearBuffer();
            }
            return(output);
        }
Exemple #3
0
        internal Dictionary <string, string> GetFunctionCodeAsLookupTEMP(Transpilers.TranspilerContext ctx, string indent)
        {
            Dictionary <string, string> output = new Dictionary <string, string>();

            foreach (FunctionDefinition fd in this.GetFunctionDefinitions())
            {
                ctx.Transpiler.GenerateCodeForFunction(ctx, fd, true);
                output[fd.NameToken.Value] = Indent(ctx.FlushAndClearBuffer().Trim(), ctx.Transpiler.NewLine, indent);
            }

            return(output);
        }
        // Delete once migrated to PastelContext
        internal string GetFunctionCodeTEMP(Transpilers.TranspilerContext ctx, string indent)
        {
            foreach (FunctionDefinition fd in this.GetFunctionDefinitions())
            {
                if (!alreadySerializedFunctions.Contains(fd))
                {
                    this.Transpiler.GenerateCodeForFunction(ctx, fd);
                    ctx.Append(this.Transpiler.NewLine);
                }
            }

            return(Indent(ctx.FlushAndClearBuffer().Trim(), this.Transpiler.NewLine, indent));
        }
        internal string GetFunctionCodeForSpecificFunctionAndPopItFromFutureSerializationTEMP(
            string name,
            string swapOutWithNewNameOrNull,
            Transpilers.TranspilerContext ctx,
            string indent)
        {
            FunctionDefinition fd = this.GetFunctionDefinitions().Where(f => f.NameToken.Value == name).FirstOrDefault();

            if (fd == null || this.alreadySerializedFunctions.Contains(fd))
            {
                return(null);
            }

            this.alreadySerializedFunctions.Add(fd);

            if (swapOutWithNewNameOrNull != null)
            {
                fd.NameToken = Token.CreateDummyToken(swapOutWithNewNameOrNull);
            }

            this.Transpiler.GenerateCodeForFunction(ctx, fd);
            return(Indent(ctx.FlushAndClearBuffer().Trim(), this.Transpiler.NewLine, indent));
        }
 public abstract void TranslateFloatBuffer16(TranspilerContext sb);
 public abstract void TranslateExpressionAsExecutable(TranspilerContext sb, Expression expression);
 public abstract void TranslateExtensibleCallbackInvoke(TranspilerContext sb, Expression name, Expression argsArray);
 public abstract void TranslateEmitComment(TranspilerContext sb, string value);
 public abstract void TranslateCharConstant(TranspilerContext sb, char value);
 public abstract void TranslateBooleanNot(TranspilerContext sb, UnaryOp unaryOp);
 public abstract void TranslateFloatToString(TranspilerContext sb, Expression floatExpr);
 public abstract void TranslateDictionaryRemove(TranspilerContext sb, Expression dictionary, Expression key);
 public abstract void TranslateDictionaryNew(TranspilerContext sb, PType keyType, PType valueType);
 public abstract void TranslateDictionaryContainsKey(TranspilerContext sb, Expression dictionary, Expression key);
 public abstract void TranslateCurrentTimeSeconds(TranspilerContext sb);
 public abstract void TranslateConstructorInvocation(TranspilerContext sb, ConstructorInvocation constructorInvocation);
 public abstract void TranslateChr(TranspilerContext sb, Expression charCode);
 public abstract void TranslateCharToString(TranspilerContext sb, Expression charValue);
 public abstract void TranslateFloatConstant(TranspilerContext sb, double value);
 public abstract void TranslateFloatDivision(TranspilerContext sb, Expression floatNumerator, Expression floatDenominator);
 public abstract void TranslateBreak(TranspilerContext sb);
 public abstract void TranslateFunctionInvocationWithPrefix(TranspilerContext sb, string prefix, FunctionReference funcRef, Expression[] args);
 public abstract void TranslateBooleanConstant(TranspilerContext sb, bool value);
 public abstract void TranslateDictionarySet(TranspilerContext sb, Expression dictionary, Expression key, Expression value);
 public abstract void TranslateCast(TranspilerContext sb, PType type, Expression expression);
 public abstract void TranslateDictionaryTryGet(TranspilerContext sb, Expression dictionary, Expression key, Expression fallbackValue, Variable varOut);
 public abstract void TranslateDictionaryValues(TranspilerContext sb, Expression dictionary);
 internal string GetGlobalsCodeTEMP(Transpilers.TranspilerContext ctx, string indent)
 {
     this.Transpiler.GenerateCodeForGlobalsDefinitions(ctx, this.GetGlobalsDefinitions());
     return(Indent(ctx.FlushAndClearBuffer().Trim(), this.Transpiler.NewLine, indent));
 }
 public abstract void TranslateBase64ToString(TranspilerContext sb, Expression base64String);