Commit 60c08ab4 authored by haraken@chromium.org's avatar haraken@chromium.org

[Refactoring] Make finish() of CodeGeneratorJS.pm empty

https://bugs.webkit.org/show_bug.cgi?id=76846

Reviewed by Adam Barth.

This is one of steps to stop rebuilding .h/.cpp files generated
by unchanged IDLs (bug 76836).

As a refactoring, we are planning to remove finish() from all
CodeGenerators. In this bug, we make finish() of CodeGeneratorJS.pm
empty.

No new tests. No change in behavior.

* bindings/scripts/CodeGeneratorJS.pm:
(finish): Made it empty. We will remove finish() after
making finish() of all CodeGenerators empty.
(GenerateInterface): Modified to call WriteData().
(WriteData): Simple code refactoring.
Removed if(defined $IMPL).
Removed if(defined $HEADER).
Removed if(defined $DEPS).
$IMPL -> IMPL.
$HEADER -> HEADER.
$DEPS -> DEPS.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e3d31e06
2012-01-23 Kentaro Hara <haraken@chromium.org>
[Refactoring] Make finish() of CodeGeneratorJS.pm empty
https://bugs.webkit.org/show_bug.cgi?id=76846
Reviewed by Adam Barth.
This is one of steps to stop rebuilding .h/.cpp files generated
by unchanged IDLs (bug 76836).
As a refactoring, we are planning to remove finish() from all
CodeGenerators. In this bug, we make finish() of CodeGeneratorJS.pm
empty.
No new tests. No change in behavior.
* bindings/scripts/CodeGeneratorJS.pm:
(finish): Made it empty. We will remove finish() after
making finish() of all CodeGenerators empty.
(GenerateInterface): Modified to call WriteData().
(WriteData): Simple code refactoring.
Removed if(defined $IMPL).
Removed if(defined $HEADER).
Removed if(defined $DEPS).
$IMPL -> IMPL.
$HEADER -> HEADER.
$DEPS -> DEPS.
2012-01-23 Shawn Singh <shawnsingh@chromium.org>
[chromium] updateRect is incorrect when contentBounds != bounds
......@@ -30,7 +30,7 @@ use strict;
use constant FileNamePrefix => "JS";
my ($codeGenerator, $IMPL, $HEADER, $DEPS);
my ($codeGenerator);
my $module = "";
my $outputDir = "";
......@@ -88,12 +88,10 @@ sub new
return $reference;
}
# FIXME(haraken): finish() will be soon removed from all CodeGenerators.
sub finish
{
my $object = shift;
# Commit changes!
$object->WriteData();
}
sub leftShift($$) {
......@@ -119,22 +117,7 @@ sub GenerateInterface
$object->GenerateImplementation($dataNode);
}
my $name = $dataNode->name;
# Open files for writing
my $prefix = FileNamePrefix;
my $headerFileName = "$outputDir/$prefix$name.h";
my $implFileName = "$outputDir/$prefix$name.cpp";
my $depsFileName = "$outputDir/$prefix$name.dep";
# Remove old dependency file.
unlink($depsFileName);
open($IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
open($HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
if (@depsContent) {
open($DEPS, ">$depsFileName") || die "Couldn't open file $depsFileName";
}
$object->WriteData($dataNode);
}
sub GenerateAttributeEventListenerCall
......@@ -3248,84 +3231,94 @@ sub GenerateHashValue
# Internal helper
sub WriteData
{
if (defined($IMPL)) {
# Write content to file.
print $IMPL @implContentHeader;
my @includes = ();
my %implIncludeConditions = ();
foreach my $include (keys %implIncludes) {
my $condition = $implIncludes{$include};
my $checkType = $include;
$checkType =~ s/\.h//;
next if $codeGenerator->IsSVGAnimatedType($checkType);
$include = "\"$include\"" unless $include =~ /^["<]/; # "
if ($condition eq 1) {
push @includes, $include;
} else {
push @{$implIncludeConditions{$condition}}, $include;
}
}
foreach my $include (sort @includes) {
print $IMPL "#include $include\n";
}
foreach my $condition (sort keys %implIncludeConditions) {
print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
foreach my $include (sort @{$implIncludeConditions{$condition}}) {
print $IMPL "#include $include\n";
}
print $IMPL "#endif\n";
}
my $object = shift;
my $dataNode = shift;
print $IMPL @implContent;
close($IMPL);
undef($IMPL);
my $name = $dataNode->name;
my $prefix = FileNamePrefix;
my $headerFileName = "$outputDir/$prefix$name.h";
my $implFileName = "$outputDir/$prefix$name.cpp";
my $depsFileName = "$outputDir/$prefix$name.dep";
@implContentHeader = ();
@implContent = ();
%implIncludes = ();
}
# Remove old dependency file.
unlink($depsFileName);
if (defined($HEADER)) {
# Write content to file.
print $HEADER @headerContentHeader;
open(IMPL, ">$implFileName") || die "Couldn't open file $implFileName";
my @includes = ();
foreach my $include (keys %headerIncludes) {
$include = "\"$include\"" unless $include =~ /^["<]/; # "
push @includes, $include;
}
foreach my $include (sort @includes) {
print $HEADER "#include $include\n";
}
# Write content to file.
print IMPL @implContentHeader;
my @includes = ();
my %implIncludeConditions = ();
foreach my $include (keys %implIncludes) {
my $condition = $implIncludes{$include};
my $checkType = $include;
$checkType =~ s/\.h//;
next if $codeGenerator->IsSVGAnimatedType($checkType);
print $HEADER @headerContent;
$include = "\"$include\"" unless $include =~ /^["<]/; # "
@includes = ();
foreach my $include (keys %headerTrailingIncludes) {
$include = "\"$include\"" unless $include =~ /^["<]/; # "
if ($condition eq 1) {
push @includes, $include;
} else {
push @{$implIncludeConditions{$condition}}, $include;
}
foreach my $include (sort @includes) {
print $HEADER "#include $include\n";
}
foreach my $include (sort @includes) {
print IMPL "#include $include\n";
}
foreach my $condition (sort keys %implIncludeConditions) {
print IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
foreach my $include (sort @{$implIncludeConditions{$condition}}) {
print IMPL "#include $include\n";
}
print IMPL "#endif\n";
}
close($HEADER);
undef($HEADER);
print IMPL @implContent;
close(IMPL);
@headerContentHeader = ();
@headerContent = ();
%headerIncludes = ();
%headerTrailingIncludes = ();
@implContentHeader = ();
@implContent = ();
%implIncludes = ();
open(HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName";
# Write content to file.
print HEADER @headerContentHeader;
my @includes = ();
foreach my $include (keys %headerIncludes) {
$include = "\"$include\"" unless $include =~ /^["<]/; # "
push @includes, $include;
}
foreach my $include (sort @includes) {
print HEADER "#include $include\n";
}
print HEADER @headerContent;
@includes = ();
foreach my $include (keys %headerTrailingIncludes) {
$include = "\"$include\"" unless $include =~ /^["<]/; # "
push @includes, $include;
}
foreach my $include (sort @includes) {
print HEADER "#include $include\n";
}
if (defined($DEPS)) {
close(HEADER);
@headerContentHeader = ();
@headerContent = ();
%headerIncludes = ();
%headerTrailingIncludes = ();
if (@depsContent) {
open(DEPS, ">$depsFileName") || die "Couldn't open file $depsFileName";
# Write dependency file.
print $DEPS @depsContent;
close($DEPS);
undef($DEPS);
print DEPS @depsContent;
close(DEPS);
@depsContent = ();
}
......
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