Permalink
Browse files

Merge pull request #382 from mattjphillips/cc

Fix for issue #379: use known compile time base to build runtime express...
  • Loading branch information...
2 parents 4bf7585 + c4a03cf commit 6dae908297e76b05e20923ee12967acd9dca70d6 @nikhilk committed Jun 19, 2013
@@ -43,11 +43,10 @@ internal static class ExpressionGenerator {
Debug.Assert(propExpression.Type == ExpressionType.PropertySet);
if (propExpression.ObjectReference is BaseExpression) {
- writer.Write("ss.base(");
- writer.Write(generator.CurrentImplementation.ThisIdentifier);
- writer.Write(", 'set_");
+ writer.Write(((BaseExpression)propExpression.ObjectReference).EvaluatedType.FullGeneratedName);
+ writer.Write(".prototype.set_");
writer.Write(propExpression.Property.GeneratedName);
- writer.Write("').call(");
+ writer.Write(".call(");
writer.Write(generator.CurrentImplementation.ThisIdentifier);
writer.Write(", ");
GenerateExpression(generator, symbol, expression.RightOperand);
@@ -71,11 +70,10 @@ internal static class ExpressionGenerator {
Debug.Assert(indexExpression.Type == ExpressionType.Indexer);
if (indexExpression.ObjectReference is BaseExpression) {
- writer.Write("ss.base(");
- writer.Write(generator.CurrentImplementation.ThisIdentifier);
- writer.Write(", 'set_");
+ writer.Write(((BaseExpression)indexExpression.ObjectReference).EvaluatedType.FullGeneratedName);
+ writer.Write(".prototype.set_");
writer.Write(indexExpression.Indexer.GeneratedName);
- writer.Write("').call(");
+ writer.Write(".call(");
writer.Write(generator.CurrentImplementation.ThisIdentifier);
writer.Write(", ");
GenerateExpressionList(generator, symbol, indexExpression.Indices);
@@ -478,11 +476,10 @@ internal static class ExpressionGenerator {
writer.Write("]");
}
else if (expression.ObjectReference is BaseExpression) {
- writer.Write("ss.base(");
- writer.Write(generator.CurrentImplementation.ThisIdentifier);
- writer.Write(", 'get_");
+ writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName);
+ writer.Write(".prototype.get_");
writer.Write(expression.Indexer.GeneratedName);
- writer.Write("').call(");
+ writer.Write(".call(");
writer.Write(generator.CurrentImplementation.ThisIdentifier);
writer.Write(", ");
GenerateExpressionList(generator, symbol, expression.Indices);
@@ -707,11 +704,10 @@ internal static class ExpressionGenerator {
if (expression.ObjectReference is BaseExpression) {
Debug.Assert(expression.Method.IsExtension == false);
- writer.Write("ss.base(");
- writer.Write(generator.CurrentImplementation.ThisIdentifier);
- writer.Write(", '");
+ writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName);
+ writer.Write(".prototype.");
writer.Write(expression.Method.GeneratedName);
- writer.Write("').call(");
+ writer.Write(".call(");
writer.Write(generator.CurrentImplementation.ThisIdentifier);
if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) {
writer.Write(", ");
@@ -95,7 +95,6 @@
safeCast: safeCast,
canAssign: canAssign,
instanceOf: instanceOf,
- base: base,
culture: {
neutral: neutralCulture,
@@ -153,12 +153,6 @@ function safeCast(instance, type) {
return instanceOf(type, instance) ? instance : null;
}
-function base(instanceOrType, method) {
- var baseType = instanceOrType.constructor.$base || instanceOrType.$base;
- var m = baseType.prototype[method];
- return m !== instanceOrType[method] ? m : base(baseType, method);
-}
-
function module(name, implementation, exports) {
var registry = _modules[name] = { $name: name };
@@ -173,7 +173,7 @@ define('test', ['ss', 'lib'], function(ss, lib) {
},
$0: function() {
this.$2();
- ss.base(this, '$0').call(this);
+ Bar2.prototype.$0.call(this);
var d = MyData('a', 'b');
d.$0 = d.$1;
},
@@ -273,7 +273,7 @@ define('test', ['ss', 'lib'], function(ss, lib) {
},
dispose: function() {
this.c$0 = 0;
- ss.base(this, 'dispose').call(this);
+ lib.Behavior.prototype.dispose.call(this);
},
c$6: function() {
},
@@ -24,10 +24,10 @@ define('test', ['ss'], function(ss) {
}
var Bar$ = {
sum: function() {
- return ss.base(this, 'sum').call(this, 1) + 1;
+ return Foo.prototype.sum.call(this, 1) + 1;
},
toString: function() {
- return ss.base(this, 'toString').call(this) + ' -> Bar';
+ return Foo.prototype.toString.call(this) + ' -> Bar';
}
};
@@ -70,7 +70,7 @@ define('test', ['ss'], function(ss) {
n = App.prototype.get_XYZ.call(this);
this.set_XYZ(n);
this.set_XYZ(n);
- ss.base(this, 'set_XYZ').call(this, n);
+ App.prototype.set_XYZ.call(this, n);
this._value2 = n;
this._value2 = n;
this._value2 = n;
@@ -133,15 +133,15 @@ define('test', ['ss'], function(ss) {
VirtualIndexer.call(this);
var i = this.get_item('name');
this.set_item('name', i + 1);
- var j = ss.base(this, 'get_item').call(this, 'name');
- ss.base(this, 'set_item').call(this, 'name', 43);
+ var j = VirtualIndexer.prototype.get_item.call(this, 'name');
+ VirtualIndexer.prototype.set_item.call(this, 'name', 43);
}
var OverriddenIndexer$ = {
get_item: function(name) {
- return ss.base(this, 'get_item').call(this, name) + 1;
+ return VirtualIndexer.prototype.get_item.call(this, name) + 1;
},
set_item: function(name, value) {
- ss.base(this, 'set_item').call(this, name, value - 1);
+ VirtualIndexer.prototype.set_item.call(this, name, value - 1);
return value;
}
};
@@ -112,7 +112,7 @@ define('test', ['ss'], function(ss) {
var e1 = document.getElementById(this.bar);
var e2 = document.getElementById(this.name);
var e3 = document.getElementById(this.bar);
- var s = this.testMethod() + ss.base(this, 'testMethod').call(this);
+ var s = this.testMethod() + MergedMembersClass.prototype.testMethod.call(this);
},
get_item: function(s) {
return s;

0 comments on commit 6dae908

Please sign in to comment.