Compiler-Exceptions.st 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: #InvalidAssignmentError
  17. instanceVariableNames: 'variableName'
  18. package: 'Compiler-Exceptions'!
  19. !InvalidAssignmentError commentStamp!
  20. I get signaled when a pseudo variable gets assigned.!
  21. !InvalidAssignmentError methodsFor: 'accessing'!
  22. variableName
  23. ^ variableName
  24. !
  25. variableName: aString
  26. variableName := aString
  27. ! !
  28. SemanticError subclass: #ShadowingVariableError
  29. instanceVariableNames: 'variableName'
  30. package: 'Compiler-Exceptions'!
  31. !ShadowingVariableError commentStamp!
  32. I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
  33. !ShadowingVariableError methodsFor: 'accessing'!
  34. variableName
  35. ^ variableName
  36. !
  37. variableName: aString
  38. variableName := aString
  39. ! !
  40. SemanticError subclass: #UnknownVariableError
  41. instanceVariableNames: 'variableName'
  42. package: 'Compiler-Exceptions'!
  43. !UnknownVariableError commentStamp!
  44. I get signaled when a variable is not defined.
  45. The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
  46. !UnknownVariableError methodsFor: 'accessing'!
  47. variableName
  48. ^ variableName
  49. !
  50. variableName: aString
  51. variableName := aString
  52. ! !