[WHLSL] Delete the 'restricted' keyword
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2019 00:59:15 +0000 (00:59 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2019 00:59:15 +0000 (00:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193469

Reviewed by Dean Jackson and Robin Morisset.

This change mirrors https://github.com/gpuweb/WHLSL/pull/304 in the reference implementation.

No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
of test. When enough of the compiler is present, I'll port the reference implementation's test suite.

* Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
(WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
(WebCore::WHLSL::AST::FunctionDefinition::block):
(WebCore::WHLSL::AST::FunctionDefinition::restricted const): Deleted.
* Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
(WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
(WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const): Deleted.
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveWithOperatorAnderIndexer):
(WebCore::WHLSL::resolveWithOperatorLength):
(WebCore::WHLSL::resolveWithReferenceComparator):
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
(WebCore::WHLSL::resolveFunctionOverloadImpl):
* Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
(WebCore::WHLSL::synthesizeArrayOperatorLength):
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
(WebCore::WHLSL::synthesizeConstructors):
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
(WebCore::WHLSL::synthesizeEnumerationFunctions):
* Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
(WebCore::WHLSL::synthesizeStructureAccessors):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h
Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h
Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp
Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp

index e92536b..2aae9ae 100644 (file)
@@ -1,5 +1,39 @@
 2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [WHLSL] Delete the 'restricted' keyword
+        https://bugs.webkit.org/show_bug.cgi?id=193469
+
+        Reviewed by Dean Jackson and Robin Morisset.
+
+        This change mirrors https://github.com/gpuweb/WHLSL/pull/304 in the reference implementation.
+
+        No new tests because it isn't hooked up yet. Not enough of the compiler exists to have any meaningful sort
+        of test. When enough of the compiler is present, I'll port the reference implementation's test suite.
+
+        * Modules/webgpu/WHLSL/AST/WHLSLFunctionDefinition.h:
+        (WebCore::WHLSL::AST::FunctionDefinition::FunctionDefinition):
+        (WebCore::WHLSL::AST::FunctionDefinition::block):
+        (WebCore::WHLSL::AST::FunctionDefinition::restricted const): Deleted.
+        * Modules/webgpu/WHLSL/AST/WHLSLNativeFunctionDeclaration.h:
+        (WebCore::WHLSL::AST::NativeFunctionDeclaration::NativeFunctionDeclaration):
+        (WebCore::WHLSL::AST::NativeFunctionDeclaration::restricted const): Deleted.
+        * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
+        (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
+        (WebCore::WHLSL::resolveWithOperatorLength):
+        (WebCore::WHLSL::resolveWithReferenceComparator):
+        * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
+        (WebCore::WHLSL::resolveFunctionOverloadImpl):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
+        (WebCore::WHLSL::synthesizeArrayOperatorLength):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
+        (WebCore::WHLSL::synthesizeConstructors):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
+        (WebCore::WHLSL::synthesizeEnumerationFunctions):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
+        (WebCore::WHLSL::synthesizeStructureAccessors):
+
+2019-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [WHLSL] Implement the recursion checker
         https://bugs.webkit.org/show_bug.cgi?id=193436
 
index ce58b6a..79abd9e 100644 (file)
@@ -38,10 +38,9 @@ namespace AST {
 
 class FunctionDefinition : public FunctionDeclaration {
 public:
-    FunctionDefinition(FunctionDeclaration&& functionDeclaration, Block&& block, bool restricted)
+    FunctionDefinition(FunctionDeclaration&& functionDeclaration, Block&& block)
         : FunctionDeclaration(WTFMove(functionDeclaration))
         , m_block(WTFMove(block))
-        , m_restricted(restricted)
     {
     }
 
@@ -53,11 +52,9 @@ public:
     bool isFunctionDefinition() const override { return true; }
 
     Block& block() { return m_block; }
-    bool restricted() const { return m_restricted; }
 
 private:
     Block m_block;
-    bool m_restricted;
 };
 
 } // namespace AST
index d81a38c..8827623 100644 (file)
@@ -37,9 +37,8 @@ namespace AST {
 
 class NativeFunctionDeclaration : public FunctionDeclaration {
 public:
-    NativeFunctionDeclaration(FunctionDeclaration&& functionDeclaration, bool restricted)
+    NativeFunctionDeclaration(FunctionDeclaration&& functionDeclaration)
         : FunctionDeclaration(WTFMove(functionDeclaration))
-        , m_restricted(restricted)
     {
     }
 
@@ -50,10 +49,7 @@ public:
 
     bool isNativeFunctionDeclaration() const override { return true; }
 
-    bool restricted() const { return m_restricted; }
-
 private:
-    bool m_restricted;
 };
 
 } // namespace AST
index 7b6ad2c..60b0efe 100644 (file)
@@ -119,28 +119,25 @@ public:
 
 static AST::NativeFunctionDeclaration resolveWithOperatorAnderIndexer(AST::CallExpression& callExpression, AST::ArrayReferenceType& firstArgument, const Intrinsics& intrinsics)
 {
-    const bool isRestricted = false;
     const bool isOperator = true;
     auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(callExpression.origin()), firstArgument.addressSpace(), firstArgument.elementType().clone());
     AST::VariableDeclarations parameters;
     parameters.append(AST::VariableDeclaration(Lexer::Token(callExpression.origin()), AST::Qualifiers(), { firstArgument.clone() }, String(), WTF::nullopt, WTF::nullopt));
     parameters.append(AST::VariableDeclaration(Lexer::Token(callExpression.origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(callExpression.origin()), intrinsics.uintType()) }, String(), WTF::nullopt, WTF::nullopt));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
 }
 
 static AST::NativeFunctionDeclaration resolveWithOperatorLength(AST::CallExpression& callExpression, AST::UnnamedType& firstArgument, const Intrinsics& intrinsics)
 {
-    const bool isRestricted = false;
     const bool isOperator = true;
     auto returnType = AST::TypeReference::wrap(Lexer::Token(callExpression.origin()), intrinsics.uintType());
     AST::VariableDeclarations parameters;
     parameters.append(AST::VariableDeclaration(Lexer::Token(callExpression.origin()), AST::Qualifiers(), { firstArgument.clone() }, String(), WTF::nullopt, WTF::nullopt));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
 }
 
 static AST::NativeFunctionDeclaration resolveWithReferenceComparator(AST::CallExpression& callExpression, ResolvingType& firstArgument, ResolvingType& secondArgument, const Intrinsics& intrinsics)
 {
-    const bool isRestricted = false;
     const bool isOperator = true;
     auto returnType = AST::TypeReference::wrap(Lexer::Token(callExpression.origin()), intrinsics.boolType());
     auto argumentType = WTF::visit(WTF::makeVisitor([](UniqueRef<AST::UnnamedType>& unnamedType) -> UniqueRef<AST::UnnamedType> {
@@ -158,7 +155,7 @@ static AST::NativeFunctionDeclaration resolveWithReferenceComparator(AST::CallEx
     AST::VariableDeclarations parameters;
     parameters.append(AST::VariableDeclaration(Lexer::Token(callExpression.origin()), AST::Qualifiers(), { argumentType->clone() }, String(), WTF::nullopt, WTF::nullopt));
     parameters.append(AST::VariableDeclaration(Lexer::Token(callExpression.origin()), AST::Qualifiers(), { WTFMove(argumentType) }, String(), WTF::nullopt, WTF::nullopt));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(callExpression.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
 }
 
 static Optional<AST::NativeFunctionDeclaration> resolveByInstantiation(AST::CallExpression& callExpression, const Vector<std::reference_wrapper<ResolvingType>>& types, const Intrinsics& intrinsics)
index 0f9c23d..e58b5a5 100644 (file)
@@ -1096,8 +1096,6 @@ auto Parser::parseParameters() -> Expected<AST::VariableDeclarations, Error>
 
 auto Parser::parseFunctionDefinition() -> Expected<AST::FunctionDefinition, Error>
 {
-    bool restricted = static_cast<bool>(tryType(Lexer::Token::Type::Restricted));
-
     auto functionDeclaration = parseFunctionDeclaration();
     if (!functionDeclaration)
         return Unexpected<Error>(functionDeclaration.error());
@@ -1106,7 +1104,7 @@ auto Parser::parseFunctionDefinition() -> Expected<AST::FunctionDefinition, Erro
     if (!block)
         return Unexpected<Error>(block.error());
 
-    return AST::FunctionDefinition(WTFMove(*functionDeclaration), WTFMove(*block), restricted);
+    return AST::FunctionDefinition(WTFMove(*functionDeclaration), WTFMove(*block));
 }
 
 auto Parser::parseEntryPointFunctionDeclaration() -> Expected<AST::FunctionDeclaration, Error>
@@ -1249,12 +1247,6 @@ auto Parser::parseNativeFunctionDeclaration() -> Expected<AST::NativeFunctionDec
 {
     Optional<Lexer::Token> origin;
 
-    bool restricted = false;
-    if (auto restrictedValue = tryType(Lexer::Token::Type::Restricted)) {
-        origin = *restrictedValue;
-        restricted = true;
-    }
-
     auto native = consumeType(Lexer::Token::Type::Native);
     if (!native)
         return Unexpected<Error>(native.error());
@@ -1269,7 +1261,7 @@ auto Parser::parseNativeFunctionDeclaration() -> Expected<AST::NativeFunctionDec
     if (!semicolon)
         return Unexpected<Error>(semicolon.error());
 
-    return AST::NativeFunctionDeclaration(WTFMove(*functionDeclaration), restricted);
+    return AST::NativeFunctionDeclaration(WTFMove(*functionDeclaration));
 }
 
 auto Parser::parseBlock() -> Expected<AST::Block, Error>
index 572a465..61a4251 100644 (file)
@@ -71,25 +71,8 @@ AST::FunctionDeclaration* resolveFunctionOverloadImpl(Vector<std::reference_wrap
             minimumCostCandidates.append(candidate);
     }
 
-    bool restrictedCandidateExists = false;
-    for (auto& candidate : minimumCostCandidates) {
-        if (is<AST::FunctionDefinition>(candidate.get()) && downcast<AST::FunctionDefinition>(candidate.get()).restricted()) {
-            restrictedCandidateExists = true;
-            break;
-        }
-    }
-
-    candidates.clear();
-    if (restrictedCandidateExists) {
-        for (auto& candidate : minimumCostCandidates) {
-            if (is<AST::FunctionDefinition>(candidate.get()) && downcast<AST::FunctionDefinition>(candidate.get()).restricted())
-                candidates.append(candidate.get());
-        }
-    } else
-        candidates = minimumCostCandidates;
-
-    if (candidates.size() == 1)
-        return &candidates[0].get();
+    if (minimumCostCandidates.size() == 1)
+        return &minimumCostCandidates[0].get();
     return nullptr;
 }
 
index 43aab61..3bf6e87 100644 (file)
@@ -63,13 +63,12 @@ void synthesizeArrayOperatorLength(Program& program)
     auto arrayTypes = findArrayTypes.takeArrayTypes();
 
     bool isOperator = true;
-    bool isRestricted = false;
 
     for (auto& arrayType : arrayTypes) {
         AST::VariableDeclaration variableDeclaration(Lexer::Token(arrayType.get().origin()), AST::Qualifiers(), { arrayType.get().clone() }, String(), WTF::nullopt, WTF::nullopt);
         AST::VariableDeclarations parameters;
         parameters.append(WTFMove(variableDeclaration));
-        AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(arrayType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(arrayType.get().origin()), program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+        AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(arrayType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(arrayType.get().origin()), program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), WTF::nullopt, isOperator));
         program.append(WTFMove(nativeFunctionDeclaration));
     }
 }
index 6112e0a..86f5cdb 100644 (file)
@@ -101,16 +101,15 @@ void synthesizeConstructors(Program& program)
     auto m_namedTypes = findAllTypes.takeNamedTypes();
 
     bool isOperator = true;
-    bool isRestricted = false;
 
     for (auto& unnamedType : m_unnamedTypes) {
         AST::VariableDeclaration variableDeclaration(Lexer::Token(unnamedType.get().origin()), AST::Qualifiers(), { unnamedType.get().clone() }, String(), WTF::nullopt, WTF::nullopt);
         AST::VariableDeclarations parameters;
         parameters.append(WTFMove(variableDeclaration));
-        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
         program.append(WTFMove(copyConstructor));
 
-        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator), isRestricted);
+        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.get().clone(), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator));
         program.append(WTFMove(defaultConstructor));
     }
 
