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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart

Issue 767643002: dart2js: Make usage of names more consistent between compiler and runtime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix long lines. Created 6 years, 1 month 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
Index: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
index 1c0433d09d6ea373118e2b99fe2daf743980edd1..d634385d99fd039e04a16f6f1876c49183b5c1d8 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
@@ -23,7 +23,15 @@ import 'dart:_foreign_helper' show
JS_CURRENT_ISOLATE,
JS_CURRENT_ISOLATE_CONTEXT,
JS_EMBEDDED_GLOBAL,
- JS_GET_NAME;
+ JS_GET_NAME,
+ JS_TYPEDEF_TAG,
karlklose 2014/11/28 10:19:00 I think we should use JS_GET_NAME instead of havin
floitsch 2014/11/28 10:40:16 Added TODOs in the builder.
+ JS_FUNCTION_TYPE_TAG,
+ JS_FUNCTION_TYPE_RETURN_TYPE_TAG,
+ JS_FUNCTION_TYPE_VOID_RETURN_TAG,
+ JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG,
+ JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG,
+ JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG;
+
import 'dart:_internal' as _symbol_dev;
@@ -2602,19 +2610,44 @@ class JsFunctionTypeMirror extends BrokenClassMirror
JsFunctionTypeMirror(this._typeData, this.owner);
- bool get _hasReturnType => JS('bool', '"ret" in #', _typeData);
- get _returnType => JS('', '#.ret', _typeData);
+ bool get _hasReturnType {
+ return JS('bool', '# in #', JS_FUNCTION_TYPE_RETURN_TYPE_TAG(), _typeData);
+ }
+ get _returnType {
+ return JS('', '#[#]', _typeData, JS_FUNCTION_TYPE_RETURN_TYPE_TAG());
+ }
- bool get _isVoid => JS('bool', '!!#.void', _typeData);
+ bool get _isVoid {
+ return JS('bool', '!!#[#]', _typeData, JS_FUNCTION_TYPE_VOID_RETURN_TAG());
+ }
- bool get _hasArguments => JS('bool', '"args" in #', _typeData);
- List get _arguments => JS('JSExtendableArray', '#.args', _typeData);
+ bool get _hasArguments {
+ return JS('bool', '# in #',
+ JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG(), _typeData);
+ }
+ List get _arguments {
+ return JS('JSExtendableArray', '#[#]',
+ _typeData, JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG());
+ }
- bool get _hasOptionalArguments => JS('bool', '"opt" in #', _typeData);
- List get _optionalArguments => JS('JSExtendableArray', '#.opt', _typeData);
+ bool get _hasOptionalArguments {
+ return JS('bool', '# in #',
+ JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG(), _typeData);
+ }
+ List get _optionalArguments {
+ return JS('JSExtendableArray', '#[#]',
+ _typeData, JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG());
+ }
+
+ bool get _hasNamedArguments {
+ return JS('bool', '# in #',
+ JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG(), _typeData);
+ }
+ get _namedArguments {
+ return JS('=Object', '#[#]',
+ _typeData, JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG());
+ }
- bool get _hasNamedArguments => JS('bool', '"named" in #', _typeData);
- get _namedArguments => JS('=Object', '#.named', _typeData);
bool get isOriginalDeclaration => true;
bool get isAbstract => false;
@@ -2799,10 +2832,13 @@ TypeMirror typeMirrorFromRuntimeTypeRepresentation(
return reflectClassByMangledName(
getMangledTypeName(createRuntimeType(representation)));
}
- if (type != null && JS('', '#.typedef', type) != null) {
+ String typedefPropertyName = JS_TYPEDEF_TAG();
+ String functionTagPropertyName = JS_FUNCTION_TYPE_TAG();
+ if (type != null && JS('', '#[#]', type, typedefPropertyName) != null) {
return typeMirrorFromRuntimeTypeRepresentation(
- owner, JS('', '#.typedef', type));
- } else if (type != null && JS('', '#.func', type) != null) {
+ owner, JS('', '#[#]', type, typedefPropertyName));
+ } else if (type != null &&
+ JS('', '#[#]', type, functionTagPropertyName) != null) {
return new JsFunctionTypeMirror(type, owner);
}
return reflectClass(Function);

Powered by Google App Engine
This is Rietveld 408576698