Differences From Artifact [38516f68b159d6bd]:
- File
polemy/parse.d
- 2010-11-24 13:22:04 - part of checkin [f9c31f3cd8] on branch trunk - Fixed the null dereference bug when directly wrote "case 1 when 2: 3" in REPL. It was due to null LexPosition in the AST. Now AST.pos !is null is an invariant of AST. (user: kinaba) [annotate]
To Artifact [9aca36046bea5df8]:
- File
polemy/parse.d
- 2010-11-26 05:03:10 - part of checkin [207cea338a] on branch trunk - changed hiding mechanizem of x in let x = ... for @macro layer. Old: set(x,ValueLayer,undefined) Nee: set(x,NoopLayer,null) (user: kinaba) [annotate]
98 98 string kwd = "@" ~ layer;
99 99 string var = layer;
100 100
101 101 auto e = tryEat("(")
102 102 ? parseLambdaAfterOpenParen(pos) // let var ( ...
103 103 : (eat("=", "after "~kwd), E(0)); // let var = ...
104 104 if( moreDeclarationExists() )
105 - return new Let(pos, var, SystemLayer, e, Body());
105 + return new Let(pos, var, LiftLayer, e, Body());
106 106 else
107 - return new Let(pos, var, SystemLayer, e,
108 - new Lay(pos, SystemLayer, new Var(pos, var))
107 + return new Let(pos, var, LiftLayer, e,
108 + new Lay(pos, LiftLayer, new Var(pos, var))
109 109 );
110 110 }
111 111 else
112 112 {
113 113 string kwd = layer;
114 114 if( layer.empty && !tryEat(kwd="let") && !tryEat(kwd="var") && !tryEat(kwd="def") )
115 115 return null; // none of {@lay, let, var, def} occurred, it's not a declaration
................................................................................
632 632 assert_eq(parseString(`def foo(x) { x+1 }; foo`),
633 633 let("foo", "",
634 634 fun(["x"], call(var("+"), var("x"), intl(1))),
635 635 var("foo"))
636 636 );
637 637
638 638 assert_eq(parseString(`@@type ( x ) { x }`),
639 - let("@type", SystemLayer, fun(["x"], var("x")), lay(SystemLayer, var("@type"))) );
639 + let("@type", LiftLayer, fun(["x"], var("x")), lay(LiftLayer, var("@type"))) );
640 640
641 641 assert_eq(parseString(`{}`), call(var("{}")));
642 642 assert_eq(parseString(`{foo:1,"bar":2}`),
643 643 call(var(".="), call(var(".="), call(var("{}")), strl("foo"), intl(1)), strl("bar"), intl(2)));
644 644 assert_eq(parseString(`{}.foo`), call(var("."),call(var("{}")),strl("foo")));
645 645 assert_eq(parseString(`{}.?foo`), call(var(".?"),call(var("{}")),strl("foo")));
646 646 assert_eq(parseString(`x{y:1}`), call(var(".="),var("x"),strl("y"),intl(1)));