Title: [222215] trunk/Tools
Revision
222215
Author
[email protected]
Date
2017-09-19 11:28:25 -0700 (Tue, 19 Sep 2017)

Log Message

Primitive protocol should have capital name
https://bugs.webkit.org/show_bug.cgi?id=177097

Reviewed by JF Bastien.
        
As soon as I started programming in WSL, I found that I preferred to capitalize protocol names. So, my
early decision to call the primitive protocol "primitive" instead of "Primitive" seems absurd now. This
change reverses that decision.
        
Aesthetically, this is a slight improvement. For example:
        
    struct Bar<T:Primitive> {
        Foo<device T^> f;
    }

This makes more sense since all of the non-keyword type identifiers are capital.
        
The one place where this is an aesthetic regression is native primitive typedefs, which now look like:
        
    native Primitive typedef bool;
        
I'm happy with that tradeoff, since native typedefs are only in the standard library. Users don't see
this.

* WebGPUShadingLanguageRI/AddressSpace.js:
(protocolSuffix):
* WebGPUShadingLanguageRI/Intrinsics.js:
(Intrinsics):
* WebGPUShadingLanguageRI/NativeType.js:
(NativeType.prototype.toString):
(NativeType):
* WebGPUShadingLanguageRI/Parse.js:
(parseNative):
* WebGPUShadingLanguageRI/StandardLibrary.js:
* WebGPUShadingLanguageRI/Test.js:
(TEST_passNullAndNotNullFullPoly):
(TEST_passNullAndNotNullFullPolyReverse):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (222214 => 222215)


--- trunk/Tools/ChangeLog	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/ChangeLog	2017-09-19 18:28:25 UTC (rev 222215)
@@ -1,3 +1,43 @@
+2017-09-19  Filip Pizlo  <[email protected]>
+
+        Primitive protocol should have capital name
+        https://bugs.webkit.org/show_bug.cgi?id=177097
+
+        Reviewed by JF Bastien.
+        
+        As soon as I started programming in WSL, I found that I preferred to capitalize protocol names. So, my
+        early decision to call the primitive protocol "primitive" instead of "Primitive" seems absurd now. This
+        change reverses that decision.
+        
+        Aesthetically, this is a slight improvement. For example:
+        
+            struct Bar<T:Primitive> {
+                Foo<device T^> f;
+            }
+
+        This makes more sense since all of the non-keyword type identifiers are capital.
+        
+        The one place where this is an aesthetic regression is native primitive typedefs, which now look like:
+        
+            native Primitive typedef bool;
+        
+        I'm happy with that tradeoff, since native typedefs are only in the standard library. Users don't see
+        this.
+
+        * WebGPUShadingLanguageRI/AddressSpace.js:
+        (protocolSuffix):
+        * WebGPUShadingLanguageRI/Intrinsics.js:
+        (Intrinsics):
+        * WebGPUShadingLanguageRI/NativeType.js:
+        (NativeType.prototype.toString):
+        (NativeType):
+        * WebGPUShadingLanguageRI/Parse.js:
+        (parseNative):
+        * WebGPUShadingLanguageRI/StandardLibrary.js:
+        * WebGPUShadingLanguageRI/Test.js:
+        (TEST_passNullAndNotNullFullPoly):
+        (TEST_passNullAndNotNullFullPolyReverse):
+
 2017-09-18  Filip Pizlo  <[email protected]>
 
         Cannot put typedefs of templated structs inside structs

Modified: trunk/Tools/WebGPUShadingLanguageRI/AddressSpace.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/AddressSpace.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/AddressSpace.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -46,7 +46,7 @@
 
 function protocolSuffix(addressSpace)
 {
-    return needsPrimitiveProtocol(addressSpace) ? ":primitive" : "";
+    return needsPrimitiveProtocol(addressSpace) ? ":Primitive" : "";
 }
 
 function validateAddressSpace(addressSpace)

