File tree Expand file tree Collapse file tree 4 files changed +37
-5
lines changed
Expand file tree Collapse file tree 4 files changed +37
-5
lines changed Original file line number Diff line number Diff line change 44//
55// Copyright (c) 2019, Olof Kraigher olof.kraigher@gmail.com
66
7+ #[ macro_use]
78mod analyze;
89mod concurrent;
910mod declarative;
Original file line number Diff line number Diff line change @@ -72,6 +72,19 @@ impl AnalysisError {
7272 }
7373}
7474
75+ /// Converts an AnalysisResult to FatalNullResult
76+ macro_rules! ok_or_return {
77+ ( $result: ident, $diagnostics: ident) => {
78+ match $result {
79+ Ok ( value) => value,
80+ Err ( err) => {
81+ err. add_to( $diagnostics) ?;
82+ return Ok ( ( ) ) ;
83+ }
84+ }
85+ } ;
86+ }
87+
7588pub ( super ) struct AnalyzeContext < ' a > {
7689 root : & ' a DesignRoot ,
7790
Original file line number Diff line number Diff line change @@ -533,17 +533,26 @@ impl<'a> AnalyzeContext<'a> {
533533 ) ;
534534 }
535535 InterfaceDeclaration :: Object ( ref mut object_decl) => {
536- self . analyze_subtype_indication (
536+ let subtype = self . resolve_subtype_indication (
537537 region,
538538 & mut object_decl. subtype_indication ,
539539 diagnostics,
540- ) ?;
540+ ) ;
541+
541542 if let Some ( ref mut expression) = object_decl. expression {
542543 self . analyze_expression ( region, expression, diagnostics) ?
543544 }
545+
546+ let subtype = ok_or_return ! ( subtype, diagnostics) ;
547+
544548 region. add (
545549 & object_decl. ident ,
546- NamedEntityKind :: InterfaceObject ( object_decl. class ) ,
550+ NamedEntityKind :: InterfaceObject ( InterfaceObject {
551+ class : object_decl. class ,
552+ mode : object_decl. mode ,
553+ subtype,
554+ has_default : object_decl. expression . is_some ( ) ,
555+ } ) ,
547556 diagnostics,
548557 ) ;
549558 }
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ pub enum NamedEntityKind {
2626 InterfaceType ,
2727 Label ,
2828 Object ( ObjectClass ) ,
29- InterfaceObject ( ObjectClass ) ,
29+ InterfaceObject ( InterfaceObject ) ,
3030 PhysicalLiteral ,
3131 DeferredConstant ,
3232 // The region of the protected type which needs to be extendend by the body
@@ -91,7 +91,7 @@ impl NamedEntityKind {
9191 InterfaceType => "type" ,
9292 Label => "label" ,
9393 Object ( class) => class. describe ( ) ,
94- InterfaceObject ( class ) => class. describe ( ) ,
94+ InterfaceObject ( object ) => object . class . describe ( ) ,
9595 PhysicalLiteral => "physical literal" ,
9696 DeferredConstant => "deferred constant" ,
9797 ProtectedType ( ..) => "protected type" ,
@@ -107,6 +107,15 @@ impl NamedEntityKind {
107107 }
108108}
109109
110+ /// Signals, (shared) variables and constants
111+ #[ derive( Clone ) ]
112+ pub struct InterfaceObject {
113+ pub class : ObjectClass ,
114+ pub mode : Mode ,
115+ pub subtype : Subtype ,
116+ pub has_default : bool ,
117+ }
118+
110119#[ derive( Clone ) ]
111120pub struct Subtype {
112121 base : Arc < NamedEntity > ,
You can’t perform that action at this time.
0 commit comments