2
0

Compiler-Exceptions.st 1.9 KB

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