@@ -20,27 +20,6 @@ var dart, _js_helper, _js_primitives;
20
20
return getOwnPropertyNames ( obj ) . concat ( getOwnPropertySymbols ( obj ) ) ;
21
21
}
22
22
23
- // Adapted from Angular.js
24
- let FN_ARGS = / ^ f u n c t i o n \s * [ ^ \( ] * \( \s * ( [ ^ \) ] * ) \) / m;
25
- let FN_ARG_SPLIT = / , / ;
26
- let FN_ARG = / ^ \s * ( _ ? ) ( \S + ?) \1\s * $ / ;
27
- let STRIP_COMMENTS = / ( ( \/ \/ .* $ ) | ( \/ \* [ \s \S ] * ?\* \/ ) ) / mg;
28
-
29
- function formalParameterList ( fn ) {
30
- let fnText , argDecl ;
31
- let args = [ ] ;
32
- fnText = fn . toString ( ) . replace ( STRIP_COMMENTS , '' ) ;
33
- argDecl = fnText . match ( FN_ARGS ) ;
34
-
35
- let r = argDecl [ 1 ] . split ( FN_ARG_SPLIT ) ;
36
- for ( let arg of r ) {
37
- arg . replace ( FN_ARG , function ( all , underscore , name ) {
38
- args . push ( name ) ;
39
- } ) ;
40
- }
41
- return args ;
42
- }
43
-
44
23
function dload ( obj , field ) {
45
24
field = _canonicalFieldName ( obj , field ) ;
46
25
if ( _getMethodType ( obj , field ) !== void 0 ) {
@@ -126,7 +105,7 @@ var dart, _js_helper, _js_primitives;
126
105
// TODO(vsm): This should record / check the receiver type
127
106
// as well. E.g., only look for core.$map if the receiver
128
107
// is an Iterable.
129
- 'map' : ( ) => core . $map ,
108
+ 'map' : ( ) => core . $map
130
109
} ;
131
110
132
111
// TODO(leafp): Integrate this with the eventual proper extension
@@ -572,10 +551,10 @@ var dart, _js_helper, _js_primitives;
572
551
if ( arguments . length == 1 ) {
573
552
// No type arguments, it's all dynamic
574
553
let len = closure . length ;
575
- function build ( ) {
554
+ let build = ( ) => {
576
555
let args = Array . apply ( null , new Array ( len ) ) . map ( ( ) => core . Object ) ;
577
556
return functionType ( core . Object , args ) ;
578
- }
557
+ } ;
579
558
// We could be called before Object is defined.
580
559
if ( core . Object === void 0 ) return fn ( closure , build ) ;
581
560
t = build ( ) ;
@@ -1021,8 +1000,7 @@ var dart, _js_helper, _js_primitives;
1021
1000
if ( sigObj === void 0 ) return void 0 ;
1022
1001
let parts = sigObj [ name ] ;
1023
1002
if ( parts === void 0 ) return void 0 ;
1024
- let sig = functionType . apply ( null , parts ) ;
1025
- return sig ;
1003
+ return functionType . apply ( null , parts ) ;
1026
1004
}
1027
1005
1028
1006
/// Get the type of a constructor from a class using the stored signature
@@ -1036,8 +1014,7 @@ var dart, _js_helper, _js_primitives;
1036
1014
if ( sigCtor === void 0 ) return void 0 ;
1037
1015
let parts = sigCtor [ name ] ;
1038
1016
if ( parts === void 0 ) return void 0 ;
1039
- let sig = functionType . apply ( null , parts ) ;
1040
- return sig ;
1017
+ return functionType . apply ( null , parts ) ;
1041
1018
}
1042
1019
dart . classGetConstructorType = _getConstructorType ;
1043
1020
@@ -1047,7 +1024,7 @@ var dart, _js_helper, _js_primitives;
1047
1024
/// TODO(leafp): Consider caching the tearoff on the object?
1048
1025
function bind ( obj , name ) {
1049
1026
let f = obj [ name ] . bind ( obj ) ;
1050
- let sig = _getMethodType ( obj , name )
1027
+ let sig = _getMethodType ( obj , name ) ;
1051
1028
assert ( sig ) ;
1052
1029
setRuntimeType ( f , sig ) ;
1053
1030
return f ;
@@ -1076,11 +1053,10 @@ var dart, _js_helper, _js_primitives;
1076
1053
// Set the lazily computed runtime type field on static methods
1077
1054
function _setStaticTypes ( f , names ) {
1078
1055
for ( let name of names ) {
1079
- function getT ( ) {
1056
+ defineProperty ( f [ name ] , _runtimeType , { get : function ( ) {
1080
1057
let parts = f [ _staticSig ] [ name ] ;
1081
1058
return functionType . apply ( null , parts ) ;
1082
- } ;
1083
- defineProperty ( f [ name ] , _runtimeType , { get : getT } ) ;
1059
+ } } ) ;
1084
1060
}
1085
1061
}
1086
1062
@@ -1107,7 +1083,7 @@ var dart, _js_helper, _js_primitives;
1107
1083
_setMethodSignature ( f , methods ) ;
1108
1084
_setStaticSignature ( f , statics ) ;
1109
1085
_setStaticTypes ( f , names ) ;
1110
- } ;
1086
+ }
1111
1087
dart . setSignature = setSignature ;
1112
1088
1113
1089
let _value = Symbol ( '_value' ) ;
@@ -1290,13 +1266,13 @@ var dart, _js_helper, _js_primitives;
1290
1266
let result = _split . apply ( this , arguments ) ;
1291
1267
dart . setType ( result , core . List$ ( core . String ) ) ;
1292
1268
return result ;
1293
- }
1269
+ } ;
1294
1270
String . prototype . get = function ( i ) {
1295
1271
return this [ i ] ;
1296
- }
1272
+ } ;
1297
1273
String . prototype . codeUnitAt = function ( i ) {
1298
1274
return this . charCodeAt ( i ) ;
1299
- }
1275
+ } ;
1300
1276
String . prototype . replaceAllMapped = function ( from , cb ) {
1301
1277
return this . replace ( from . multiple , function ( ) {
1302
1278
// Remove offset & string from the result array
@@ -1305,7 +1281,7 @@ var dart, _js_helper, _js_primitives;
1305
1281
// The callback receives match, p1, ..., pn
1306
1282
return cb ( matches ) ;
1307
1283
} ) ;
1308
- }
1284
+ } ;
1309
1285
String . prototype [ '+' ] = function ( arg ) { return this . valueOf ( ) + arg ; } ;
1310
1286
1311
1287
Boolean . prototype [ '!' ] = function ( ) { return ! this . valueOf ( ) ; } ;
0 commit comments