@@ -118,10 +117,10 @@ void synthesizeConstructors(Program& program)
         AST::VariableDeclaration variableDeclaration(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()) }, String(), WTF::nullopt, WTF::nullopt);
         AST::VariableDeclarations parameters;
         parameters.append(WTFMove(variableDeclaration));
-        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
         program.append(WTFMove(copyConstructor));
 
-        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator), isRestricted);
+        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator));
         program.append(WTFMove(defaultConstructor));
     }
 }
index e26d74f..5529d03 100644 (file)
@@ -39,7 +39,6 @@ namespace WHLSL {
 void synthesizeEnumerationFunctions(Program& program)
 {
     bool isOperator = true;
-    bool isRestricted = false;
     for (auto& enumerationDefinition : program.enumerationDefinitions()) {
         {
             AST::VariableDeclaration variableDeclaration1(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition) }, String(), WTF::nullopt, WTF::nullopt);
@@ -47,7 +46,7 @@ void synthesizeEnumerationFunctions(Program& program)
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration1));
             parameters.append(WTFMove(variableDeclaration2));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), WTF::nullopt, isOperator));
             program.append(WTFMove(nativeFunctionDeclaration));
         }
 
@@ -55,7 +54,7 @@ void synthesizeEnumerationFunctions(Program& program)
             AST::VariableDeclaration variableDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition) }, String(), WTF::nullopt, WTF::nullopt);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator.value"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator.value"_str, WTFMove(parameters), WTF::nullopt, isOperator));
             program.append(WTFMove(nativeFunctionDeclaration));
         }
 
