compiler/libec: Fixed DB active records broken by d0d99da885cb22b451821053009c5af5abe...
authorJerome St-Louis <jerome@ecere.com>
Wed, 16 Apr 2014 16:59:36 +0000 (12:59 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 16 Apr 2014 16:59:36 +0000 (12:59 -0400)
- Property sets on Row ID classes were being used to set values in the database
  An exception is now made for those classes not to generate this error

compiler/libec/precompiled/expression.c
compiler/libec/precompiled/grammar.c
compiler/libec/precompiled/type.c
compiler/libec/src/dbpass.ec
compiler/libec/src/ecdefs.ec
compiler/libec/src/pass0.ec

index 3b06b4c..baf43e8 100644 (file)
@@ -853,9 +853,13 @@ struct Statement * getStmt;
 struct Statement * setStmt;
 struct Statement * issetStmt;
 struct Symbol * symbol;
-unsigned int conversion;
-unsigned int isWatchable;
 struct Expression * category;
+struct
+{
+unsigned int conversion : 1;
+unsigned int isWatchable : 1;
+unsigned int isDBProp : 1;
+} __attribute__ ((gcc_struct));
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
index 25a38f9..a39cd5f 100644 (file)
@@ -989,9 +989,13 @@ struct Statement * getStmt;
 struct Statement * setStmt;
 struct Statement * issetStmt;
 struct Symbol * symbol;
-unsigned int conversion;
-unsigned int isWatchable;
 struct Expression * category;
+struct
+{
+unsigned int conversion : 1;
+unsigned int isWatchable : 1;
+unsigned int isDBProp : 1;
+} __attribute__ ((gcc_struct));
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
index 1317a2e..b47c746 100644 (file)
@@ -879,9 +879,13 @@ struct Statement * getStmt;
 struct Statement * setStmt;
 struct Statement * issetStmt;
 struct Symbol * symbol;
-unsigned int conversion;
-unsigned int isWatchable;
 struct Expression * category;
+struct
+{
+unsigned int conversion : 1;
+unsigned int isWatchable : 1;
+unsigned int isDBProp : 1;
+} __attribute__ ((gcc_struct));
 } __attribute__ ((gcc_struct));
 
 extern struct __ecereNameSpace__ecere__com__Class * __ecereClass_PropertyWatch;
index 3dd8940..e40ee16 100644 (file)
@@ -818,6 +818,7 @@ static void ProcessDBTable(DBTableDef table)
                         CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
                            MkIdentifier(name), rowSet, null));
                      def.propertyDef.symbol.id = def.propertyDef.symbol.idCode = symbolID;
+                     def.propertyDef.isDBProp = true;
                      def.memberAccess = publicAccess;
                      rowClassDefs->Add(def);
                   }
@@ -873,6 +874,7 @@ static void ProcessDBTable(DBTableDef table)
                   curContext = globalContext;
                   def = MkClassDefProperty(MkProperty(CopyList(entry.dataType.qualifiers, CopySpecifier), entry.dataType.declarator, CopyIdentifier(entry.id), rowSet, rowGet));
                   def.propertyDef.symbol.id = def.propertyDef.symbol.idCode = symbolID;
+                  def.propertyDef.isDBProp = true;
                   def.memberAccess = publicAccess;
                   rowClassDefs->Add(def);
                }
@@ -1044,6 +1046,7 @@ static void ProcessDBTable(DBTableDef table)
                      CopyList(entry.dataType.qualifiers, CopySpecifier), CopyDeclarator(entry.dataType.declarator),
                         CopyIdentifier(entry.id), idSet, idGet));
                   def.propertyDef.symbol.id = def.propertyDef.symbol.idCode = symbolID;
+                  def.propertyDef.isDBProp = true;
                   def.memberAccess = publicAccess;
                   idClassDefs->Add(def);
                }
index 16acf35..754b6e8 100644 (file)
@@ -923,9 +923,13 @@ public:
    Statement setStmt;
    Statement issetStmt;
    Symbol symbol;
-   bool conversion;
-   bool isWatchable;
    Expression category;
+   struct
+   {
+      bool conversion:1;
+      bool isWatchable:1;
+      bool isDBProp:1;
+   };
 };
 
 public class ClassDef : struct
index 4fc5f22..8bb9049 100644 (file)
@@ -1205,7 +1205,7 @@ static void ProcessClass(ClassType classType, OldList definitions, Symbol symbol
                         ListAdd(specifiers, MkSpecifier(VOID));
                      else
                      {
-                        if(regClass.type != noHeadClass && regClass.type != normalClass && (!propertyDef.symbol._property || !propertyDef.symbol._property.conversion))
+                        if(regClass.type != noHeadClass && regClass.type != normalClass && !propertyDef.isDBProp && (!propertyDef.symbol._property || !propertyDef.symbol._property.conversion))
                            Compiler_Error($"set defined on type without storage for non-conversion property\n");
                         ListAdd(specifiers, MkSpecifierName(regClass.fullName));
                      }