|
return self}, self, "errorUnknownVariable:", [aNode], smalltalk.SemanticAnalyzer)},
|
|
return self}, self, "errorUnknownVariable:", [aNode], smalltalk.SemanticAnalyzer)},
|
|
|
|
+source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a We allow four variable names in addition: `jQuery`, `window`, `process` and `global` \x0a for nodejs and browser environments. \x0a \x0a This is only to make sure compilation works on both browser-based and nodejs environments.\x0a The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a identifier := aNode value.\x0a \x0a\x09((#('jQuery' 'window' 'process' 'global') includes: identifier) not \x0a and: [ self isVariableGloballyUndefined: identifier ]) \x0a \x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
|
|
messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:"],
|
|
messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:"],
|