Ryan Macnak avatar Ryan Macnak committed 927fdca

Compiler cleanup: remove some uninteresting asserts

Comments (0)

Files changed (1)

Newspeak3Compilation.ns3

    statementStarting:: shouldPop.
 )
 boolNode: node = (
-  assert: [ node isBoolNode] message: 'Boolean node expected'.
+  "assert: [ node isBoolNode] message: 'Boolean node expected'."
   node val ifTrue:[cgen pushBoolTrue]
                ifFalse:[cgen pushBoolFalse].
 )
 	popScope. popOffsetCounter. contextDepth: contextDepth - 1.
 )
 contextNode: node = (
-  assert: [ node isContextNode ] message: 'Context expected'.
+  "assert: [ node isContextNode ] message: 'Context expected'."
   cgen pushThisContext.
 )
 currentMethod ^ <SemanticMethod> = (
 	^next
 )
 nilNode: node = (
-  assert: [ node isNilNode ] message: 'Nil node expected'.
+  "assert: [ node isNilNode ] message: 'Nil node expected'."
   cgen pushNilObj.
 )
 numberNode: node <NumberAST>  = (
-	assert:[node isNumberNode] message: 'Number node expected'.
+	"assert:[node isNumberNode] message: 'Number node expected'."
 	cgen pushLiteral: node val.
 )
 pc = (
 	 "statementStarting:: true" "set up for next statement"
 )
 stringNode: node <StringAST>  = (
-	assert:[node isStringNode] message: 'String node expected'.
+	"assert:[node isStringNode] message: 'String node expected'."
 	cgen pushLiteral: node val.
 )
 symbolNode: node <SymbolAST>  = (
-	assert:[node isSymbolNode] message: 'Symbol node expected'.
+	"assert:[node isSymbolNode] message: 'Symbol node expected'."
 	cgen pushLiteral: node val.
 )'node traversal'
 assignmentNode: node <AssignmentAST> = (
 
 | i <Integer>  shouldPop <Boolean> |
-	assert: [ node isAssignmentNode] message: 'Assignment node expected'.
+	"assert: [ node isAssignmentNode] message: 'Assignment node expected'."
 	shouldPop:: statementStarting.
 	statementStarting:: false. 
 	node expr apply: self.
 )
 normalSendNode: node <NormalSendAST> = (
 | shouldPop <Boolean>  |
-   assert: [ node isNormalSendNode] message: 'NormalSendNode expected'.
+   "assert: [ node isNormalSendNode] message: 'NormalSendNode expected'."
    shouldPop:: statementStarting.
    statementStarting:: false.
    node recv apply: self.
 	cgen pushTemporary: (indexOfVar: node).
 )
 receiverNode: node = (
-  assert: [ node isReceiverNode] message: 'Receiver node expected'.
+  "assert: [ node isReceiverNode] message: 'Receiver node expected'."
   cgen pushSelf.
 )
 returnInstVarMethodNode: node <ReturnInstVarMethodAST>
     assert: [node isExplicitRcvrNode].
     ^node
 )
-implicitSendNode: node
- = (
-    assert: [node isImplicitSendNode].
+implicitSendNode: node = (
     ^node
 )
 initializerForRemoteVector: itvname sized: itvsize = (
 	^node
 )
 numberNode: node = (
-  assert:[node isNumberNode].
   addNumericLiteral: node val.
   ^node
 )
 send <NormalSendAST>  
 cb <CodeBodyAST>  
 |
-	assert: [node isSetterSendNode ].
 	setterBinding:: currentScope at: node msg sel ifAbsent: [MessageAST new].
 	setterBinding isVarDeclNode ifTrue: [^processVariable: node msg decl: setterBinding].
 	"This is an assignment to a temporary - no special handling needed"
 	"recognize inst vars for accessor methods? handle temps etc."
 	^aNode
 )'node traversal'
-assignmentNode: node <AssignmentAST> ^ <AssignmentAST>
- = (
-    assert: [ node isAssignmentNode ]. "note write to target variable!"
+assignmentNode: node <AssignmentAST> ^ <AssignmentAST> = (
     ^AssignmentAST new to: (node var apply: self) assign: (node expr apply: self);
                                       start: node start; end: node end
 )
 cascadedSendNode: node <CascadeSendAST> ^ <CascadeSendAST>
  = ( 
  | prevSend msg |
- assert: [node isCascadedSendNode].
  prevSend:: node prevSend apply: self.
  msg:: node msg apply: self.
 
   ^node
 )
 codeBodyNode: node <CodeBodyAST> ^ <CodeBodyAST> = (
-    | 
-       bodyScope <Scope>
-       statements <OrderedCollection[StatementAST]>
-       temps <OrderedCollection[TemporaryAST]> 
-       result <CodeBodyAST>
+	| 
+	bodyScope <Scope>
+	statements <OrderedCollection[StatementAST]>
+	temps <OrderedCollection[TemporaryAST]> 
+	result <CodeBodyAST>
 	itv <TemporaryAST>
 	i <Integer>
 	finder <NeedsIndirectionFinder>
-    |
-	assert: [node isCodeBodyNode].
+	|
 	pushScopeForNode: node. 
 	bodyScope:: scopeMap at: node.
 
 	scopeMap at: result put: bodyScope.
 	^result.
 )
-ifNode: node <ifAST> ^ <ifAST>
- = (
- assert: [ node isIfNode ].
- ^node
-)
-loopNode: node <LoopAST> ^ <LoopAST>
- = (
+ifNode: node <ifAST> ^ <ifAST> = (
+	^node
+)
+loopNode: node <LoopAST> ^ <LoopAST> = (
     ^node
 )
 messageNode: node <MessageAST> ^ <MessageAST>
  = (
     | args |
-    assert: [node isMessageNode].
     args:: OrderedCollection new.
     node args do: [ :arg | args add: (arg apply: self)].
     addLiteral: node sel.
     ^ReturnStatAST new expr: (node expr apply: self); 
                                       start: node start; end: node end
 )
-stringNode: node
- = (
-    assert: [ node isStringNode ].
+stringNode: node = (
     addLiteralConstant: node val asSymbol.
     ^node
 )
-superSendNode: node
- = (
-    assert: [node isSuperSendNode ].
+superSendNode: node = (
     ^node
 )
-symbolNode: node
- = (
-    assert: [ node isSymbolNode ].
+symbolNode: node = (
     addLiteralConstant: node val.
     ^node
 )'patterns'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.