Nice/src/bossa/syntax visibility.nice,1.1,1.2 niceclass.nice,1.28,1.29 niceMethod.nice,1.25,1.26 methodDeclaration.nice,1.6,1.7 globalvar.nice,1.9,1.10 defaultMethod.nice,1.9,1.10
Daniel Bonniot <[email protected]> Mon, 28 Mar 2005 11:35:17 +0000
| Newsgroups | gmane.comp.lang.nice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1516/src/bossa/syntax
Modified Files:
visibility.nice niceclass.nice niceMethod.nice
methodDeclaration.nice globalvar.nice defaultMethod.nice
Log Message:
Enforce private visibility for methods (no restriction yet).
Index: methodDeclaration.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodDeclaration.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** methodDeclaration.nice 13 Mar 2005 11:38:18 -0000 1.6
--- methodDeclaration.nice 28 Mar 2005 11:35:15 -0000 1.7
***************
*** 37,45 ****
?gnu.expr.Expression code = null;
! void setSymbol(MethodSymbol symbol)
{
this.symbol = symbol;
symbol.propagate = Node.none;
this.addChild(symbol);
}
--- 37,48 ----
?gnu.expr.Expression code = null;
! Visibility visibility = general;
!
! void setSymbol(MethodSymbol symbol, Visibility vis = general)
{
this.symbol = symbol;
symbol.propagate = Node.none;
this.addChild(symbol);
+ this.visibility = loosen(0, vis);
}
***************
*** 52,56 ****
void addToScope()
{
! module.scope.addSymbol(symbol);
}
--- 55,59 ----
void addToScope()
{
! module.scope.addSymbol(symbol, visibility);
}
Index: niceMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceMethod.nice,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** niceMethod.nice 25 Mar 2005 16:40:00 -0000 1.25
--- niceMethod.nice 28 Mar 2005 11:35:15 -0000 1.26
***************
*** 219,222 ****
--- 219,223 ----
printInterface(s)
{
+ s.print(keyword(0, visibility));
if (specializedMethods != null)
s.print("override ");
***************
*** 229,233 ****
Constraint constraint, Monotype returnType,
FormalParameters parameters,
! Contract contract, boolean isOverride)
{
let res = new NiceMethod(name, Node.down,
--- 230,234 ----
Constraint constraint, Monotype returnType,
FormalParameters parameters,
! Contract contract, boolean isOverride, Visibility vis)
{
let res = new NiceMethod(name, Node.down,
***************
*** 241,245 ****
res.addChild(parameters);
! res.setSymbol(new MethodSymbol(res, name, constraint, returnType));
return res;
}
--- 242,246 ----
res.addChild(parameters);
! res.setSymbol(new MethodSymbol(res, name, constraint, returnType), vis);
return res;
}
***************
*** 264,268 ****
?Statement body,
Contract contract,
! boolean isOverride)
{
// it is a class method, there is an implicit "this" argument
--- 265,269 ----
?Statement body,
Contract contract,
! boolean isOverride, Visibility vis)
{
// it is a class method, there is an implicit "this" argument
***************
*** 338,345 ****
if (body == null)
return createNiceMethod(name, constraint, returnType, params, contract,
! isOverride);
else
return createMethodWithDefault
! (name, constraint, returnType, params, body, contract, isOverride);
}
--- 339,346 ----
if (body == null)
return createNiceMethod(name, constraint, returnType, params, contract,
! isOverride, vis);
else
return createMethodWithDefault
! (name, constraint, returnType, params, body, contract, isOverride, vis);
}
Index: defaultMethod.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/defaultMethod.nice,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** defaultMethod.nice 6 Mar 2005 01:34:26 -0000 1.9
--- defaultMethod.nice 28 Mar 2005 11:35:15 -0000 1.10
***************
*** 50,61 ****
FormalParameters parameters,
?Statement body,
! Contract contract, boolean isOverride)
{
if (body == null)
return createNiceMethod(name, constraint, returnType, parameters,
! contract, isOverride);
return createDefaultMethodImplementation(name, constraint, returnType,
! parameters, contract, isOverride, body);
}
--- 50,61 ----
FormalParameters parameters,
?Statement body,
! Contract contract, boolean isOverride, Visibility vis)
{
if (body == null)
return createNiceMethod(name, constraint, returnType, parameters,
! contract, isOverride, vis);
return createDefaultMethodImplementation(name, constraint, returnType,
! parameters, contract, isOverride, body, vis);
}
***************
*** 120,124 ****
FormalParameters parameters,
Contract contract, boolean isOverride,
! Statement body)
{
let res = new DefaultMethodImplementation(name, Node.down, body: body,
--- 120,125 ----
FormalParameters parameters,
Contract contract, boolean isOverride,
! Statement body,
! Visibility vis)
{
let res = new DefaultMethodImplementation(name, Node.down, body: body,
***************
*** 131,135 ****
notNull(res.declaration).addChild(parameters);
notNull(res.declaration).setSymbol
! (new MethodSymbol(notNull(res.declaration), name, constraint, returnType));
res.addChild(res.declaration);
--- 132,137 ----
notNull(res.declaration).addChild(parameters);
notNull(res.declaration).setSymbol
! (new MethodSymbol(notNull(res.declaration), name, constraint, returnType),
! vis);
res.addChild(res.declaration);
Index: visibility.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/visibility.nice,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** visibility.nice 12 Mar 2005 02:41:47 -0000 1.1
--- visibility.nice 28 Mar 2005 11:35:15 -0000 1.2
***************
*** 23,24 ****
--- 23,33 ----
Visibility visibility(boolean pub, boolean priv) =
pub ? general : priv ? intimate: familial;
+
+ Visibility loosen(int dummy, Visibility vis) =
+ vis == familial ? general : vis;
+
+ String keyword(int dummy, Visibility);
+ keyword(dummy, intimate) = "private ";
+ keyword(dummy, familial) = "";
+ keyword(dummy, general) = "public ";
+
Index: globalvar.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/globalvar.nice,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** globalvar.nice 25 Mar 2005 16:40:00 -0000 1.9
--- globalvar.nice 28 Mar 2005 11:35:15 -0000 1.10
***************
*** 48,59 ****
}
- String modifier(Visibility);
- modifier(intimate) = "private ";
- modifier(familial) = "";
- modifier(general) = "public ";
-
printInterface(s)
{
! s.print(this.modifier(visibility) + (constant? "let ": "var ") +left +" = " +value.toString() +";\n");
}
--- 48,59 ----
}
printInterface(s)
{
! s.print(keyword(0, visibility));
! s.print(constant ? "let " : "var ");
! s.print(left);
! s.print(" = ");
! s.print(value);
! s.print(";\n");
}
Index: niceclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** niceclass.nice 25 Mar 2005 16:40:00 -0000 1.28
--- niceclass.nice 28 Mar 2005 11:35:15 -0000 1.29
***************
*** 157,161 ****
}
! private ?gnu.expr.Declaration getOverridenField
(OverridenField field, boolean checkValue)
{
--- 157,161 ----
}
! ?gnu.expr.Declaration getOverridenField
(OverridenField field, boolean checkValue)
{
***************
*** 341,345 ****
private boolean entered = false;
! private void enterTypingContext()
{
if (entered || definition.classConstraint == null)
--- 341,345 ----
private boolean entered = false;
! void enterTypingContext()
{
if (entered || definition.classConstraint == null)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click