https://bugs.webkit.org/show_bug.cgi?id=102338
Reviewed by Adam Barth.
Now WebKit IDL files have no modules. (The Web IDL spec has no modules.)
We can remove CodeGenerator::StripModule.
This might break some internal builds if the internal builds are still
using modules. Ping haraken@ you observe it.
No tests. No change in behavior.
* bindings/scripts/CodeGenerator.pm:
(ForAllParents):
(AttributeNameForGetterAndSetter):
(IsStrictSubtype):
* bindings/scripts/CodeGeneratorCPP.pm:
(GetClassName):
(GetImplClassName):
(GetParentImplClassName):
(GetParent):
(ConversionNeeded):
(GetCPPTypeGetter):
(AddForwardDeclarationsForType):
(AddIncludesForType):
(GenerateImplementation):
* bindings/scripts/CodeGeneratorGObject.pm:
(GetParentClassName):
(GetParentGObjType):
(GetClassName):
* bindings/scripts/CodeGeneratorJS.pm:
(GetParentClassName):
(AddIncludesForTypeInImpl):
(AddIncludesForTypeInHeader):
(GenerateParametersCheckExpression):
(GenerateImplementation):
(GenerateParametersCheck):
(GetNativeTypeFromSignature):
(JSValueToNative):
(NativeToJSValue):
* bindings/scripts/CodeGeneratorObjC.pm:
(GetClassName):
(GetImplClassName):
(GetParentImplClassName):
(GetParentAndProtocols):
(GetPropertyAttributes):
(ConversionNeeded):
(GetObjCTypeGetter):
(AddForwardDeclarationsForType):
(AddIncludesForType):
(GenerateImplementation):
* bindings/scripts/CodeGeneratorV8.pm:
(AddIncludesForType):
(GenerateHeader):
(IsSubType):
(GenerateSingleBatchedAttribute):
(GenerateImplementation):
(BaseInterfaceName):
(GetTypeFromSignature):
(IsWrapperType):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134849
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-11-15 Kentaro Hara <haraken@chromium.org>
+
+ Remove CodeGenerator::StripModule
+ https://bugs.webkit.org/show_bug.cgi?id=102338
+
+ Reviewed by Adam Barth.
+
+ Now WebKit IDL files have no modules. (The Web IDL spec has no modules.)
+ We can remove CodeGenerator::StripModule.
+ This might break some internal builds if the internal builds are still
+ using modules. Ping haraken@ you observe it.
+
+ No tests. No change in behavior.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (ForAllParents):
+ (AttributeNameForGetterAndSetter):
+ (IsStrictSubtype):
+ * bindings/scripts/CodeGeneratorCPP.pm:
+ (GetClassName):
+ (GetImplClassName):
+ (GetParentImplClassName):
+ (GetParent):
+ (ConversionNeeded):
+ (GetCPPTypeGetter):
+ (AddForwardDeclarationsForType):
+ (AddIncludesForType):
+ (GenerateImplementation):
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (GetParentClassName):
+ (GetParentGObjType):
+ (GetClassName):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GetParentClassName):
+ (AddIncludesForTypeInImpl):
+ (AddIncludesForTypeInHeader):
+ (GenerateParametersCheckExpression):
+ (GenerateImplementation):
+ (GenerateParametersCheck):
+ (GetNativeTypeFromSignature):
+ (JSValueToNative):
+ (NativeToJSValue):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (GetClassName):
+ (GetImplClassName):
+ (GetParentImplClassName):
+ (GetParentAndProtocols):
+ (GetPropertyAttributes):
+ (ConversionNeeded):
+ (GetObjCTypeGetter):
+ (AddForwardDeclarationsForType):
+ (AddIncludesForType):
+ (GenerateImplementation):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ (AddIncludesForType):
+ (GenerateHeader):
+ (IsSubType):
+ (GenerateSingleBatchedAttribute):
+ (GenerateImplementation):
+ (BaseInterfaceName):
+ (GetTypeFromSignature):
+ (IsWrapperType):
+
2012-11-15 Luke Macpherson <macpherson@chromium.org>
Make assumptions about m_parentStyle consistent within StyleResolver::applyProperty()
return $reference;
}
-sub StripModule($)
-{
- my $object = shift;
- my $name = shift;
- $name =~ s/[a-zA-Z0-9]*:://;
- return $name;
-}
-
sub ProcessDocument
{
my $object = shift;
my $interface = shift;
for (@{$interface->parents}) {
- my $interfaceName = $object->StripModule($_);
+ my $interfaceName = $_;
my $parentInterface = $object->ParseInterface($interfaceName, $parentsOnly);
if ($beforeRecursion) {
if ($attribute->signature->extendedAttributes->{"ImplementedAs"}) {
$attributeName = $attribute->signature->extendedAttributes->{"ImplementedAs"};
}
- my $attributeType = $generator->StripModule($attribute->signature->type);
+ my $attributeType = $attribute->signature->type;
# Avoid clash with C++ keyword.
$attributeName = "_operator" if $attributeName eq "operator";
$object->ForAllParents($dataNode, sub {
my $interface = shift;
- if ($object->StripModule($interface->name) eq $interfaceName) {
+ if ($interface->name eq $interfaceName) {
$found = 1;
}
return "prune" if $found;
sub GetClassName
{
- my $name = $codeGenerator->StripModule(shift);
+ my $name = shift;
# special cases
return "WebDOMString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
sub GetImplClassName
{
- return $codeGenerator->StripModule(shift);
+ return shift;
}
sub GetParentImplClassName
return "Object";
}
- return $codeGenerator->StripModule($dataNode->parents(0));
+ return $dataNode->parents(0);
}
sub GetParent
$parent = "WebDOMObject";
$parent = "WebDOMEventTarget" if $dataNode->extendedAttributes->{"EventTarget"};
} elsif ($numParents eq 1) {
- my $parentName = $codeGenerator->StripModule($dataNode->parents(0));
+ my $parentName = $dataNode->parents(0);
$parent = "WebDOM" . $parentName;
} else {
my @parents = @{$dataNode->parents};
- my $firstParent = $codeGenerator->StripModule(shift(@parents));
+ my $firstParent = shift(@parents);
$parent = "WebDOM" . $firstParent;
}
sub ConversionNeeded
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type);
}
sub GetCPPTypeGetter
{
my $argName = shift;
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type);
return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow";
sub AddForwardDeclarationsForType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
my $public = shift;
return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type);
sub AddIncludesForType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return if $codeGenerator->GetSequenceType($type);
return if $codeGenerator->GetArrayType($type);
next if SkipAttribute($attribute);
AddIncludesForType($attribute->signature->type);
- my $idlType = $codeGenerator->StripModule($attribute->signature->type);
+ my $idlType = $attribute->signature->type;
my $attributeName = $attribute->signature->name;
my $attributeType = GetCPPType($attribute->signature->type, 0);
AddIncludesForType($param->type);
- my $idlType = $codeGenerator->StripModule($param->type);
+ my $idlType = $param->type;
my $implGetter = GetCPPTypeGetter($paramName, $idlType);
push(@parameterNames, $implGetter);
my $dataNode = shift;
return "WebKitDOMObject" if @{$dataNode->parents} eq 0;
- return "WebKitDOM" . $codeGenerator->StripModule($dataNode->parents(0));
+ return "WebKitDOM" . $dataNode->parents(0);
}
# From String::CamelCase 0.01
my $dataNode = shift;
return "WEBKIT_TYPE_DOM_OBJECT" if @{$dataNode->parents} eq 0;
- return "WEBKIT_TYPE_DOM_" . ClassNameToGObjectType($codeGenerator->StripModule($dataNode->parents(0)));
+ return "WEBKIT_TYPE_DOM_" . ClassNameToGObjectType($dataNode->parents(0));
}
sub GetClassName {
- my $name = $codeGenerator->StripModule(shift);
+ my $name = shift;
return "WebKitDOM$name";
}
return $dataNode->extendedAttributes->{"JSLegacyParent"} if $dataNode->extendedAttributes->{"JSLegacyParent"};
return "JSDOMWrapper" if (@{$dataNode->parents} eq 0);
- return "JS" . $codeGenerator->StripModule($dataNode->parents(0));
+ return "JS" . $dataNode->parents(0);
}
sub GetCallbackClassName
sub AddIncludesForTypeInImpl
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
my $isCallback = @_ ? shift : 0;
AddIncludesForType($type, $isCallback, \%implIncludes);
sub AddIncludesForTypeInHeader
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
my $isCallback = @_ ? shift : 0;
AddIncludesForType($type, $isCallback, \%headerIncludes);
foreach my $parameter (@{$function->parameters}) {
last if $parameterIndex >= $numParameters;
my $value = "arg$parameterIndex";
- my $type = $codeGenerator->StripModule($parameter->type);
+ my $type = $parameter->type;
# Only DOMString or wrapper types are checked.
# For DOMString with StrictTypeChecking only Null, Undefined and Object
if ($numAttributes > 0) {
foreach my $attribute (@{$dataNode->attributes}) {
my $name = $attribute->signature->name;
- my $type = $codeGenerator->StripModule($attribute->signature->type);
+ my $type = $attribute->signature->type;
$codeGenerator->AssertNotSequenceType($type);
my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
my $implGetterFunctionName = $codeGenerator->WK_lcfirst($name);
push(@implContent, " }\n");
push(@implContent, " return jsNull();\n");
} elsif ($attribute->signature->type =~ /Constructor$/) {
- my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
+ my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
# When Constructor attribute is used by DOMWindow.idl, it's correct to pass castedThis as the global object
# When JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject()
foreach my $attribute (@{$dataNode->attributes}) {
if (!IsReadonly($attribute)) {
my $name = $attribute->signature->name;
- my $type = $codeGenerator->StripModule($attribute->signature->type);
+ my $type = $attribute->signature->type;
my $putFunctionName = GetAttributeSetterName($interfaceName, $className, $attribute);
my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
$implIncludes{"JSDOMBinding.h"} = 1;
foreach my $parameter (@{$function->parameters}) {
- my $argType = $codeGenerator->StripModule($parameter->type);
+ my $argType = $parameter->type;
# Optional arguments with [Optional] should generate an early call with fewer arguments.
# Optional arguments with [Optional=...] should not generate the early call.
sub GetNativeTypeFromSignature
{
my $signature = shift;
- my $type = $codeGenerator->StripModule($signature->type);
+ my $type = $signature->type;
if ($type eq "unsigned long" and $signature->extendedAttributes->{"IsIndex"}) {
# Special-case index arguments because we need to check that they aren't < 0.
my $value = shift;
my $conditional = $signature->extendedAttributes->{"Conditional"};
- my $type = $codeGenerator->StripModule($signature->type);
+ my $type = $signature->type;
return "$value.toBoolean(exec)" if $type eq "boolean";
return "$value.toNumber(exec)" if $type eq "double";
my $thisValue = shift;
my $conditional = $signature->extendedAttributes->{"Conditional"};
- my $type = $codeGenerator->StripModule($signature->type);
+ my $type = $signature->type;
return "jsBoolean($value)" if $type eq "boolean";
sub GetClassName
{
- my $name = $codeGenerator->StripModule(shift);
+ my $name = shift;
# special cases
return "NSString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
sub GetImplClassName
{
- my $name = $codeGenerator->StripModule(shift);
+ my $name = shift;
return "DOMImplementationFront" if $name eq "DOMImplementation";
return "DOMWindow" if $name eq "AbstractView";
return "Object" if @{$dataNode->parents} eq 0;
- my $parent = $codeGenerator->StripModule($dataNode->parents(0));
+ my $parent = $dataNode->parents(0);
# special cases
return "Object" if $parent eq "HTMLCollection";
$parent = "DOMObject";
}
} elsif ($numParents eq 1) {
- my $parentName = $codeGenerator->StripModule($dataNode->parents(0));
+ my $parentName = $dataNode->parents(0);
if ($isProtocol) {
die "Parents of protocols must also be protocols." unless IsProtocolType($parentName);
push(@protocols, "DOM" . $parentName);
}
} else {
my @parents = @{$dataNode->parents};
- my $firstParent = $codeGenerator->StripModule(shift(@parents));
+ my $firstParent = shift(@parents);
if (IsProtocolType($firstParent)) {
push(@protocols, "DOM" . $firstParent);
if (!$isProtocol) {
}
foreach my $parentName (@parents) {
- $parentName = $codeGenerator->StripModule($parentName);
die "Everything past the first class should be a protocol!" unless IsProtocolType($parentName);
push(@protocols, "DOM" . $parentName);
sub GetPropertyAttributes
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
my $readOnly = shift;
my @attributes = ();
sub ConversionNeeded
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type) && !IsNativeObjCType($type);
}
sub GetObjCTypeGetter
{
my $argName = shift;
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type) or IsNativeObjCType($type);
return $argName . "Node" if $type eq "EventTarget";
sub AddForwardDeclarationsForType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
my $public = shift;
return if $codeGenerator->IsNonPointerType($type);
sub AddIncludesForType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return if $codeGenerator->IsNonPointerType($type);
return if $codeGenerator->GetSequenceType($type);
next if SkipAttribute($attribute);
AddIncludesForType($attribute->signature->type);
- my $idlType = $codeGenerator->StripModule($attribute->signature->type);
+ my $idlType = $attribute->signature->type;
my $attributeName = $attribute->signature->name;
my $attributeType = GetObjCType($attribute->signature->type);
AddIncludesForType($param->type);
- my $idlType = $codeGenerator->StripModule($param->type);
+ my $idlType = $param->type;
my $implGetter = GetObjCTypeGetter($paramName, $idlType);
push(@parameterNames, $implGetter);
# make a new parameter name if the original conflicts with a property name
$paramName = "in" . ucfirst($paramName) if $attributeNames{$paramName};
- my $idlType = $codeGenerator->StripModule($param->type);
+ my $idlType = $param->type;
next if not $codeGenerator->IsSVGTypeNeedingTearOff($idlType) or $implClassName =~ /List$/;
my $implGetter = GetObjCTypeGetter($paramName, $idlType);
sub AddIncludesForType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
# When we're finished with the one-file-per-class
# reorganization, we won't need these special cases.
|| GetGenerateIsReachable($dataNode) || $className =~ /SVG/;
if (!$hasDependentLifetime) {
foreach (@{$dataNode->parents}) {
- my $parent = $codeGenerator->StripModule($_);
+ my $parent = $_;
$headerIncludes{"V8${parent}.h"} = 1;
}
}
# Let the compiler statically determine this for us.
my $separator = "";
foreach (@{$dataNode->parents}) {
- my $parent = $codeGenerator->StripModule($_);
+ my $parent = $_;
$headerIncludes{"V8${parent}.h"} = 1;
push(@headerContent, "${separator}V8${parent}::hasDependentLifetime");
$separator = " || ";
my $parentType = shift;
return 1 if ($dataNode->name eq $parentType);
foreach (@allParents) {
- my $parent = $codeGenerator->StripModule($_);
+ my $parent = $_;
return 1 if $parent eq $parentType;
}
return 0;
# Constructor
if ($attribute->signature->type =~ /Constructor$/) {
- my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
+ my $constructorType = $attribute->signature->type;
$constructorType =~ s/Constructor$//;
# $constructorType ~= /Constructor$/ indicates that it is NamedConstructor.
# We do not generate the header file for NamedConstructor of class XXXX,
my $parentClass = "";
my $parentClassTemplate = "";
foreach (@{$dataNode->parents}) {
- my $parent = $codeGenerator->StripModule($_);
+ my $parent = $_;
AddToImplIncludes("V8${parent}.h");
$parentClass = "V8" . $parent;
$parentClassTemplate = $parentClass . "::GetTemplate()";
my $dataNode = shift;
while (@{$dataNode->parents}) {
- $dataNode = $codeGenerator->ParseInterface($codeGenerator->StripModule(@{$dataNode->parents}[0]), 1);
+ $dataNode = $codeGenerator->ParseInterface(@{$dataNode->parents}[0], 1);
}
- return $codeGenerator->StripModule($dataNode->name);
+ return $dataNode->name;
}
sub GenerateToV8Converters
{
my $signature = shift;
- return $codeGenerator->StripModule($signature->type);
+ return $signature->type;
}
sub IsWrapperType
{
- my $type = $codeGenerator->StripModule(shift);
+ my $type = shift;
return !($non_wrapper_types{$type});
}