mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add tests, remove unused code, fix bugs
- Added tests for more error messages - Test the "go to reference" feature at every character index of every test case - Delete unused code and imports - Fix some bugs I found along the way
This commit is contained in:
parent
5b0f662478
commit
9b9fab832b
47 changed files with 140 additions and 190 deletions
|
@ -38,10 +38,6 @@ class ExprBase(AstNode):
|
|||
def type(self) -> T.Optional[GirType]:
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def type_complete(self) -> bool:
|
||||
return True
|
||||
|
||||
@property
|
||||
def rhs(self) -> T.Optional["ExprBase"]:
|
||||
if isinstance(self.parent, Expression):
|
||||
|
@ -65,10 +61,6 @@ class Expression(ExprBase):
|
|||
def type(self) -> T.Optional[GirType]:
|
||||
return self.last.type
|
||||
|
||||
@property
|
||||
def type_complete(self) -> bool:
|
||||
return self.last.type_complete
|
||||
|
||||
|
||||
class InfixExpr(ExprBase):
|
||||
@property
|
||||
|
@ -99,15 +91,6 @@ class LiteralExpr(ExprBase):
|
|||
def type(self) -> T.Optional[GirType]:
|
||||
return self.literal.value.type
|
||||
|
||||
@property
|
||||
def type_complete(self) -> bool:
|
||||
from .values import IdentLiteral
|
||||
|
||||
if isinstance(self.literal.value, IdentLiteral):
|
||||
if object := self.context[ScopeCtx].objects.get(self.literal.value.ident):
|
||||
return not object.gir_class.incomplete
|
||||
return True
|
||||
|
||||
|
||||
class LookupOp(InfixExpr):
|
||||
grammar = [".", UseIdent("property")]
|
||||
|
@ -211,10 +194,6 @@ class CastExpr(InfixExpr):
|
|||
def type(self) -> T.Optional[GirType]:
|
||||
return self.children[TypeName][0].gir_type
|
||||
|
||||
@property
|
||||
def type_complete(self) -> bool:
|
||||
return True
|
||||
|
||||
@validate()
|
||||
def cast_makes_sense(self):
|
||||
if self.type is None or self.lhs.type is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue