# HG changeset patch # User korDen # Date 1283183787 -14400 # Node ID b17640f0e4e896b26fac17b226aec6ba98e1086a # Parent ee670dd808a8e16f90182817c433483106c27d7b Fixed a bug with a Scope.this(Scope enclosing) being called instead of Scope.clone() method (as a copy ctor replacement) diff -r ee670dd808a8 -r b17640f0e4e8 dmd/AnonDeclaration.d --- a/dmd/AnonDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/AnonDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -100,7 +100,7 @@ //printf("\tsetting ad.sizeok %p to 2\n", ad); if (!sc.anonAgg) { - scope_ = scx ? scx : new Scope(sc); ///< + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); } diff -r ee670dd808a8 -r b17640f0e4e8 dmd/ClassDeclaration.d --- a/dmd/ClassDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/ClassDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -441,7 +441,7 @@ //error("forward reference of base class %s", baseClass.toChars()); // Forward reference of base class, try again later //printf("\ttry later, forward reference of base class %s\n", tc.sym.toChars()); - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); if (tc.sym.scope_) tc.sym.scope_.module_.addDeferredSemantic(tc.sym); @@ -510,7 +510,7 @@ //error("forward reference of base class %s", baseClass.toChars()); // Forward reference of base, try again later //printf("\ttry later, forward reference of base %s\n", baseClass.toChars()); - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); if (tc.sym.scope_) tc.sym.scope_.module_.addDeferredSemantic(tc.sym); @@ -705,7 +705,7 @@ sc = sc.pop(); - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); diff -r ee670dd808a8 -r b17640f0e4e8 dmd/EnumDeclaration.d --- a/dmd/EnumDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/EnumDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -138,7 +138,7 @@ if (!sym.memtype || !sym.members || !sym.symtab || sym.scope_) { // memtype is forward referenced, so try again later - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); writef("\tdeferring %s\n", toChars()); diff -r ee670dd808a8 -r b17640f0e4e8 dmd/FuncDeclaration.d --- a/dmd/FuncDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/FuncDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -840,7 +840,7 @@ /* Save scope for possible later use (if we need the * function internals) */ - scope_ = new Scope(sc); + scope_ = sc.clone(); scope_.setNoFree(); return; diff -r ee670dd808a8 -r b17640f0e4e8 dmd/InterfaceDeclaration.d --- a/dmd/InterfaceDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/InterfaceDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -167,7 +167,7 @@ //error("forward reference of base class %s", baseClass.toChars()); // Forward reference of base, try again later //printf("\ttry later, forward reference of base %s\n", b.base.toChars()); - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); return; diff -r ee670dd808a8 -r b17640f0e4e8 dmd/ProtDeclaration.d --- a/dmd/ProtDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/ProtDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -35,7 +35,7 @@ if (sc.protection != protection || sc.explicitProtection != 1) { // create new one for changes - newsc = new Scope(sc); + newsc = sc.clone(); newsc.flags &= ~SCOPE.SCOPEfree; newsc.protection = protection; newsc.explicitProtection = 1; diff -r ee670dd808a8 -r b17640f0e4e8 dmd/StructDeclaration.d --- a/dmd/StructDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/StructDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -296,7 +296,7 @@ alignsize = 0; structalign = 0; - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); //printf("\tdeferring %s\n", toChars()); diff -r ee670dd808a8 -r b17640f0e4e8 dmd/TemplateDeclaration.d --- a/dmd/TemplateDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/TemplateDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -210,7 +210,7 @@ /* Remember Scope for later instantiations, but make * a copy since attributes can change. */ - this.scope_ = new Scope(sc); /// A light copy + this.scope_ = sc.clone(); this.scope_.setNoFree(); // Set up scope for parameters diff -r ee670dd808a8 -r b17640f0e4e8 dmd/TemplateMixin.d --- a/dmd/TemplateMixin.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/TemplateMixin.d Mon Aug 30 19:56:27 2010 +0400 @@ -168,7 +168,7 @@ { // Forward reference //printf("forward reference - deferring\n"); - scope_ = scx ? scx : new Scope(sc); + scope_ = scx ? scx : sc.clone(); scope_.setNoFree(); scope_.module_.addDeferredSemantic(this); } diff -r ee670dd808a8 -r b17640f0e4e8 dmd/Type.d --- a/dmd/Type.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/Type.d Mon Aug 30 19:56:27 2010 +0400 @@ -1724,14 +1724,14 @@ } e = new StringExp(loc, s, 'c'); - Scope sc = new Scope(); + scope Scope sc = new Scope(); e = e.semantic(sc); } else if (ident is Id.stringof_) { string s = toChars(); e = new StringExp(loc, s, 'c'); - Scope sc = new Scope(); + scope Scope sc = new Scope(); e = e.semantic(sc); } else @@ -1822,7 +1822,7 @@ { string s = e.toChars(); e = new StringExp(e.loc, s, 'c'); - Scope sc2 = new Scope(); /// + scope Scope sc2 = new Scope(); /// e = e.semantic(sc2); return e; } diff -r ee670dd808a8 -r b17640f0e4e8 dmd/VarDeclaration.d --- a/dmd/VarDeclaration.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/VarDeclaration.d Mon Aug 30 19:56:27 2010 +0400 @@ -625,7 +625,7 @@ version (DMDV2) { /* Save scope for later use, to try again */ - scope_ = new Scope(sc); + scope_ = sc.clone(); scope_.setNoFree(); } } @@ -646,7 +646,7 @@ { /* Save scope for later use, to try again */ - scope_ = new Scope(sc); + scope_ = sc.clone(); scope_.setNoFree(); } ///}