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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution, ParsingContext; | 8 import '../common/resolution.dart' show Resolution, ParsingContext; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constant_constructors.dart'; | 10 import '../constants/constant_constructors.dart'; |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 | 1838 |
1839 MemberElement get memberContext => enclosingElement; | 1839 MemberElement get memberContext => enclosingElement; |
1840 | 1840 |
1841 bool get isLocal => false; | 1841 bool get isLocal => false; |
1842 | 1842 |
1843 bool get isMalformed => true; | 1843 bool get isMalformed => true; |
1844 | 1844 |
1845 DynamicType get type => const DynamicType(); | 1845 DynamicType get type => const DynamicType(); |
1846 } | 1846 } |
1847 | 1847 |
1848 class AbstractFieldElementX extends ElementX implements AbstractFieldElement { | 1848 class AbstractFieldElementX extends ElementX |
| 1849 with AbstractFieldElementCommon |
| 1850 implements AbstractFieldElement { |
1849 GetterElementX getter; | 1851 GetterElementX getter; |
1850 SetterElementX setter; | 1852 SetterElementX setter; |
1851 | 1853 |
1852 AbstractFieldElementX(String name, Element enclosing) | 1854 AbstractFieldElementX(String name, Element enclosing) |
1853 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); | 1855 : super(name, ElementKind.ABSTRACT_FIELD, enclosing); |
1854 | 1856 |
1855 DartType computeType(Compiler compiler) { | 1857 DartType computeType(Compiler compiler) { |
1856 throw "internal error: AbstractFieldElement has no type"; | 1858 throw "internal error: AbstractFieldElement has no type"; |
1857 } | 1859 } |
1858 | 1860 |
(...skipping 22 matching lines...) Expand all Loading... |
1881 // The resolver ensures that the flags match (ignoring abstract). | 1883 // The resolver ensures that the flags match (ignoring abstract). |
1882 if (getter != null) { | 1884 if (getter != null) { |
1883 return new Modifiers.withFlags(getter.modifiers.nodes, | 1885 return new Modifiers.withFlags(getter.modifiers.nodes, |
1884 getter.modifiers.flags | Modifiers.FLAG_ABSTRACT); | 1886 getter.modifiers.flags | Modifiers.FLAG_ABSTRACT); |
1885 } else { | 1887 } else { |
1886 return new Modifiers.withFlags(setter.modifiers.nodes, | 1888 return new Modifiers.withFlags(setter.modifiers.nodes, |
1887 setter.modifiers.flags | Modifiers.FLAG_ABSTRACT); | 1889 setter.modifiers.flags | Modifiers.FLAG_ABSTRACT); |
1888 } | 1890 } |
1889 } | 1891 } |
1890 | 1892 |
1891 bool get isInstanceMember { | |
1892 return isClassMember && !isStatic; | |
1893 } | |
1894 | |
1895 accept(ElementVisitor visitor, arg) { | 1893 accept(ElementVisitor visitor, arg) { |
1896 return visitor.visitAbstractFieldElement(this, arg); | 1894 return visitor.visitAbstractFieldElement(this, arg); |
1897 } | 1895 } |
1898 | |
1899 bool get isAbstract { | |
1900 return getter != null && getter.isAbstract || | |
1901 setter != null && setter.isAbstract; | |
1902 } | |
1903 } | 1896 } |
1904 | 1897 |
1905 // TODO(johnniwinther): [FunctionSignature] should be merged with | 1898 // TODO(johnniwinther): [FunctionSignature] should be merged with |
1906 // [FunctionType]. | 1899 // [FunctionType]. |
1907 // TODO(karlklose): all these lists should have element type [FormalElement]. | 1900 // TODO(karlklose): all these lists should have element type [FormalElement]. |
1908 class FunctionSignatureX extends FunctionSignatureCommon | 1901 class FunctionSignatureX extends FunctionSignatureCommon |
1909 implements FunctionSignature { | 1902 implements FunctionSignature { |
1910 final List<DartType> typeVariables; | 1903 final List<DartType> typeVariables; |
1911 final List<Element> requiredParameters; | 1904 final List<Element> requiredParameters; |
1912 final List<Element> optionalParameters; | 1905 final List<Element> optionalParameters; |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3293 body = node.asFunctionExpression().body; | 3286 body = node.asFunctionExpression().body; |
3294 } | 3287 } |
3295 return new ParsedResolvedAst( | 3288 return new ParsedResolvedAst( |
3296 declaration, | 3289 declaration, |
3297 node, | 3290 node, |
3298 body, | 3291 body, |
3299 definingElement.treeElements, | 3292 definingElement.treeElements, |
3300 definingElement.compilationUnit.script.resourceUri); | 3293 definingElement.compilationUnit.script.resourceUri); |
3301 } | 3294 } |
3302 } | 3295 } |
OLD | NEW |