1
0

Compiler-Exceptions.st 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Smalltalk current createPackage: 'Compiler-Exceptions' properties: #{}!
  2. Error subclass: #CompilerError
  3. instanceVariableNames: ''
  4. package: 'Compiler-Exceptions'!
  5. CompilerError subclass: #ParseError
  6. instanceVariableNames: ''
  7. package: 'Compiler-Exceptions'!
  8. CompilerError subclass: #SemanticError
  9. instanceVariableNames: ''
  10. package: 'Compiler-Exceptions'!
  11. !SemanticError commentStamp!
  12. I represent an abstract semantic error thrown by the SemanticAnalyzer.
  13. Semantic errors can be unknown variable errors, etc.
  14. See my subclasses for concrete errors.
  15. The IDE should catch instances of Semantic error to deal with them when compiling!
  16. SemanticError subclass: #ShadowingVariableError
  17. instanceVariableNames: 'variableName'
  18. package: 'Compiler-Exceptions'!
  19. !ShadowingVariableError commentStamp!
  20. I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
  21. !ShadowingVariableError methodsFor: 'accessing'!
  22. variableName
  23. ^ variableName
  24. !
  25. variableName: aString
  26. variableName := aString
  27. ! !
  28. SemanticError subclass: #UnknownVariableError
  29. instanceVariableNames: 'variableName'
  30. package: 'Compiler-Exceptions'!
  31. !UnknownVariableError commentStamp!
  32. I get signaled when a variable is not defined.
  33. The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
  34. !UnknownVariableError methodsFor: 'accessing'!
  35. variableName
  36. ^ variableName
  37. !
  38. variableName: aString
  39. variableName := aString
  40. ! !