OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library dart2js.kernel.element_map; | 5 library dart2js.kernel.element_map; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 import 'package:kernel/clone.dart'; | 8 import 'package:kernel/clone.dart'; |
9 import 'package:kernel/type_algebra.dart'; | 9 import 'package:kernel/type_algebra.dart'; |
10 | 10 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 bool isExternal = node.isExternal; | 263 bool isExternal = node.isExternal; |
264 | 264 |
265 ir.FunctionNode functionNode; | 265 ir.FunctionNode functionNode; |
266 if (node is ir.Constructor) { | 266 if (node is ir.Constructor) { |
267 functionNode = node.function; | 267 functionNode = node.function; |
268 constructor = new KGenerativeConstructor(memberIndex, enclosingClass, | 268 constructor = new KGenerativeConstructor(memberIndex, enclosingClass, |
269 name, _getParameterStructure(functionNode), | 269 name, _getParameterStructure(functionNode), |
270 isExternal: isExternal, isConst: node.isConst); | 270 isExternal: isExternal, isConst: node.isConst); |
271 } else if (node is ir.Procedure) { | 271 } else if (node is ir.Procedure) { |
272 functionNode = node.function; | 272 functionNode = node.function; |
| 273 bool isFromEnvironment = isExternal && |
| 274 name.text == 'fromEnvironment' && |
| 275 const ['int', 'bool', 'String'].contains(enclosingClass.name); |
273 constructor = new KFactoryConstructor(memberIndex, enclosingClass, name, | 276 constructor = new KFactoryConstructor(memberIndex, enclosingClass, name, |
274 _getParameterStructure(functionNode), | 277 _getParameterStructure(functionNode), |
275 isExternal: isExternal, isConst: node.isConst); | 278 isExternal: isExternal, |
| 279 isConst: node.isConst, |
| 280 isFromEnvironmentConstructor: isFromEnvironment); |
276 } else { | 281 } else { |
277 // TODO(johnniwinther): Convert `node.location` to a [SourceSpan]. | 282 // TODO(johnniwinther): Convert `node.location` to a [SourceSpan]. |
278 throw new SpannableAssertionFailure( | 283 throw new SpannableAssertionFailure( |
279 NO_LOCATION_SPANNABLE, "Unexpected constructor node: ${node}."); | 284 NO_LOCATION_SPANNABLE, "Unexpected constructor node: ${node}."); |
280 } | 285 } |
281 _memberList.add(new _ConstructorData(node, functionNode)); | 286 _memberList.add(new _ConstructorData(node, functionNode)); |
282 return constructor; | 287 return constructor; |
283 }); | 288 }); |
284 } | 289 } |
285 | 290 |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 return node.isExternal && | 1508 return node.isExternal && |
1504 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1509 !elementMap.isForeignLibrary(node.enclosingLibrary); |
1505 } | 1510 } |
1506 | 1511 |
1507 @override | 1512 @override |
1508 bool isJsInteropMember(MemberEntity element) { | 1513 bool isJsInteropMember(MemberEntity element) { |
1509 // TODO(johnniwinther): Compute this. | 1514 // TODO(johnniwinther): Compute this. |
1510 return false; | 1515 return false; |
1511 } | 1516 } |
1512 } | 1517 } |
OLD | NEW |