Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: lib/runtime/dart/_js_helper.js

Issue 1093143004: fixes #52, fields shadowing getters/setters or other fields (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/_js_helper.js
diff --git a/lib/runtime/dart/_js_helper.js b/lib/runtime/dart/_js_helper.js
index efa950c41d78445f1b285f4ca04c3774dfe356dc..7688ec80424f84fa9d9cf9955bd3ded2889ed285 100644
--- a/lib/runtime/dart/_js_helper.js
+++ b/lib/runtime/dart/_js_helper.js
@@ -15,12 +15,12 @@ var _js_helper;
}
class IrRepresentation extends core.Object {
IrRepresentation(value) {
- this.value = value;
+ dart.initField(IrRepresentation, this, 'value', value);
}
}
class Native extends core.Object {
Native(name) {
- this.name = name;
+ dart.initField(Native, this, 'name', name);
}
}
let _ = Symbol('_');
@@ -68,7 +68,7 @@ var _js_helper;
let ConstantStringMap$ = dart.generic(function(K, V) {
class ConstantStringMap extends ConstantMap$(K, V) {
[_](length, jsObject, keys) {
- this.length = length;
+ dart.initField(ConstantStringMap, this, 'length', length);
this[_jsObject] = jsObject;
this[_keys] = keys;
super[_]();
@@ -480,10 +480,10 @@ var _js_helper;
JSSyntaxRegExp(source, opts) {
let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
- this.pattern = source;
- this[_nativeRegExp] = JSSyntaxRegExp.makeNative(source, multiLine, caseSensitive, false);
- this[_nativeGlobalRegExp] = null;
- this[_nativeAnchoredRegExp] = null;
+ dart.initField(JSSyntaxRegExp, this, 'pattern', source);
+ dart.initField(JSSyntaxRegExp, this, _nativeRegExp, JSSyntaxRegExp.makeNative(source, multiLine, caseSensitive, false));
+ dart.initField(JSSyntaxRegExp, this, _nativeGlobalRegExp, null);
+ dart.initField(JSSyntaxRegExp, this, _nativeAnchoredRegExp, null);
}
get [_nativeGlobalVersion]() {
if (this[_nativeGlobalRegExp] != null)
@@ -668,9 +668,9 @@ var _js_helper;
}
class StringMatch extends core.Object {
StringMatch(start, input, pattern) {
- this.start = start;
- this.input = input;
- this.pattern = pattern;
+ dart.initField(StringMatch, this, 'start', start);
+ dart.initField(StringMatch, this, 'input', input);
+ dart.initField(StringMatch, this, 'pattern', pattern);
}
get end() {
return dart.notNull(this.start) + dart.notNull(this.pattern.length);
@@ -878,8 +878,8 @@ var _js_helper;
let _unmangledName = Symbol('_unmangledName');
class TypeImpl extends core.Object {
TypeImpl(typeName) {
- this[_typeName] = typeName;
- this[_unmangledName] = null;
+ dart.initField(TypeImpl, this, _typeName, typeName);
+ dart.initField(TypeImpl, this, _unmangledName, null);
}
toString() {
if (this[_unmangledName] != null)
@@ -897,9 +897,9 @@ var _js_helper;
TypeImpl[dart.implements] = () => [core.Type];
class TypeVariable extends core.Object {
TypeVariable(owner, name, bound) {
- this.owner = owner;
- this.name = name;
- this.bound = bound;
+ dart.initField(TypeVariable, this, 'owner', owner);
+ dart.initField(TypeVariable, this, 'name', name);
+ dart.initField(TypeVariable, this, 'bound', bound);
}
}
// Function getMangledTypeName: (TypeImpl) → dynamic
@@ -1403,12 +1403,12 @@ var _js_helper;
let _getCachedInvocation = Symbol('_getCachedInvocation');
class JSInvocationMirror extends core.Object {
JSInvocationMirror(memberName, internalName, kind, arguments$, namedArgumentNames) {
- this[_memberName] = memberName;
- this[_internalName] = internalName;
- this[_kind] = kind;
- this[_arguments] = arguments$;
- this[_namedArgumentNames] = namedArgumentNames;
- this[_namedIndices] = null;
+ dart.initField(JSInvocationMirror, this, _memberName, memberName);
+ dart.initField(JSInvocationMirror, this, _internalName, internalName);
+ dart.initField(JSInvocationMirror, this, _kind, kind);
+ dart.initField(JSInvocationMirror, this, _arguments, arguments$);
+ dart.initField(JSInvocationMirror, this, _namedArgumentNames, namedArgumentNames);
+ dart.initField(JSInvocationMirror, this, _namedIndices, null);
}
get memberName() {
if (dart.is(this[_memberName], core.Symbol))
@@ -1522,10 +1522,10 @@ var _js_helper;
JSInvocationMirror.SETTER = 2;
class CachedInvocation extends core.Object {
CachedInvocation(mangledName, jsFunction, isIntercepted, cachedInterceptor) {
- this.mangledName = mangledName;
- this.jsFunction = jsFunction;
- this.isIntercepted = isIntercepted;
- this.cachedInterceptor = cachedInterceptor;
+ dart.initField(CachedInvocation, this, 'mangledName', mangledName);
+ dart.initField(CachedInvocation, this, 'jsFunction', jsFunction);
+ dart.initField(CachedInvocation, this, 'isIntercepted', isIntercepted);
+ dart.initField(CachedInvocation, this, 'cachedInterceptor', cachedInterceptor);
}
get isNoSuchMethod() {
return false;
@@ -1550,7 +1550,7 @@ var _js_helper;
}
class CachedCatchAllInvocation extends CachedInvocation {
CachedCatchAllInvocation(name, jsFunction, isIntercepted, cachedInterceptor) {
- this.info = new ReflectionInfo(jsFunction);
+ dart.initField(CachedCatchAllInvocation, this, 'info', new ReflectionInfo(jsFunction));
super.CachedInvocation(name, jsFunction, isIntercepted, cachedInterceptor);
}
get isGetterStub() {
@@ -1593,7 +1593,7 @@ var _js_helper;
}
class CachedNoSuchMethodInvocation extends core.Object {
CachedNoSuchMethodInvocation(interceptor) {
- this.interceptor = interceptor;
+ dart.initField(CachedNoSuchMethodInvocation, this, 'interceptor', interceptor);
}
get isNoSuchMethod() {
return true;
@@ -1608,14 +1608,14 @@ var _js_helper;
}
class ReflectionInfo extends core.Object {
internal(jsFunction, data, isAccessor, requiredParameterCount, optionalParameterCount, areOptionalParametersNamed, functionType) {
- this.jsFunction = jsFunction;
- this.data = data;
- this.isAccessor = isAccessor;
- this.requiredParameterCount = requiredParameterCount;
- this.optionalParameterCount = optionalParameterCount;
- this.areOptionalParametersNamed = areOptionalParametersNamed;
- this.functionType = functionType;
- this.cachedSortedIndices = null;
+ dart.initField(ReflectionInfo, this, 'jsFunction', jsFunction);
+ dart.initField(ReflectionInfo, this, 'data', data);
+ dart.initField(ReflectionInfo, this, 'isAccessor', isAccessor);
+ dart.initField(ReflectionInfo, this, 'requiredParameterCount', requiredParameterCount);
+ dart.initField(ReflectionInfo, this, 'optionalParameterCount', optionalParameterCount);
+ dart.initField(ReflectionInfo, this, 'areOptionalParametersNamed', areOptionalParametersNamed);
+ dart.initField(ReflectionInfo, this, 'functionType', functionType);
+ dart.initField(ReflectionInfo, this, 'cachedSortedIndices', null);
}
ReflectionInfo(jsFunction) {
let data = dart.as(jsFunction.$reflectionInfo, core.List);
@@ -2230,12 +2230,12 @@ var _js_helper;
let _pattern = Symbol('_pattern');
class TypeErrorDecoder extends core.Object {
TypeErrorDecoder(arguments$, argumentsExpr, expr, method, receiver, pattern) {
- this[_arguments] = arguments$;
- this[_argumentsExpr] = argumentsExpr;
- this[_expr] = expr;
- this[_method] = method;
- this[_receiver] = receiver;
- this[_pattern] = pattern;
+ dart.initField(TypeErrorDecoder, this, _arguments, arguments$);
+ dart.initField(TypeErrorDecoder, this, _argumentsExpr, argumentsExpr);
+ dart.initField(TypeErrorDecoder, this, _expr, expr);
+ dart.initField(TypeErrorDecoder, this, _method, method);
+ dart.initField(TypeErrorDecoder, this, _receiver, receiver);
+ dart.initField(TypeErrorDecoder, this, _pattern, pattern);
}
matchTypeError(message) {
let match = new RegExp(this[_pattern]).exec(message);
@@ -2937,17 +2937,17 @@ var _js_helper;
}
class Creates extends core.Object {
Creates(types) {
- this.types = types;
+ dart.initField(Creates, this, 'types', types);
}
}
class Returns extends core.Object {
Returns(types) {
- this.types = types;
+ dart.initField(Returns, this, 'types', types);
}
}
class JSName extends core.Object {
JSName(name) {
- this.name = name;
+ dart.initField(JSName, this, 'name', name);
}
}
// Function boolConversionCheck: (dynamic) → dynamic
@@ -3221,11 +3221,11 @@ var _js_helper;
});
class TypeErrorImplementation extends core.Error {
TypeErrorImplementation(value, type) {
- this.message = `type '${Primitives.objectTypeName(value)}' is not a subtype ` + `of type '${type}'`;
+ dart.initField(TypeErrorImplementation, this, 'message', `type '${Primitives.objectTypeName(value)}' is not a subtype ` + `of type '${type}'`);
super.Error();
}
fromMessage(message) {
- this.message = message;
+ dart.initField(TypeErrorImplementation, this, 'message', message);
super.Error();
}
toString() {
@@ -3236,7 +3236,7 @@ var _js_helper;
dart.defineNamedConstructor(TypeErrorImplementation, 'fromMessage');
class CastErrorImplementation extends core.Error {
CastErrorImplementation(actualType, expectedType) {
- this.message = `CastError: Casting value of type ${actualType} to` + ` incompatible type ${expectedType}`;
+ dart.initField(CastErrorImplementation, this, 'message', `CastError: Casting value of type ${actualType} to` + ` incompatible type ${expectedType}`);
super.Error();
}
toString() {
@@ -3275,7 +3275,7 @@ var _js_helper;
}
class RuntimeError extends core.Error {
RuntimeError(message) {
- this.message = message;
+ dart.initField(RuntimeError, this, 'message', message);
super.Error();
}
toString() {
@@ -3284,7 +3284,7 @@ var _js_helper;
}
class DeferredNotLoadedError extends core.Error {
DeferredNotLoadedError(libraryName) {
- this.libraryName = libraryName;
+ dart.initField(DeferredNotLoadedError, this, 'libraryName', libraryName);
super.Error();
}
toString() {
@@ -3303,10 +3303,10 @@ var _js_helper;
let _assertCheck = Symbol('_assertCheck');
class RuntimeFunctionType extends RuntimeType {
RuntimeFunctionType(returnType, parameterTypes, optionalParameterTypes, namedParameters) {
- this.returnType = returnType;
- this.parameterTypes = parameterTypes;
- this.optionalParameterTypes = optionalParameterTypes;
- this.namedParameters = namedParameters;
+ dart.initField(RuntimeFunctionType, this, 'returnType', returnType);
+ dart.initField(RuntimeFunctionType, this, 'parameterTypes', parameterTypes);
+ dart.initField(RuntimeFunctionType, this, 'optionalParameterTypes', optionalParameterTypes);
+ dart.initField(RuntimeFunctionType, this, 'namedParameters', namedParameters);
super.RuntimeType();
}
get isVoid() {
@@ -3524,7 +3524,7 @@ var _js_helper;
}
class RuntimeTypePlain extends RuntimeType {
RuntimeTypePlain(name) {
- this.name = name;
+ dart.initField(RuntimeTypePlain, this, 'name', name);
super.RuntimeType();
}
toRti() {
@@ -3540,9 +3540,9 @@ var _js_helper;
}
class RuntimeTypeGeneric extends RuntimeType {
RuntimeTypeGeneric(name, arguments$, rti) {
- this.name = name;
- this.arguments = arguments$;
- this.rti = rti;
+ dart.initField(RuntimeTypeGeneric, this, 'name', name);
+ dart.initField(RuntimeTypeGeneric, this, 'arguments', arguments$);
+ dart.initField(RuntimeTypeGeneric, this, 'rti', rti);
super.RuntimeType();
}
toRti() {
@@ -3575,8 +3575,8 @@ var _js_helper;
let _convert = Symbol('_convert');
class FunctionTypeInfoDecoderRing extends core.Object {
FunctionTypeInfoDecoderRing(typeData) {
- this[_typeData] = typeData;
- this[_cachedToString] = null;
+ dart.initField(FunctionTypeInfoDecoderRing, this, _typeData, typeData);
+ dart.initField(FunctionTypeInfoDecoderRing, this, _cachedToString, null);
}
get [_hasReturnType]() {
return "ret" in this[_typeData];
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698