瀏覽代碼

Do not reference `window' in SemanticAnalyzer

Nicolas Petton 12 年之前
父節點
當前提交
c5ec3b2969
共有 3 個文件被更改,包括 625 次插入633 次删除
  1. 309 315
      js/Compiler-Semantic.deploy.js
  2. 309 315
      js/Compiler-Semantic.js
  3. 7 3
      st/Compiler-Semantic.st

文件差異過大導致無法顯示
+ 309 - 315
js/Compiler-Semantic.deploy.js


文件差異過大導致無法顯示
+ 309 - 315
js/Compiler-Semantic.js


+ 7 - 3
st/Compiler-Semantic.st

@@ -408,12 +408,16 @@ errorShadowingVariable: aString
 errorUnknownVariable: aNode
 	"Throw an error if the variable is undeclared in the global JS scope (i.e. window)"
 
-	(window at: aNode value) 
-		ifNil: [ 
+	| notDefined |
+
+	notDefined := <eval('typeof ' + aNode._value() + ' == "undefined"')>.
+
+	notDefined
+		ifTrue: [ 
 			UnknownVariableError new
 				variableName: aNode value;
 				signal ]
-		ifNotNil: [
+		ifFalse: [
 			currentScope methodScope unknownVariables add: aNode value. ]
 ! !
 

部分文件因文件數量過多而無法顯示