You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/03/18 17:38:00 UTC
[lucy-commits] [3/6] git commit: Don't allow default parcel in classes, vars,
and types
Don't allow default parcel in classes, vars, and types
The 'parcel' member of CFCVariables is always set to the parcel where
the variable is declared. This requires a change of the method
compatibility test. Only the method parameter types are compared for
equality while the symbols may differ.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/221f5c43
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/221f5c43
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/221f5c43
Branch: refs/heads/single-parcel-per-file
Commit: 221f5c4350fdf2c03b19dcbfe423206c1126b7f6
Parents: 6cbabed
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Mar 18 14:16:53 2014 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Mar 18 16:57:06 2014 +0100
----------------------------------------------------------------------
compiler/src/CFCClass.c | 1 -
compiler/src/CFCMethod.c | 4 +++-
compiler/src/CFCParseHeader.y | 3 +--
compiler/src/CFCSymbol.h | 3 +--
compiler/src/CFCType.c | 6 +-----
compiler/src/CFCVariable.c | 3 ---
6 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index fccecf8..eb84dfb 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -118,7 +118,6 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
CFCUTIL_NULL_CHECK(class_name);
exposure = exposure ? exposure : "parcel";
micro_sym = micro_sym ? micro_sym : "class";
- parcel = parcel ? parcel : CFCParcel_default_parcel();
CFCSymbol_init((CFCSymbol*)self, parcel, exposure, class_name, cnick,
micro_sym);
if (!is_inert
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.c b/compiler/src/CFCMethod.c
index 97c68ae..8bc9e37 100644
--- a/compiler/src/CFCMethod.c
+++ b/compiler/src/CFCMethod.c
@@ -185,7 +185,9 @@ CFCMethod_compatible(CFCMethod *self, CFCMethod *other) {
if (strcmp(my_vals[i], other_vals[i])) { return false; }
}
if (my_args[i]) {
- if (!CFCVariable_equals(my_args[i], other_args[i])) {
+ CFCType *my_type = CFCVariable_get_type(my_args[i]);
+ CFCType *other_type = CFCVariable_get_type(other_args[i]);
+ if (!CFCType_equals(my_type, other_type)) {
return false;
}
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCParseHeader.y
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParseHeader.y b/compiler/src/CFCParseHeader.y
index 7b83fa1..1cc84c2 100644
--- a/compiler/src/CFCParseHeader.y
+++ b/compiler/src/CFCParseHeader.y
@@ -68,11 +68,10 @@ S_new_var(CFCParser *state, char *exposure, char *modifiers, CFCType *type,
inert = true;
}
- CFCParcel *parcel = NULL;
+ CFCParcel *parcel = CFCParser_get_parcel(state);
const char *class_name = NULL;
const char *class_cnick = NULL;
if (exposure && strcmp(exposure, "local") != 0) {
- parcel = CFCParser_get_parcel(state);
class_name = CFCParser_get_class_name(state);
class_cnick = CFCParser_get_class_cnick(state);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCSymbol.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCSymbol.h b/compiler/src/CFCSymbol.h
index 2777c2c..d91bb52 100644
--- a/compiler/src/CFCSymbol.h
+++ b/compiler/src/CFCSymbol.h
@@ -54,8 +54,7 @@ int
CFCSymbol_validate_class_name_component(const char *name);
/**
- * @param parcel A Clownfish::CFC::Model::Parcel. If not supplied, will be
- * assigned to the default Parcel.
+ * @param parcel A Clownfish::CFC::Model::Parcel.
* @param exposure The scope in which the symbol is exposed. Must be
* 'public', 'parcel', 'private', or 'local'.
* @param class_name A optional class name, consisting of one or more
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCType.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCType.c b/compiler/src/CFCType.c
index 8a3d774..b3c13ce 100644
--- a/compiler/src/CFCType.c
+++ b/compiler/src/CFCType.c
@@ -167,6 +167,7 @@ CFCType*
CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
int indirection) {
// Validate params.
+ CFCUTIL_NULL_CHECK(parcel);
if (indirection != 1) {
CFCUtil_die("Parameter 'indirection' can only be 1");
}
@@ -177,11 +178,6 @@ CFCType_new_object(int flags, CFCParcel *parcel, const char *specifier,
CFCUtil_die("Can't be both incremented and decremented");
}
- // Use default parcel if none supplied.
- if (!parcel) {
- parcel = CFCParcel_default_parcel();
- }
-
// Add flags.
flags |= CFCTYPE_OBJECT;
if (strstr(specifier, "String")) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/221f5c43/compiler/src/CFCVariable.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCVariable.c b/compiler/src/CFCVariable.c
index 71e3473..3443933 100644
--- a/compiler/src/CFCVariable.c
+++ b/compiler/src/CFCVariable.c
@@ -63,9 +63,6 @@ CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
struct CFCType *type, int inert) {
// Validate params.
CFCUTIL_NULL_CHECK(type);
- if (!parcel) {
- parcel = CFCParcel_default_parcel();
- }
// Default exposure to "local".
const char *real_exposure = exposure ? exposure : "local";