Pass ctor.dont to all constructor calls that are followed with explicit initialize() calls afterwards, to make sure it is only called once.

This commit is contained in:
Jürg Lehni 2011-02-20 01:45:53 +01:00
parent a41a762237
commit ed752ed744
5 changed files with 5 additions and 5 deletions

View file

@ -277,7 +277,7 @@ var Point = Base.extend({
if (length == 1 && args[index] instanceof Point) { if (length == 1 && args[index] instanceof Point) {
return args[index]; return args[index];
} else if (length != 0) { } else if (length != 0) {
var point = new Point(); var point = new Point(Point.dont);
point.initialize.apply(point, index > 0 point.initialize.apply(point, index > 0
? Array.prototype.slice.call(args, index) : args); ? Array.prototype.slice.call(args, index) : args);
return point; return point;

View file

@ -283,7 +283,7 @@ Rectangle = Base.extend({
if (length == 1 && args[index] instanceof Rectangle) { if (length == 1 && args[index] instanceof Rectangle) {
return args[index]; return args[index];
} else if (length != 0) { } else if (length != 0) {
var rect = new Rectangle(); var rect = new Rectangle(Rectangle.dont);
rect.initialize.apply(rect, index > 0 rect.initialize.apply(rect, index > 0
? Array.prototype.slice.call(args, index) : args); ? Array.prototype.slice.call(args, index) : args);
return rect; return rect;

View file

@ -94,7 +94,7 @@ var Size = Base.extend({
if (length == 1 && args[index] instanceof Size) { if (length == 1 && args[index] instanceof Size) {
return args[index]; return args[index];
} else if (length != 0) { } else if (length != 0) {
var size = new Size(); var size = new Size(Size.dont);
size.initialize.apply(size, index > 0 size.initialize.apply(size, index > 0
? Array.prototype.slice.call(args, index) : args); ? Array.prototype.slice.call(args, index) : args);
return size; return size;

View file

@ -36,7 +36,7 @@ Color = Base.extend({
if (length == 1 && args[index] instanceof Color) { if (length == 1 && args[index] instanceof Color) {
return args[index]; return args[index];
} else if (length != 0) { } else if (length != 0) {
var rgbColor = new RGBColor(); var rgbColor = new RGBColor(RGBColor.dont);
rgbColor.initialize.apply(rgbColor, index > 0 rgbColor.initialize.apply(rgbColor, index > 0
? Array.prototype.slice.call(args, index) : args); ? Array.prototype.slice.call(args, index) : args);
return rgbColor; return rgbColor;

View file

@ -135,7 +135,7 @@ Segment = Base.extend({
if (length == 1 && args[index] instanceof Segment) { if (length == 1 && args[index] instanceof Segment) {
return args[index]; return args[index];
} else if (length != 0) { } else if (length != 0) {
var segment = new Segment(); var segment = new Segment(Segment.dont);
segment.initialize.apply(segment, index > 0 segment.initialize.apply(segment, index > 0
? Array.prototype.slice.call(args, index) : args); ? Array.prototype.slice.call(args, index) : args);
return segment; return segment;