Commit 96e84439 authored by Austin Clements's avatar Austin Clements

Implement all unary and binary arithmetic operators.

R=rsc
APPROVED=rsc
DELTA=689  (497 added, 169 deleted, 23 changed)
OCL=31755
CL=31772
parent e52e9ca8
......@@ -20,6 +20,8 @@ type Type interface {
// compatible returns true if this type is compatible with o.
// XXX Assignment versus comparison compatibility?
compatible(o Type) bool;
// isBoolean returns true if this is a boolean type.
isBoolean() bool;
// isInteger returns true if this is an integer type.
isInteger() bool;
// isFloat returns true if this is a floating type.
......
This diff is collapsed.
......@@ -29,6 +29,10 @@ import (
type commonType struct {
}
func (commonType) isBoolean() bool {
return false;
}
func (commonType) isInteger() bool {
return false;
}
......@@ -55,6 +59,10 @@ func (t *boolType) compatible(o Type) bool {
return Type(t) == o;
}
func (t *boolType) isBoolean() bool {
return true;
}
func (boolType) String() string {
return "bool";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment