1
0

Compiler-Exceptions.st 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Smalltalk current createPackage: 'Compiler-Exceptions' properties: #{}!
  2. Error subclass: #CompilerError
  3. instanceVariableNames: ''
  4. package: 'Compiler-Exceptions'!
  5. !CompilerError commentStamp!
  6. I am the common superclass of all compiling errors.!
  7. CompilerError subclass: #ParseError
  8. instanceVariableNames: ''
  9. package: 'Compiler-Exceptions'!
  10. !ParseError commentStamp!
  11. Instance of ParseError are signaled on any parsing error.
  12. See `Smalltalk >> #parse:`!
  13. CompilerError subclass: #SemanticError
  14. instanceVariableNames: ''
  15. package: 'Compiler-Exceptions'!
  16. !SemanticError commentStamp!
  17. I represent an abstract semantic error thrown by the SemanticAnalyzer.
  18. Semantic errors can be unknown variable errors, etc.
  19. See my subclasses for concrete errors.
  20. The IDE should catch instances of Semantic error to deal with them when compiling!
  21. SemanticError subclass: #InliningError
  22. instanceVariableNames: ''
  23. package: 'Compiler-Exceptions'!
  24. !InliningError commentStamp!
  25. Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.!
  26. SemanticError subclass: #InvalidAssignmentError
  27. instanceVariableNames: 'variableName'
  28. package: 'Compiler-Exceptions'!
  29. !InvalidAssignmentError commentStamp!
  30. I get signaled when a pseudo variable gets assigned.!
  31. !InvalidAssignmentError methodsFor: 'accessing'!
  32. messageText
  33. ^ ' Invalid assignment to variable: ', self variableName
  34. !
  35. variableName
  36. ^ variableName
  37. !
  38. variableName: aString
  39. variableName := aString
  40. ! !
  41. SemanticError subclass: #ShadowingVariableError
  42. instanceVariableNames: 'variableName'
  43. package: 'Compiler-Exceptions'!
  44. !ShadowingVariableError commentStamp!
  45. I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.!
  46. !ShadowingVariableError methodsFor: 'accessing'!
  47. messageText
  48. ^ 'Variable shadowing error: ', self variableName, ' is already defined'
  49. !
  50. variableName
  51. ^ variableName
  52. !
  53. variableName: aString
  54. variableName := aString
  55. ! !
  56. SemanticError subclass: #UnknownVariableError
  57. instanceVariableNames: 'variableName'
  58. package: 'Compiler-Exceptions'!
  59. !UnknownVariableError commentStamp!
  60. I get signaled when a variable is not defined.
  61. The default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.!
  62. !UnknownVariableError methodsFor: 'accessing'!
  63. variableName
  64. ^ variableName
  65. !
  66. variableName: aString
  67. variableName := aString
  68. ! !