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 dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
6 | 6 |
7 import '../closure.dart' as closure; | 7 import '../closure.dart' as closure; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/names.dart' show | 9 import '../common/names.dart' show |
10 Identifiers, | |
10 Names, | 11 Names, |
11 Selectors; | 12 Selectors; |
12 import '../common/tasks.dart' show | 13 import '../common/tasks.dart' show |
13 CompilerTask; | 14 CompilerTask; |
14 import '../compiler.dart' show | 15 import '../compiler.dart' show |
15 Compiler; | 16 Compiler; |
16 import '../constants/expressions.dart'; | 17 import '../constants/expressions.dart'; |
17 import '../dart_types.dart'; | 18 import '../dart_types.dart'; |
18 import '../elements/elements.dart'; | 19 import '../elements/elements.dart'; |
19 import '../elements/modelx.dart' show | 20 import '../elements/modelx.dart' show |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1892 | 1893 |
1893 @override | 1894 @override |
1894 ir.Primitive visitUnresolvedSuperGet( | 1895 ir.Primitive visitUnresolvedSuperGet( |
1895 ast.Send node, | 1896 ast.Send node, |
1896 Element element, _) { | 1897 Element element, _) { |
1897 return buildInstanceNoSuchMethod( | 1898 return buildInstanceNoSuchMethod( |
1898 elements.getSelector(node), elements.getTypeMask(node), []); | 1899 elements.getSelector(node), elements.getTypeMask(node), []); |
1899 } | 1900 } |
1900 | 1901 |
1901 @override | 1902 @override |
1903 ir.Primitive visitUnresolvedSuperSet( | |
1904 ast.Send node, | |
1905 Element element, | |
1906 ast.Node rhs, _) { | |
1907 return buildInstanceNoSuchMethod( | |
1908 elements.getSelector(node), elements.getTypeMask(node), [visit(rhs)]); | |
1909 } | |
1910 | |
1911 @override | |
1902 ir.Primitive visitThisGet(ast.Identifier node, _) { | 1912 ir.Primitive visitThisGet(ast.Identifier node, _) { |
1903 if (irBuilder.state.thisParameter == null) { | 1913 if (irBuilder.state.thisParameter == null) { |
1904 // TODO(asgerf,johnniwinther): Should be in a visitInvalidThis method. | 1914 // TODO(asgerf,johnniwinther): Should be in a visitInvalidThis method. |
1905 // 'this' in static context. Just translate to null. | 1915 // 'this' in static context. Just translate to null. |
1906 assert(compiler.compilationFailed); | 1916 assert(compiler.compilationFailed); |
1907 return irBuilder.buildNullConstant(); | 1917 return irBuilder.buildNullConstant(); |
1908 } | 1918 } |
1909 return irBuilder.buildThis(); | 1919 return irBuilder.buildThis(); |
1910 } | 1920 } |
1911 | 1921 |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3322 | 3332 |
3323 ir.Primitive visitThrow(ast.Throw node) { | 3333 ir.Primitive visitThrow(ast.Throw node) { |
3324 assert(irBuilder.isOpen); | 3334 assert(irBuilder.isOpen); |
3325 // This function is not called for throw expressions occurring as | 3335 // This function is not called for throw expressions occurring as |
3326 // statements. | 3336 // statements. |
3327 return irBuilder.buildNonTailThrow(visit(node.expression)); | 3337 return irBuilder.buildNonTailThrow(visit(node.expression)); |
3328 } | 3338 } |
3329 | 3339 |
3330 ir.Primitive buildInstanceNoSuchMethod(Selector selector, | 3340 ir.Primitive buildInstanceNoSuchMethod(Selector selector, |
3331 TypeMask mask, | 3341 TypeMask mask, |
3332 List<ir.Primitive> arguments) { | 3342 List<ir.Primitive> arguments) { |
asgerf
2016/02/08 18:42:44
The name of this method doesn't seem right anymore
Johnni Winther
2016/02/09 08:37:29
Done.
| |
3333 return irBuilder.buildDynamicInvocation( | 3343 ClassElement cls = elements.analyzedElement.enclosingClass; |
3334 irBuilder.buildThis(), | 3344 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); |
3335 Selectors.noSuchMethod_, | 3345 if (!Selectors.noSuchMethod_.signatureApplies(element)) { |
3336 mask, | 3346 element = compiler.coreClasses.objectClass.lookupMember( |
3347 Identifiers.noSuchMethod_); | |
3348 } | |
3349 return irBuilder.buildSuperMethodInvocation( | |
3350 element, | |
3351 Selectors.noSuchMethod_.callStructure, | |
3337 [irBuilder.buildInvocationMirror(selector, arguments)]); | 3352 [irBuilder.buildInvocationMirror(selector, arguments)]); |
3338 } | 3353 } |
3339 | 3354 |
3340 @override | 3355 @override |
3341 ir.Primitive visitUnresolvedCompound( | 3356 ir.Primitive visitUnresolvedCompound( |
3342 ast.Send node, | 3357 ast.Send node, |
3343 Element element, | 3358 Element element, |
3344 op.AssignmentOperator operator, | 3359 op.AssignmentOperator operator, |
3345 ast.Node rhs, _) { | 3360 ast.Node rhs, _) { |
3346 // TODO(asgerf): What is unresolved? The getter and/or the setter? | 3361 // TODO(asgerf): What is unresolved? The getter and/or the setter? |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3900 } | 3915 } |
3901 | 3916 |
3902 Element get closureConverter { | 3917 Element get closureConverter { |
3903 return _backend.helpers.closureConverter; | 3918 return _backend.helpers.closureConverter; |
3904 } | 3919 } |
3905 | 3920 |
3906 void addNativeMethod(FunctionElement function) { | 3921 void addNativeMethod(FunctionElement function) { |
3907 _backend.emitter.nativeEmitter.nativeMethods.add(function); | 3922 _backend.emitter.nativeEmitter.nativeMethods.add(function); |
3908 } | 3923 } |
3909 } | 3924 } |
OLD | NEW |