Next: Classes
Up: Names
Previous: Names
When an identifier or label has a defining point for a region, another
identifier or label with the same spelling can't have a defining point for
that region.
Multiple definition errors[6]
:
CLASS SYMBOL MultDefChk INHERITS Unique COMPUTE
IF(NOT(THIS.Unique),
message(
ERROR,
CatStrInd("Multiply defined identifier ",THIS.Sym),
0,
COORDREF));
END;
This macro is defined in definitions 6 and 8.
This macro is invoked in definition 5.
MultDefChk requires the Eli Unique module, and the error reporting
requires the string concatenation module:
Instantiate required modules[7]
:
$/Prop/Unique.gnrc :inst
$/Tech/Strings.specs
This macro is defined in definitions 7 and 19.
This macro is invoked in definition 2.
Type, field, and variable identifiers can have only one defining occurrence
in their scope.
Method identifiers, on the other hand, can be overloaded and therefore may
have several defining occurrences.
Multiple definition errors[8]
:
TREE SYMBOL TypeIdDef INHERITS IdentOcc, TypIdDefScope, MultDefChk COMPUTE
SYNT.Key=THIS.TypKey;
END;
TREE SYMBOL FieldIdDef INHERITS IdentOcc, FldIdDefScope, MultDefChk COMPUTE
SYNT.Key=THIS.FldKey;
END;
TREE SYMBOL VariableIdDef INHERITS IdentOcc, VarIdDefScope, MultDefChk COMPUTE
SYNT.Key=THIS.VarKey;
END;
TREE SYMBOL MethodIdDef INHERITS IdentOcc, MthIdDefScope COMPUTE
SYNT.Key=THIS.MthKey;
END;
This macro is defined in definitions 6 and 8.
This macro is invoked in definition 5.
The definition of a legal assignment can be found in Section 5.2 of the
Java specification.
int NoAssign(DefTableKey from, DefTableKey to, int v)[9]
:
/* Determine whether assignment is legal
* On entry-
* from=type of the value
* to=type of the variable
* v=constant
* If the assignment is legal then on exit-
* NoAssign=0
* Else on exit-
* NoAssign=1
***/
{ if (IsCoercible(from, to)) return 0;
if (IsCoercible(from, intType) && IsCoercible(to, intType)) {
char *vs;
if (v == NoStrIndex) return 1;
vs = strsub(GetUpperBound(to, "0"),StringTable(v),10);
if (vs[0] == '-') return 1;
vs = strsub(StringTable(v),GetLowerBound(to, "0"),10);
if (vs[0] == '-') return 1;
return 0;
}
return 1;
}
This macro is invoked in definition 43.
Property definitions[10]
:
LowerBound, UpperBound: CharPtr;
byteType -> LowerBound={"-128"}, UpperBound={"127"};
shortType -> LowerBound={"-32768"}, UpperBound={"32767"};
charType -> LowerBound={"0"}, UpperBound={"65535"};
This macro is defined in definitions 10, 16, 22, 36, and 40.
This macro is invoked in definition 3.
Next: Classes
Up: Names
Previous: Names
2008-09-11