Chromium Code Reviews| Index: sdk/lib/_internal/lib/js_mirrors.dart |
| diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart |
| index 52aca10326e72eb235fd37debd112a095ab4aadf..819eb699276f3af14ffd3d803b8a76909a3d2cfb 100644 |
| --- a/sdk/lib/_internal/lib/js_mirrors.dart |
| +++ b/sdk/lib/_internal/lib/js_mirrors.dart |
| @@ -243,7 +243,7 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror |
| if (mirror == null) mirror = variables[fieldName]; |
| if (mirror == null) { |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null); |
| + throw new NoSuchMethodError(this, a(fieldName), [arg], null); |
| } |
| mirror._setField(this, arg); |
| return reflect(arg); |
| @@ -253,7 +253,7 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror |
| JsMirror mirror = members[fieldName]; |
| if (mirror == null) { |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, '${n(fieldName)}', [], null); |
| + throw new NoSuchMethodError(this, filedName, [], null); |
|
ngeoffray
2013/08/30 06:51:12
filedName ? -> fieldName
Lasse Reichstein Nielsen
2013/08/30 14:06:02
Done.
|
| } |
| return reflect(mirror._getField(this)); |
| } |
| @@ -266,11 +266,9 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror |
| } |
| JsDeclarationMirror mirror = members[memberName]; |
| if (mirror == null) { |
| - // TODO(ahe): Pass namedArguments when NoSuchMethodError has been |
| - // fixed to use Symbol. |
| // TODO(ahe): What receiver to use? |
| throw new NoSuchMethodError( |
| - this, '${n(memberName)}', positionalArguments, null); |
| + this, memberName, positionalArguments, namedArguments); |
| } |
| return reflect(mirror._invoke(positionalArguments, namedArguments)); |
| } |
| @@ -380,6 +378,8 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror |
| String n(Symbol symbol) => _symbol_dev.Symbol.getName(symbol); |
| +Symbol a(Symbol symbol) => s("${n(symbol)}="); |
|
ahe
2013/08/30 06:46:35
Please use a descriptive name. We only use "s" and
Lasse Reichstein Nielsen
2013/08/30 14:06:02
Changed to "setterSymbol".
|
| + |
| Symbol s(String name) { |
| if (name == null) return null; |
| return new _symbol_dev.Symbol.unvalidated(name); |
| @@ -507,20 +507,19 @@ class JsMixinApplication extends JsTypeMirror with JsObjectMirror |
| Symbol memberName, |
| List positionalArguments, |
| [Map<Symbol,dynamic> namedArguments]) { |
| - // TODO(ahe): Pass namedArguments when NoSuchMethodError has |
| - // been fixed to use Symbol. |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, n(memberName), positionalArguments, null); |
| + throw new NoSuchMethodError(this, memberName, |
| + positionalArguments, namedArguments); |
| } |
| InstanceMirror getField(Symbol fieldName) { |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, n(fieldName), null, null); |
| + throw new NoSuchMethodError(this, fieldName, null, null); |
| } |
| InstanceMirror setField(Symbol fieldName, Object arg) { |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null); |
| + throw new NoSuchMethodError(this, a(fieldName), [arg], null); |
| } |
| List<ClassMirror> get superinterfaces => [mixin]; |
| @@ -889,7 +888,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror |
| return reflect(arg); |
| } |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null); |
| + throw new NoSuchMethodError(this, a(fieldName), [arg], null); |
| } |
| InstanceMirror getField(Symbol fieldName) { |
| @@ -907,7 +906,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror |
| } |
| } |
| // TODO(ahe): What receiver to use? |
| - throw new NoSuchMethodError(this, n(fieldName), null, null); |
| + throw new NoSuchMethodError(this, fieldName, null, null); |
| } |
| InstanceMirror newInstance(Symbol constructorName, |
| @@ -922,11 +921,9 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror |
| mirror = constructors.values.firstWhere( |
| (m) => m.constructorName == constructorName, |
| orElse: () { |
| - // TODO(ahe): Pass namedArguments when NoSuchMethodError has been |
| - // fixed to use Symbol. |
| // TODO(ahe): What receiver to use? |
| throw new NoSuchMethodError( |
| - owner, n(constructorName), positionalArguments, null); |
| + owner, constructorName, positionalArguments, namedArguments); |
| }); |
| JsCache.update(_jsConstructorCache, n(constructorName), mirror); |
| } |
| @@ -1004,11 +1001,9 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror |
| } |
| JsMethodMirror mirror = methods[memberName]; |
| if (mirror == null || !mirror.isStatic) { |
| - // TODO(ahe): Pass namedArguments when NoSuchMethodError has |
| - // been fixed to use Symbol. |
| // TODO(ahe): What receiver to use? |
| throw new NoSuchMethodError( |
| - this, n(memberName), positionalArguments, null); |
| + this, memberName, positionalArguments, namedArguments); |
| } |
| return reflect(mirror._invoke(positionalArguments, namedArguments)); |
| } |
| @@ -1123,7 +1118,7 @@ class JsVariableMirror extends JsDeclarationMirror implements VariableMirror { |
| void _setField(JsMirror receiver, Object arg) { |
| if (isFinal) { |
| - throw new NoSuchMethodError(this, '${n(simpleName)}=', [arg], null); |
| + throw new NoSuchMethodError(this, a(simpleName), [arg], null); |
| } |
| receiver._storeField(_jsName, arg); |
| } |
| @@ -1298,11 +1293,9 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror { |
| throw new RuntimeError('Cannot invoke instance method without receiver.'); |
| } |
| if (_parameterCount != positionalArguments.length || _jsFunction == null) { |
| - // TODO(ahe): Pass namedArguments when NoSuchMethodError has |
| - // been fixed to use Symbol. |
| // TODO(ahe): What receiver to use? |
| throw new NoSuchMethodError( |
| - owner, n(simpleName), positionalArguments, null); |
| + owner, simpleName, positionalArguments, namedArguments); |
| } |
| return JS('', r'#.apply(#, #)', _jsFunction, JS_CURRENT_ISOLATE(), |
| new List.from(positionalArguments)); |
| @@ -1321,7 +1314,8 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror { |
| if (isSetter) { |
| return _invoke([arg], null); |
| } else { |
| - throw new NoSuchMethodError(this, '${n(simpleName)}=', [], null); |
| + throw new NoSuchMethodError(this, a(simpleName), |
| + [], null); |
|
ngeoffray
2013/08/30 06:51:12
one line?
Lasse Reichstein Nielsen
2013/08/30 14:06:02
Done.
|
| } |
| } |