| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return element; | 199 return element; |
| 200 } | 200 } |
| 201 | 201 |
| 202 DeclarationSite get declarationSite => null; | 202 DeclarationSite get declarationSite => null; |
| 203 | 203 |
| 204 void reuseElement() { | 204 void reuseElement() { |
| 205 throw "reuseElement isn't implemented on ${runtimeType}."; | 205 throw "reuseElement isn't implemented on ${runtimeType}."; |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 class ErroneousElementX extends ElementX implements ErroneousElement { | 209 class ErroneousElementX extends ElementX |
| 210 with ConstructorElementCommon |
| 211 implements ErroneousElement { |
| 210 final MessageKind messageKind; | 212 final MessageKind messageKind; |
| 211 final Map messageArguments; | 213 final Map messageArguments; |
| 212 | 214 |
| 213 ErroneousElementX( | 215 ErroneousElementX( |
| 214 this.messageKind, this.messageArguments, String name, Element enclosing) | 216 this.messageKind, this.messageArguments, String name, Element enclosing) |
| 215 : super(name, ElementKind.ERROR, enclosing); | 217 : super(name, ElementKind.ERROR, enclosing); |
| 216 | 218 |
| 217 bool get isTopLevel => false; | 219 bool get isTopLevel => false; |
| 218 | 220 |
| 219 bool get isSynthesized => true; | 221 bool get isSynthesized => true; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 accept(ElementVisitor visitor, arg) { | 279 accept(ElementVisitor visitor, arg) { |
| 278 return visitor.visitErroneousElement(this, arg); | 280 return visitor.visitErroneousElement(this, arg); |
| 279 } | 281 } |
| 280 | 282 |
| 281 @override | 283 @override |
| 282 get isEffectiveTargetMalformed { | 284 get isEffectiveTargetMalformed { |
| 283 throw new UnsupportedError("isEffectiveTargetMalformed"); | 285 throw new UnsupportedError("isEffectiveTargetMalformed"); |
| 284 } | 286 } |
| 285 | 287 |
| 286 @override | 288 @override |
| 287 bool get isFromEnvironmentConstructor => false; | |
| 288 | |
| 289 @override | |
| 290 List<DartType> get typeVariables => unsupported(); | 289 List<DartType> get typeVariables => unsupported(); |
| 291 } | 290 } |
| 292 | 291 |
| 293 /// A constructor that was synthesized to recover from a compile-time error. | 292 /// A constructor that was synthesized to recover from a compile-time error. |
| 294 class ErroneousConstructorElementX extends ErroneousElementX | 293 class ErroneousConstructorElementX extends ErroneousElementX |
| 295 with | 294 with |
| 296 PatchMixin<FunctionElement>, | 295 PatchMixin<FunctionElement>, |
| 297 AnalyzableElementX, | 296 AnalyzableElementX, |
| 298 ConstantConstructorMixin | 297 ConstantConstructorMixin |
| 299 implements ConstructorElementX { | 298 implements ConstructorElementX { |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 message: "Constant constructor set on fromEnvironment " | 2159 message: "Constant constructor set on fromEnvironment " |
| 2161 "constructor: $this.")); | 2160 "constructor: $this.")); |
| 2162 assert(invariant( | 2161 assert(invariant( |
| 2163 this, _constantConstructor == null || _constantConstructor == value, | 2162 this, _constantConstructor == null || _constantConstructor == value, |
| 2164 message: "Constant constructor already computed for $this:" | 2163 message: "Constant constructor already computed for $this:" |
| 2165 "Existing: $_constantConstructor, new: $value")); | 2164 "Existing: $_constantConstructor, new: $value")); |
| 2166 _constantConstructor = value; | 2165 _constantConstructor = value; |
| 2167 } | 2166 } |
| 2168 } | 2167 } |
| 2169 | 2168 |
| 2170 bool get isFromEnvironmentConstructor { | |
| 2171 return name == 'fromEnvironment' && | |
| 2172 library.isDartCore && | |
| 2173 (enclosingClass.name == 'bool' || | |
| 2174 enclosingClass.name == 'int' || | |
| 2175 enclosingClass.name == 'String'); | |
| 2176 } | |
| 2177 | |
| 2178 /// Returns the empty list of type variables by default. | 2169 /// Returns the empty list of type variables by default. |
| 2179 @override | 2170 @override |
| 2180 List<DartType> get typeVariables => functionSignature.typeVariables; | 2171 List<DartType> get typeVariables => functionSignature.typeVariables; |
| 2181 } | 2172 } |
| 2182 | 2173 |
| 2183 abstract class ConstructorElementX extends FunctionElementX | 2174 abstract class ConstructorElementX extends FunctionElementX |
| 2184 with ConstantConstructorMixin | 2175 with ConstantConstructorMixin, ConstructorElementCommon |
| 2185 implements ConstructorElement { | 2176 implements ConstructorElement { |
| 2186 bool isRedirectingGenerative = false; | 2177 bool isRedirectingGenerative = false; |
| 2187 | 2178 |
| 2188 ConstructorElementX( | 2179 ConstructorElementX( |
| 2189 String name, ElementKind kind, Modifiers modifiers, Element enclosing) | 2180 String name, ElementKind kind, Modifiers modifiers, Element enclosing) |
| 2190 : super(name, kind, modifiers, enclosing); | 2181 : super(name, kind, modifiers, enclosing); |
| 2191 | 2182 |
| 2192 FunctionElement immediateRedirectionTarget; | 2183 FunctionElement immediateRedirectionTarget; |
| 2193 PrefixElement redirectionDeferredPrefix; | 2184 PrefixElement redirectionDeferredPrefix; |
| 2194 | 2185 |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3295 body = node.asFunctionExpression().body; | 3286 body = node.asFunctionExpression().body; |
| 3296 } | 3287 } |
| 3297 return new ParsedResolvedAst( | 3288 return new ParsedResolvedAst( |
| 3298 declaration, | 3289 declaration, |
| 3299 node, | 3290 node, |
| 3300 body, | 3291 body, |
| 3301 definingElement.treeElements, | 3292 definingElement.treeElements, |
| 3302 definingElement.compilationUnit.script.resourceUri); | 3293 definingElement.compilationUnit.script.resourceUri); |
| 3303 } | 3294 } |
| 3304 } | 3295 } |
| OLD | NEW |