Skip to content

Commit

Permalink
public attr nested inside of a class now means Public ''
Browse files Browse the repository at this point in the history
--HG--
branch : com.mozilla.es4.smlnj
extra : convert_revision : 840640c8fdb5eed5224d75b5016ade36cd1b0295
  • Loading branch information
jeffdyer committed May 5, 2007
1 parent 77f7de3 commit 960bf24
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 30 deletions.
1 change: 0 additions & 1 deletion ast.sml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ structure Ast = struct

type POS = { file: string, span: StreamPos.span, sm: StreamPos.sourcemap, post_newline: bool }


type IDENT = Ustring.STRING

datatype NAMESPACE =
Expand Down
2 changes: 0 additions & 2 deletions boot.sml
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,9 @@ fun boot _ =
"builtins/Namespace.es",
"builtins/Magic.es",
"builtins/Conversions.es",

"builtins/String.es",
"builtins/string_primitive.es",


"builtins/Boolean.es",
"builtins/boolean_primitive.es",

Expand Down
2 changes: 1 addition & 1 deletion builtins/RegExpCompiler.es
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Status: Complete; Not reviewed; Not tested.
*/

package /*RegExpInternals*/ // FIXME: package bug
package RegExpInternals
{
import Unicode.*;
use namespace intrinsic;
Expand Down
2 changes: 1 addition & 1 deletion builtins/RegExpEvaluator.es
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Status: Complete, not reviewed, not tested.
*/

package /*RegExpInternals*/ // FIXME: package bug
package RegExpInternals
{
import Unicode.*;
use namespace intrinsic;
Expand Down
11 changes: 5 additions & 6 deletions defn.sml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ and defClass (env: ENV)
(cdef: Ast.CLASS_DEFN)
: (Ast.FIXTURES * Ast.CLASS_DEFN) =
let
val _ = trace2 ("defining class ",(#ident cdef))
val class = analyzeClass env cdef
val class = resolveClass env cdef class
val Ast.Cls {name,...} = class
Expand Down Expand Up @@ -717,7 +716,9 @@ and analyzeClass (env:ENV)
val env = clearPackageName env

val (unhoisted,classFixtures,classInits) = defDefns env [] [] [] classDefns
val classFixtures = (List.foldl mergeFixtures unhoisted classFixtures)
val staticEnv = extendEnvironment env classFixtures
(* namespace and type definitions aren't normally hoisted *)

val (unhoisted,instanceFixtures,_) = defDefns staticEnv [] [] [] instanceDefns
val instanceEnv = extendEnvironment staticEnv instanceFixtures
Expand Down Expand Up @@ -2125,7 +2126,7 @@ and defStmt (env:ENV)
val namespace = resolveExprOptToNamespace env ns
val name = {ns=namespace, id=ident}

val env = clearPackageName env (* only top level pakcage defns use package specific namespaces *)
val env = clearPackageName env (* only top level package defns use package specific namespaces *)

val (block,hoisted) = defBlock env (Ast.Block {pragmas=pragmas,
defns=defns,
Expand Down Expand Up @@ -2366,7 +2367,7 @@ and defNamespace (env:ENV)
val qualNs = resolveExprOptToNamespace env ns
val newNs = case init of
(* FIXME: a nonce perhaps? *)
NONE => Ast.UserNamespace ident
NONE => Ast.UserNamespace ident
| SOME (Ast.LiteralExpr (Ast.LiteralString s)) =>
Ast.UserNamespace s
| SOME (Ast.LexicalRef lref) =>
Expand Down Expand Up @@ -2471,11 +2472,9 @@ and defDefns (env:ENV)
[] => (trace(["<< defDefns"]);(unhoisted,hoisted,inits))
| d::ds =>
let


val (unhoisted',hoisted',inits') = defDefn env d
val temp = case d of Ast.ClassDefn _ => hoisted' | _ => []
val env' = updateFixtures env (List.foldl mergeFixtures unhoisted' temp)
val env' = updateFixtures env (List.foldl mergeFixtures unhoisted' temp)
(* add the new unhoisted and temporarily, hoisted class fxtrs to the current env *)
in
defDefns env'
Expand Down
4 changes: 2 additions & 2 deletions parser.sml
Original file line number Diff line number Diff line change
Expand Up @@ -6063,11 +6063,11 @@ and classDefinition (ts,attrs:ATTRS) =
ident=ident,
name=NONE,
block=Ast.Block {body=body,
defns=classDefn::letDefns,
defns=letDefns,
head=NONE,
pragmas=pragmas,
pos=posOf ts2}}],
defns=[],
defns=[classDefn],
head=NONE,
pos=posOf ts})
end
Expand Down
18 changes: 1 addition & 17 deletions tests/t.es
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
/*
package p.q {
public class A { public var x = 10 }
public class A { public var x = 'hi' }
}
import p.q.A
intrinsic::print(new A().x)
*/

/*
let f = function (x:int) { return x + x }
f(10)
*/

/*
[x,y] = [10,20]
intrinsic::print(x)
*/

//function f() print(1);
//function f() print(2)
//f()
var x

0 comments on commit 960bf24

Please sign in to comment.