help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH 2/2] stinst: Resolve GNUPlot.GNUPlot properly


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] [PATCH 2/2] stinst: Resolve GNUPlot.GNUPlot properly
Date: Thu, 19 Dec 2013 16:12:21 +0100

Importing the Cairo and GNUPlot (probably other packages too) failed
because of GNUPlot.GNUPlot was looked up wrongly in the current
namespace. Add the current Namespace in front of all the other pools.
---
 packages/stinst/parser/Makefile.frag      |  2 +-
 packages/stinst/parser/STCompiler.st      |  8 ++---
 packages/stinst/parser/STCompilerTests.st | 57 +++++++++++++++++++++++++++++++
 packages/stinst/parser/STSymTable.st      |  7 +++-
 packages/stinst/parser/package.xml        |  2 ++
 5 files changed, 70 insertions(+), 6 deletions(-)
 create mode 100644 packages/stinst/parser/STCompilerTests.st

diff --git a/packages/stinst/parser/Makefile.frag 
b/packages/stinst/parser/Makefile.frag
index 05ef067..b70055b 100644
--- a/packages/stinst/parser/Makefile.frag
+++ b/packages/stinst/parser/Makefile.frag
@@ -1,5 +1,5 @@
 Parser_FILES = \
-packages/stinst/parser/ChangeLog 
packages/stinst/parser/DebugInformationTests.st 
packages/stinst/parser/Exporter.st packages/stinst/parser/Extensions.st 
packages/stinst/parser/GSTParser.st packages/stinst/parser/GSTParserTests.st 
packages/stinst/parser/NewSyntaxExporter.st 
packages/stinst/parser/OldSyntaxExporter.st 
packages/stinst/parser/OrderedSet.st 
packages/stinst/parser/ParseTreeSearcher.st 
packages/stinst/parser/PoolResolutionTests.st 
packages/stinst/parser/RBFormatter.st packages/stinst/parser/RBParseNodes.st 
packages/stinst/parser/RBParser.st packages/stinst/parser/RBToken.st 
packages/stinst/parser/RewriteTests.st packages/stinst/parser/SIFParser.st 
packages/stinst/parser/SqueakExporter.st packages/stinst/parser/SqueakParser.st 
packages/stinst/parser/STCompiler.st packages/stinst/parser/STCompLit.st 
packages/stinst/parser/STDecompiler.st 
packages/stinst/parser/STEvaluationDriver.st 
packages/stinst/parser/STFileParser.st packages/stinst/parser/STLoaderObjs.st 
packages/stinst/
 parser/STLoaderObjsTests.st packages/stinst/parser/STLoader.st 
packages/stinst/parser/STSymTable.st 
+packages/stinst/parser/ChangeLog 
packages/stinst/parser/DebugInformationTests.st 
packages/stinst/parser/Exporter.st packages/stinst/parser/Extensions.st 
packages/stinst/parser/GSTParser.st packages/stinst/parser/GSTParserTests.st 
packages/stinst/parser/NewSyntaxExporter.st 
packages/stinst/parser/OldSyntaxExporter.st 
packages/stinst/parser/OrderedSet.st 
packages/stinst/parser/ParseTreeSearcher.st 
packages/stinst/parser/PoolResolutionTests.st 
packages/stinst/parser/RBFormatter.st packages/stinst/parser/RBParseNodes.st 
packages/stinst/parser/RBParser.st packages/stinst/parser/RBToken.st 
packages/stinst/parser/RewriteTests.st packages/stinst/parser/SIFParser.st 
packages/stinst/parser/SqueakExporter.st packages/stinst/parser/SqueakParser.st 
packages/stinst/parser/STCompiler.st packages/stinst/parser/STCompilerTests.st 
packages/stinst/parser/STCompLit.st packages/stinst/parser/STDecompiler.st 
packages/stinst/parser/STEvaluationDriver.st 
packages/stinst/parser/STFileParser.st packages/stin
 st/parser/STLoaderObjs.st packages/stinst/parser/STLoaderObjsTests.st 
packages/stinst/parser/STLoader.st packages/stinst/parser/STSymTable.st 
 $(Parser_FILES):
 $(srcdir)/packages/stinst/parser/stamp-classes: $(Parser_FILES)
        touch $(srcdir)/packages/stinst/parser/stamp-classes
diff --git a/packages/stinst/parser/STCompiler.st 
b/packages/stinst/parser/STCompiler.st
index e8bccac..098437d 100644
--- a/packages/stinst/parser/STCompiler.st
+++ b/packages/stinst/parser/STCompiler.st
@@ -7,7 +7,7 @@
 
 "======================================================================
 |
