mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Reserve the "ideal" name.
Also reject using built-in names as struct or func names.
This commit is contained in:
1 parent
567e6f7459
commit
a8a246be7c
3 files changed
+17
-8
No files matched your search
+3
-8
@@ -12,18 +12,13 @@ import (
|
||||
t "github.com/google/puffs/lang/token"
|
||||
)
|
||||
|
||||
// DummyTypeIdealNumber is an a.Node.MType field that means that n is an ideal
|
||||
// numeric constant.
|
||||
//
|
||||
// TODO: change 1 to a named constant.
|
||||
var DummyTypeIdealNumber = a.NewTypeExpr(0, 1, nil, nil, nil)
|
||||
// DummyTypeIdealNumber is an *ast.Node MType (implicit type) that means that n
|
||||
// is an ideal numeric constant.
|
||||
var DummyTypeIdealNumber = a.NewTypeExpr(0, t.IDIdeal, nil, nil, nil)
|
||||
|
||||
// TypeString returns a string form of the type n.
|
||||
func TypeString(m *t.IDMap, n *a.TypeExpr) string {
|
||||
if n != nil {
|
||||
if n == DummyTypeIdealNumber {
|
||||
return "!ideal!"
|
||||
}
|
||||
switch n.PackageOrDecorator() {
|
||||
case 0:
|
||||
return m.ByID(n.Name())
|
||||
|
||||
Reference in new issue
Block a user