@@ -63,7 +62,7 @@ void synthesizeEnumerationFunctions(Program& program)
             AST::VariableDeclaration variableDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition) }, String(), WTF::nullopt, WTF::nullopt);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
             program.append(WTFMove(nativeFunctionDeclaration));
         }
 
@@ -71,7 +70,7 @@ void synthesizeEnumerationFunctions(Program& program)
             AST::VariableDeclaration variableDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), enumerationDefinition->type().clone(), String(), WTF::nullopt, WTF::nullopt);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, { AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition) }, "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, { AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition) }, "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
             program.append(WTFMove(nativeFunctionDeclaration));
         }
     }
index 8d0bcbf..53024a6 100644 (file)
@@ -42,7 +42,6 @@ namespace WHLSL {
 void synthesizeStructureAccessors(Program& program)
 {
     bool isOperator = true;
-    bool isRestricted = false;
     for (auto& structureDefinition : program.structureDefinitions()) {
         for (auto& structureElement : structureDefinition->structureElements()) {
             {
@@ -50,7 +49,7 @@ void synthesizeStructureAccessors(Program& program)
                 AST::VariableDeclaration variableDeclaration(Lexer::Token(structureElement.origin()), AST::Qualifiers(), { AST::TypeReference::wrap(Lexer::Token(structureElement.origin()), structureDefinition) }, String(), WTF::nullopt, WTF::nullopt);
                 AST::VariableDeclarations parameters;
                 parameters.append(WTFMove(variableDeclaration));
-                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, structureElement.type().clone(), makeString("operator.", structureElement.name()), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, structureElement.type().clone(), makeString("operator.", structureElement.name()), WTFMove(parameters), WTF::nullopt, isOperator));
                 program.append(WTFMove(nativeFunctionDeclaration));
             }
 
@@ -61,7 +60,7 @@ void synthesizeStructureAccessors(Program& program)
                 AST::VariableDeclarations parameters;
                 parameters.append(WTFMove(variableDeclaration1));
                 parameters.append(WTFMove(variableDeclaration2));
-                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(structureElement.origin()), structureDefinition), makeString("operator.", structureElement.name(), '='), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(structureElement.origin()), structureDefinition), makeString("operator.", structureElement.name(), '='), WTFMove(parameters), WTF::nullopt, isOperator));
                 program.append(WTFMove(nativeFunctionDeclaration));
             }
 
@@ -72,7 +71,7 @@ void synthesizeStructureAccessors(Program& program)
                 AST::VariableDeclarations parameters;
                 parameters.append(WTFMove(variableDeclaration));
                 auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(structureElement.origin()), addressSpace, structureElement.type().clone());
-                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), WTF::nullopt, isOperator), isRestricted);
+                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), WTF::nullopt, isOperator));
                 return nativeFunctionDeclaration;
             };
             program.append(createAnder(AST::AddressSpace::Constant));