Ejemplo n.º 1
0
        public override object Clone()
        {
            SolidityUintBool copy = new SolidityUintBool(name);

            return(copy);
        }
Ejemplo n.º 2
0
        private void parseVariables(ParserRuleContext context)
        {
            if (inFunction)
            {
                return;
            }
            SolidityVar currentVar = null;

            switch (typename)
            {
            case "address":
                currentVar = new SolidityAddress(name);
                break;

            case "uint":
                currentVar = new SolidityUint(typesize, name);
                break;

            case "string":
                currentVar = new SolidityStringVar(name);
                break;

            case "bool":
                currentVar = new SolidityUintBool(name);
                break;

            default:
                if (structDefs.ContainsKey(typename))
                {
                    currentVar = (SolidityVar)structDefs[typename].Clone();
                }
                else if (enumDefs.ContainsKey(typename))
                {
                    currentVar = (SolidityVar)enumDefs[typename].Clone();
                }
                else
                {
                    //  throw new NotSupportedException("unknwon type " + typename);
                    Console.WriteLine(" uknown type " + typename + " at adding as address" + context.Start.Line);
                    currentVar = new SolidityAddress(name);
                }
                break;
            }
            if (isarray)
            {
                SolidityVar oldvar = currentVar;
                currentVar = new SolidityArray(currentVar, name);
                isarray    = false;
            }
            if (currStruct != null && currentVar != null)
            {
                currStruct.AddType(currentVar);
            }
            else if (currentVar != null)
            {
                if (startMap > 0)
                {
                    SolidityMap mapvar = new SolidityMap(currentVar, name, startMap);

                    /*for(int i = 1; i < startMap; i++)
                     * {
                     *  SolidityMap newMap = new SolidityMap(mapvar, "");
                     *  mapvar = newMap;
                     * }
                     * mapvar.name = name;*/
                    variableList.Add(mapvar);
                    startMap = 0;
                }
                else
                {
                    variableList.Add(currentVar);
                }
                ethGlobal.DebugPrint("added " + name);
            }
        }