-| Copyright 1999,2000,2001,2002,2003,2006,2007,2009 Free Software Foundation, 
Inc.
+| Copyright 1999,2000,2001,2002,2003,2006,2007,2009,2013 Free Software 
Foundation, Inc.
 | Written by Paolo Bonzini.
 |
 | This file is part of GNU Smalltalk.
@@ -157,7 +157,7 @@ indexed'' bytecode. The resulting stream is
        | compiler method |
        compiler := self new.
        compiler class: aBehavior parser: aParser.
-       aNamespace isNil ifFalse: [compiler addPool: aNamespace].
+       aNamespace isNil ifFalse: [compiler addPoolFirst: aNamespace].
        method := compiler visitNode: methodNode.
        aString isNil ifFalse: [ method methodCategory: aString ].
        ^method
@@ -179,9 +179,9 @@ indexed'' bytecode. The resulting stream is
        ^(symTable addLiteral: literal)
     ]
 
-    addPool: aNamespace [
+    addPoolFirst: aNamespace [
        <category: 'accessing'>
-       ^symTable addPool: aNamespace
+       ^symTable addPoolFirst: aNamespace
     ]
 
     bytecodesFor: aBlockNode [
diff --git a/packages/stinst/parser/STCompilerTests.st 
b/packages/stinst/parser/STCompilerTests.st
new file mode 100644
index 0000000..f4ae651
--- /dev/null
+++ b/packages/stinst/parser/STCompilerTests.st
@@ -0,0 +1,57 @@
+"======================================================================
+|
+|   Smalltalk in Smalltalk compiler tests
+|
+|
+ ======================================================================"
+
+"======================================================================
+|
+| Copyright 2013 Free Software Foundation, Inc.
+| Written by Holger Hans Peter Freyther.
+|
+| This file is part of GNU Smalltalk.
+|
+| GNU Smalltalk is free software; you can redistribute it and/or modify it
+| under the terms of the GNU General Public License as published by the Free
+| Software Foundation; either version 2, or (at your option) any later version.
+| 
+| GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+| FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+| details.
+| 
+| You should have received a copy of the GNU General Public License along with
+| GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
+| Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  
+|
+ ======================================================================"
+
+
+TestCase subclass: TestCompiler [
+    <comment: 'I do basic compiler tests.'>
+
+    doubleName [
+        ^ '
+Namespace current: (Smalltalk addSubspace: #CompilerDoubleName).
+Object subclass: CompilerDoubleName [
+    | one two three |
+    <category: ''bla''>
+]'
+        
+    ]
+
+    testPoolResolution [
+        <category: 'testing'>
+
+        self deny: (Smalltalk includesGlobalNamed: #CompilerDoubleName).
+
+        STEvaluationDriver new
+            parseSmalltalkStream: self doubleName readStream
+            with: GSTFileInParser.
+
+        self assert: (Smalltalk includesGlobalNamed: #CompilerDoubleName).
+        self assert: (CompilerDoubleName includesGlobalNamed: 
#CompilerDoubleName).
+        self assert: ((Smalltalk at: #CompilerDoubleName) at: 
#CompilerDoubleName) instVarNames size = 3.
+    ]
+]
diff --git a/packages/stinst/parser/STSymTable.st 
b/packages/stinst/parser/STSymTable.st
index 40e5625..b6bf7fd 100644
--- a/packages/stinst/parser/STSymTable.st
+++ b/packages/stinst/parser/STSymTable.st
@@ -264,11 +264,16 @@ Object subclass: STSymbolTable [
        ^super new init
     ]
 
-    addPool: poolDictionary [
+    addPoolLast: poolDictionary [
        <category: 'declaring'>
        pools addPoolLast: poolDictionary
     ]
 
+    addPoolFirst: poolDictionary [
+        <category: 'declaring'>
+        pools addPoolFirst: poolDictionary.
+    ]
+
     declareEnvironment: aBehavior [
        <category: 'declaring'>
        | i |
diff --git a/packages/stinst/parser/package.xml 
b/packages/stinst/parser/package.xml
index 106ce80..6102af7 100644
--- a/packages/stinst/parser/package.xml
+++ b/packages/stinst/parser/package.xml
@@ -37,11 +37,13 @@
    <sunit>STInST.Tests.TestDebugInformation</sunit>
    <sunit>STInST.Tests.TestSTLoaderObjects</sunit>
    <sunit>STInST.Tests.TestGSTParser</sunit>
+   <sunit>STInST.Tests.TestCompiler</sunit>
    <filein>RewriteTests.st</filein>
    <filein>PoolResolutionTests.st</filein>
    <filein>DebugInformationTests.st</filein>
    <filein>STLoaderObjsTests.st</filein>
    <filein>GSTParserTests.st</filein>
+   <filein>STCompilerTests.st</filein>
   </test>
 
   <file>ChangeLog</file>
-- 
1.8.5.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]