| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
| 8 Compiler; | 8 Compiler; |
| 9 import '../constants/constant_constructors.dart'; | 9 import '../constants/constant_constructors.dart'; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ? enclosingElement.name | 218 ? enclosingElement.name |
| 219 : '${enclosingElement.kind}?'; | 219 : '${enclosingElement.kind}?'; |
| 220 return '$kind($holderName#${nameText})'; | 220 return '$kind($holderName#${nameText})'; |
| 221 } else { | 221 } else { |
| 222 return '$kind(${nameText})'; | 222 return '$kind(${nameText})'; |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 String _fixedBackendName = null; | 226 String _fixedBackendName = null; |
| 227 bool _isNative = false; | 227 bool _isNative = false; |
| 228 bool get isNative => _isNative; | 228 bool isJsInterop = false; |
| 229 bool get isNative => _isNative || isJsInterop; |
| 229 bool get hasFixedBackendName => _fixedBackendName != null; | 230 bool get hasFixedBackendName => _fixedBackendName != null; |
| 230 String get fixedBackendName => _fixedBackendName; | 231 String get fixedBackendName => _fixedBackendName; |
| 231 // Marks this element as a native element. | 232 // Marks this element as a native element. |
| 232 void setNative(String name) { | 233 void setNative(String name) { |
| 233 _isNative = true; | 234 _isNative = true; |
| 234 _fixedBackendName = name; | 235 _fixedBackendName = name; |
| 235 } | 236 } |
| 236 | 237 |
| 237 FunctionElement asFunctionElement() => null; | 238 FunctionElement asFunctionElement() => null; |
| 238 | 239 |
| (...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 } | 2413 } |
| 2413 | 2414 |
| 2414 void forEachBackendMember(void f(Element member)) { | 2415 void forEachBackendMember(void f(Element member)) { |
| 2415 backendMembers.forEach(f); | 2416 backendMembers.forEach(f); |
| 2416 } | 2417 } |
| 2417 | 2418 |
| 2418 bool implementsFunction(Compiler compiler) { | 2419 bool implementsFunction(Compiler compiler) { |
| 2419 return asInstanceOf(compiler.functionClass) != null || callType != null; | 2420 return asInstanceOf(compiler.functionClass) != null || callType != null; |
| 2420 } | 2421 } |
| 2421 | 2422 |
| 2422 bool get isNative => nativeTagInfo != null; | 2423 bool get isNative => nativeTagInfo != null || isJsInterop; |
| 2423 | 2424 |
| 2424 void setNative(String name) { | 2425 void setNative(String name) { |
| 2425 // TODO(johnniwinther): Assert that this is only called once. The memory | 2426 // TODO(johnniwinther): Assert that this is only called once. The memory |
| 2426 // compiler copies pre-processed elements into a new compiler through | 2427 // compiler copies pre-processed elements into a new compiler through |
| 2427 // [Compiler.onLibraryScanned] and thereby causes multiple calls to this | 2428 // [Compiler.onLibraryScanned] and thereby causes multiple calls to this |
| 2428 // method. | 2429 // method. |
| 2429 assert(invariant(this, nativeTagInfo == null || nativeTagInfo == name, | 2430 assert(invariant(this, nativeTagInfo == null || nativeTagInfo == name, |
| 2430 message: "Native tag info set inconsistently on $this: " | 2431 message: "Native tag info set inconsistently on $this: " |
| 2431 "Existing name '$nativeTagInfo', new name '$name'.")); | 2432 "Existing name '$nativeTagInfo', new name '$name'.")); |
| 2432 nativeTagInfo = name; | 2433 nativeTagInfo = name; |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 AstElement get definingElement; | 2915 AstElement get definingElement; |
| 2915 | 2916 |
| 2916 bool get hasResolvedAst => definingElement.hasTreeElements; | 2917 bool get hasResolvedAst => definingElement.hasTreeElements; |
| 2917 | 2918 |
| 2918 ResolvedAst get resolvedAst { | 2919 ResolvedAst get resolvedAst { |
| 2919 return new ResolvedAst(declaration, | 2920 return new ResolvedAst(declaration, |
| 2920 definingElement.node, definingElement.treeElements); | 2921 definingElement.node, definingElement.treeElements); |
| 2921 } | 2922 } |
| 2922 | 2923 |
| 2923 } | 2924 } |
| OLD | NEW |