Modified: trunk/Tools/WebGPUShadingLanguageRI/Intrinsics.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/Intrinsics.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/Intrinsics.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -27,7 +27,7 @@
 class Intrinsics {
     constructor(nameContext)
     {
-        this.primitive = new ProtocolDecl(null, "primitive");
+        this.primitive = new ProtocolDecl(null, "Primitive");
         this.primitive.isPrimitive = true;
         nameContext.add(this.primitive);
         
@@ -39,7 +39,7 @@
         // use "int" here, since we don't yet know that they are the same type.
         
         this._map.set(
-            "native primitive type void<>",
+            "native Primitive type void<>",
             type => {
                 this.void = type;
                 type.size = 0;
@@ -61,7 +61,7 @@
         }
 
         this._map.set(
-            "native primitive type int32<>",
+            "native Primitive type int32<>",
             type => {
                 this.int32 = type;
                 type.isInt = true;
@@ -79,7 +79,7 @@
             });
 
         this._map.set(
-            "native primitive type uint32<>",
+            "native Primitive type uint32<>",
             type => {
                 this.uint32 = type;
                 type.isInt = true;
@@ -97,7 +97,7 @@
             });
 
         this._map.set(
-            "native primitive type float<>",
+            "native Primitive type float<>",
             type => {
                 this.float = type;
                 type.size = 1;
@@ -112,7 +112,7 @@
             });
 
         this._map.set(
-            "native primitive type double<>",
+            "native Primitive type double<>",
             type => {
                 this.double = type;
                 type.size = 1;
@@ -127,7 +127,7 @@
             });
 
         this._map.set(
-            "native primitive type bool<>",
+            "native Primitive type bool<>",
             type => {
                 this.bool = type;
                 type.size = 1;

Modified: trunk/Tools/WebGPUShadingLanguageRI/NativeType.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/NativeType.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/NativeType.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -62,7 +62,7 @@
     
     toString()
     {
-        return "native " + (this.isPrimitive ? "primitive " : "") + "type " + this.name + "<" + this.typeParameters + ">";
+        return "native " + (this.isPrimitive ? "Primitive " : "") + "type " + this.name + "<" + this.typeParameters + ">";
     }
 }
 

Modified: trunk/Tools/WebGPUShadingLanguageRI/Parse.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/Parse.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/Parse.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -921,7 +921,7 @@
         let isType = lexer.backtrackingScope(() => {
             if (tryConsume("typedef"))
                 return "normal";
-            consume("primitive");
+            consume("Primitive");
             consume("typedef");
             return "primitive";
         });

Modified: trunk/Tools/WebGPUShadingLanguageRI/StandardLibrary.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/StandardLibrary.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/StandardLibrary.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -27,20 +27,20 @@
 // NOTE: The next line is line 28, and we rely on this in Prepare.js.
 const standardLibrary = `
 // This is the WSL standard library. Implementations of all of these things are in
-// Intrinsics.js. The only thing that gets defined before we get here is the primitive
+// Intrinsics.js. The only thing that gets defined before we get here is the Primitive
 // protocol.
 
 // Need to bootstrap void first.
-native primitive typedef void;
+native Primitive typedef void;
 
-native primitive typedef int32;
-native primitive typedef uint32;
-native primitive typedef bool;
+native Primitive typedef int32;
+native Primitive typedef uint32;
+native Primitive typedef bool;
 typedef int = int32;
 typedef uint = uint32;
 
-native primitive typedef float;
-native primitive typedef double;
+native Primitive typedef float;
+native Primitive typedef double;
 
 native operator int32(uint32);
 native operator uint32(int32);
@@ -337,14 +337,14 @@
 }
 
 native thread T^ operator&[]<T>(thread T[], uint);
-native threadgroup T^ operator&[]<T:primitive>(threadgroup T[], uint);
-native device T^ operator&[]<T:primitive>(device T[], uint);
-native constant T^ operator&[]<T:primitive>(constant T[], uint);
+native threadgroup T^ operator&[]<T:Primitive>(threadgroup T[], uint);
+native device T^ operator&[]<T:Primitive>(device T[], uint);
+native constant T^ operator&[]<T:Primitive>(constant T[], uint);
 
 native uint operator.length<T>(thread T[]);
-native uint operator.length<T:primitive>(threadgroup T[]);
-native uint operator.length<T:primitive>(device T[]);
-native uint operator.length<T:primitive>(constant T[]);
+native uint operator.length<T:Primitive>(threadgroup T[]);
+native uint operator.length<T:Primitive>(device T[]);
+native uint operator.length<T:Primitive>(constant T[]);
 
 uint operator.length<T, uint length>(T[length])
 {

Modified: trunk/Tools/WebGPUShadingLanguageRI/Test.js (222214 => 222215)


--- trunk/Tools/WebGPUShadingLanguageRI/Test.js	2017-09-19 18:07:57 UTC (rev 222214)
+++ trunk/Tools/WebGPUShadingLanguageRI/Test.js	2017-09-19 18:28:25 UTC (rev 222215)
@@ -926,7 +926,7 @@
 function TEST_passNullAndNotNull()
 {
     let program = doPrep(`
-        T bar<T:primitive>(device T^ p, device T^)
+        T bar<T:Primitive>(device T^ p, device T^)
         {
             return ^p;
         }
@@ -943,7 +943,7 @@
 function TEST_passNullAndNotNullFullPoly()
 {
     let program = doPrep(`
-        T bar<T:primitive>(T p, T)
+        T bar<T:Primitive>(T p, T)
         {
             return p;
         }
@@ -960,7 +960,7 @@
 function TEST_passNullAndNotNullFullPolyReverse()
 {
     let program = doPrep(`
-        T bar<T:primitive>(T, T p)
+        T bar<T:Primitive>(T, T p)
         {
             return p;
         }
@@ -2020,7 +2020,7 @@
         struct Foo<T> {
             T f;
         }
-        struct Bar<T:primitive> {
+        struct Bar<T:Primitive> {
             Foo<device T^> f;
         }
         int foo(thread Bar<int>^ x)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to