nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c8ba5ec
)
Remove class MMSrcLocalProperty. Use MMConcreteProperty instead
author
Jean Privat
<jean@pryen.org>
Fri, 14 Nov 2008 10:04:41 +0000
(
05:04
-0500)
committer
Jean Privat
<jean@pryen.org>
Fri, 14 Nov 2008 10:04:41 +0000
(
05:04
-0500)
src/compiling/compiling_global.nit
patch
|
blob
|
history
src/compiling/compiling_methods.nit
patch
|
blob
|
history
src/syntax/mmbuilder.nit
patch
|
blob
|
history
src/syntax/syntax_base.nit
patch
|
blob
|
history
diff --git
a/src/compiling/compiling_global.nit
b/src/compiling/compiling_global.nit
index
f51aede
..
bf5c74b
100644
(file)
--- a/
src/compiling/compiling_global.nit
+++ b/
src/compiling/compiling_global.nit
@@
-518,7
+518,7
@@
redef class MMSrcModule
v.add_decl("#define {pg.attr_access}(recv) ATTR(recv, {pg.color_id})")
end
end
v.add_decl("#define {pg.attr_access}(recv) ATTR(recv, {pg.color_id})")
end
end
- assert p isa MMSrcLocalProperty
+ assert p isa MMConcreteProperty
p.compile_property_to_c(v)
end
end
p.compile_property_to_c(v)
end
end
@@
-556,11
+556,11
@@
end
class TableEltPropPos
special LocalTableElt
class TableEltPropPos
special LocalTableElt
- attr _property: MMSrcLocalProperty
+ attr _property: MMConcreteProperty
redef meth symbol do return _property.global.color_id
redef meth value(ga) do return "{ga.color(self)} /* Property {_property} */"
redef meth symbol do return _property.global.color_id
redef meth value(ga) do return "{ga.color(self)} /* Property {_property} */"
- init(p: MMSrcLocalProperty)
+ init(p: MMConcreteProperty)
do
_property = p
end
do
_property = p
end
diff --git
a/src/compiling/compiling_methods.nit
b/src/compiling/compiling_methods.nit
index
8a95a4a
..
29c6fda
100644
(file)
--- a/
src/compiling/compiling_methods.nit
+++ b/
src/compiling/compiling_methods.nit
@@
-272,7
+272,7
@@
redef class MMAttribute
end
end
end
end
-redef class MMSrcLocalProperty
+redef class MMConcreteProperty
# Compile the property as a C property
meth compile_property_to_c(v: CompilerVisitor) do end
end
# Compile the property as a C property
meth compile_property_to_c(v: CompilerVisitor) do end
end
diff --git
a/src/syntax/mmbuilder.nit
b/src/syntax/mmbuilder.nit
index
e9cf796
..
ab85b7c
100644
(file)
--- a/
src/syntax/mmbuilder.nit
+++ b/
src/syntax/mmbuilder.nit
@@
-135,12
+135,12
@@
end
redef class MMSrcLocalClass
# Add a source property
# Register it to the class and attach it to global property
redef class MMSrcLocalClass
# Add a source property
# Register it to the class and attach it to global property
- private meth add_src_local_property(v: PropertyBuilderVisitor, prop: MMSrcLocalProperty)
+ private meth add_src_local_property(v: PropertyBuilderVisitor, prop: MMConcreteProperty)
do
var pname = prop.name
# Check double definition in the same class
if src_local_properties.has_key(pname) then
do
var pname = prop.name
# Check double definition in the same class
if src_local_properties.has_key(pname) then
- v.error(prop.node, "Error: A property {pname} is already defined in class {name} at line {src_local_properties[pname].node.first_token.line}.")
+ v.error(prop.node, "Error: A property {pname} is already defined in class {name}.")
return
end
src_local_properties[pname] = prop
return
end
src_local_properties[pname] = prop
@@
-595,7
+595,7
@@
redef class PPropdef
# * Check redef errors.
# * Check forbiden attribute definitions.
# * Check signature conformance.
# * Check redef errors.
# * Check forbiden attribute definitions.
# * Check signature conformance.
- private meth process_and_check(v: PropertyVerifierVisitor, prop: MMSrcLocalProperty, has_redef: Bool, visibility_level: Int)
+ private meth process_and_check(v: PropertyVerifierVisitor, prop: MMConcreteProperty, has_redef: Bool, visibility_level: Int)
do
if prop.global.intro == prop then
do_and_check_intro(v, prop, has_redef, visibility_level)
do
if prop.global.intro == prop then
do_and_check_intro(v, prop, has_redef, visibility_level)
@@
-605,7
+605,7
@@
redef class PPropdef
end
# The part of process_and_check when prop is an introduction
end
# The part of process_and_check when prop is an introduction
- private meth do_and_check_intro(v: PropertyVerifierVisitor, prop: MMSrcLocalProperty, has_redef: Bool, visibility_level: Int)
+ private meth do_and_check_intro(v: PropertyVerifierVisitor, prop: MMConcreteProperty, has_redef: Bool, visibility_level: Int)
do
var glob = prop.global
var gbc = prop.local_class.global
do
var glob = prop.global
var gbc = prop.local_class.global
@@
-645,7
+645,7
@@
redef class PPropdef
end
end
end
end
- private meth inherit_signature(v: PropertyVerifierVisitor, prop: MMSrcLocalProperty, supers: Array[MMLocalProperty])
+ private meth inherit_signature(v: PropertyVerifierVisitor, prop: MMConcreteProperty, supers: Array[MMLocalProperty])
do
var s = prop.signature
for ip in supers do
do
var s = prop.signature
for ip in supers do
@@
-672,7
+672,7
@@
redef class PPropdef
end
# The part of process_and_check when prop is a redefinition
end
# The part of process_and_check when prop is a redefinition
- private meth do_and_check_redef(v: PropertyVerifierVisitor, prop: MMSrcLocalProperty, has_redef: Bool, visibility_level: Int)
+ private meth do_and_check_redef(v: PropertyVerifierVisitor, prop: MMConcreteProperty, has_redef: Bool, visibility_level: Int)
do
var is_init = self isa AConcreteInitPropdef
var glob = prop.global
do
var is_init = self isa AConcreteInitPropdef
var glob = prop.global
@@
-940,7
+940,7
@@
end
redef class PSignature
# Check that visibilities of types in the signature are compatible with the visibility of the property.
redef class PSignature
# Check that visibilities of types in the signature are compatible with the visibility of the property.
- meth check_visibility(v: AbsSyntaxVisitor, p: MMSrcLocalProperty) is abstract
+ meth check_visibility(v: AbsSyntaxVisitor, p: MMConcreteProperty) is abstract
end
redef class ASignature
end
redef class ASignature
@@
-1020,7
+1020,7
@@
end
redef class PType
# Check that visibilities of types in the signature are compatible with the visibility of the property.
redef class PType
# Check that visibilities of types in the signature are compatible with the visibility of the property.
- private meth check_visibility(v: AbsSyntaxVisitor, p: MMSrcLocalProperty) is abstract
+ private meth check_visibility(v: AbsSyntaxVisitor, p: MMConcreteProperty) is abstract
end
redef class AType
end
redef class AType
diff --git
a/src/syntax/syntax_base.nit
b/src/syntax/syntax_base.nit
index
6bd86ef
..
e35b117
100644
(file)
--- a/
src/syntax/syntax_base.nit
+++ b/
src/syntax/syntax_base.nit
@@
-66,13
+66,13
@@
special MMConcreteClass
readable writable attr _formal_dict: Map[Symbol, MMTypeFormalParameter]
# Concrete NIT source properties by name
readable writable attr _formal_dict: Map[Symbol, MMTypeFormalParameter]
# Concrete NIT source properties by name
- readable attr _src_local_properties: Map[Symbol, MMSrcLocalProperty]
+ readable attr _src_local_properties: Map[Symbol, MMConcreteProperty]
init(n: Symbol, cla: PClassdef, a: Int)
do
super(n, a)
_nodes = [cla]
init(n: Symbol, cla: PClassdef, a: Int)
do
super(n, a)
_nodes = [cla]
- _src_local_properties = new HashMap[Symbol, MMSrcLocalProperty]
+ _src_local_properties = new HashMap[Symbol, MMConcreteProperty]
end
end
end
end
@@
-99,20
+99,16
@@
redef class MMGlobalProperty
end
end
end
end
-# Concrete NIT source local property
-class MMSrcLocalProperty
-special MMConcreteProperty
- # Type of the related AST node
- type NODE: PPropdef
-
- # The related AST node
- readable attr _node: NODE
+redef class MMConcreteProperty
+ # The attached node (if any)
+ meth node: PNode do return null
end
# Concrete NIT source attribute
class MMSrcAttribute
end
# Concrete NIT source attribute
class MMSrcAttribute
-special MMSrcLocalProperty
+special MMConcreteProperty
special MMAttribute
special MMAttribute
+ redef readable attr _node: AAttrPropdef
init(name: Symbol, cla: MMLocalClass, n: AAttrPropdef)
do
super(name, cla, self)
init(name: Symbol, cla: MMLocalClass, n: AAttrPropdef)
do
super(name, cla, self)
@@
-122,14
+118,14
@@
end
# Concrete NIT source method
class MMSrcMethod
# Concrete NIT source method
class MMSrcMethod
-special MMSrcLocalProperty
+special MMConcreteProperty
special MMMethod
end
# Concrete NIT source method for an automatic accesor
class MMAttrImplementationMethod
special MMSrcMethod
special MMMethod
end
# Concrete NIT source method for an automatic accesor
class MMAttrImplementationMethod
special MMSrcMethod
- redef type NODE: AAttrPropdef
+ redef readable attr _node: AAttrPropdef
end
# Concrete NIT source method for an automatic read accesor
end
# Concrete NIT source method for an automatic read accesor
@@
-157,8
+153,7
@@
end
# Concrete NIT source method for an explicit method
class MMMethSrcMethod
special MMSrcMethod
# Concrete NIT source method for an explicit method
class MMMethSrcMethod
special MMSrcMethod
- redef type NODE: AMethPropdef
-
+ redef readable attr _node: AMethPropdef
init(name: Symbol, cla: MMLocalClass, n: AMethPropdef)
do
super(name, cla, self)
init(name: Symbol, cla: MMLocalClass, n: AMethPropdef)
do
super(name, cla, self)
@@
-168,8
+163,9
@@
end
# Concrete NIT source virtual type
class MMSrcTypeProperty
# Concrete NIT source virtual type
class MMSrcTypeProperty
-special MMSrcLocalProperty
+special MMConcreteProperty
special MMTypeProperty
special MMTypeProperty
+ redef readable attr _node: ATypePropdef
init(name: Symbol, cla: MMLocalClass, n: ATypePropdef)
do
super(name, cla, self)
init(name: Symbol, cla: MMLocalClass, n: ATypePropdef)
do
super(name, cla, self)
@@
-270,7
+266,7
@@
special Visitor
readable writable attr _local_class: MMSrcLocalClass
# The current property
readable writable attr _local_class: MMSrcLocalClass
# The current property
- readable writable attr _local_property: MMSrcLocalProperty
+ readable writable attr _local_property: MMConcreteProperty
# The current tool configuration/status
readable attr _tc: ToolContext
# The current tool configuration/status
readable attr _tc: ToolContext